Unstable 0.1400.8.0

This commit is contained in:
Markus Isberg
2021-08-13 17:52:45 +09:00
parent 47707c824a
commit 27dd9e6022
38 changed files with 183 additions and 113 deletions
@@ -205,9 +205,14 @@ namespace Barotrauma
{
foreach (Key key in keys)
{
if (key == null) continue;
if (key == null) { continue; }
key.Reset();
}
if (GUI.InputBlockingMenuOpen)
{
cursorPosition =
Position + PlayerInput.MouseSpeed.ClampLength(10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking
}
}
else
{
@@ -280,13 +285,13 @@ namespace Barotrauma
{
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected * item.OffsetOnSelectedMultiplier;
}
else if (SelectedConstruction != null && ViewTarget == null &&
else if (SelectedConstruction != null && ViewTarget == null &&
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
{
cam.OffsetAmount = targetOffsetAmount = 0.0f;
cursorPosition =
SelectedConstruction.Position +
new Vector2(cursorPosition.X % 10.0f, cursorPosition.Y % 10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking
cursorPosition =
SelectedConstruction.Position +
PlayerInput.MouseSpeed.ClampLength(10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking
}
else if (!GameMain.Config.EnableMouseLook)
{
@@ -439,7 +439,8 @@ namespace Barotrauma
bool mouseOnPortrait = false;
if (character.Stun <= 0.1f && !character.IsDead)
{
if (CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null)
bool wiringMode = Screen.Selected == GameMain.SubEditorScreen && GameMain.SubEditorScreen.WiringMode;
if (CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null && !wiringMode)
{
if (character.Info != null && !character.ShouldLockHud())
{
@@ -1914,13 +1914,17 @@ namespace Barotrauma
i++;
}
if (selectedLimbIndex > -1)
if (selectedLimbIndex > -1 && selectedLimbText != null)
{
var selectedLimbArea = GetLimbHighlightArea(limbHealths[selectedLimbIndex], drawArea);
GUI.DrawLine(spriteBatch,
new Vector2(selectedLimbText.Rect.X, selectedLimbText.Rect.Center.Y),
selectedLimbArea.Center.ToVector2(),
Color.LightGray * 0.5f, width: 4);
LimbHealth limbHealth = limbHealths[selectedLimbIndex];
if (limbHealth?.IndicatorSprite != null)
{
Rectangle selectedLimbArea = GetLimbHighlightArea(limbHealth, drawArea);
GUI.DrawLine(spriteBatch,
new Vector2(selectedLimbText.Rect.X, selectedLimbText.Rect.Center.Y),
selectedLimbArea.Center.ToVector2(),
Color.LightGray * 0.5f, width: 4);
}
}
if (draggingMed != null)
@@ -1005,12 +1005,6 @@ namespace Barotrauma
// Sub editor drag and highlight
case SubEditorScreen editor:
{
// Portrait area
if (editor.WiringMode && HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition))
{
return CursorState.Hand;
}
foreach (var mapEntity in MapEntity.mapEntityList)
{
if (MapEntity.StartMovingPos != Vector2.Zero)
@@ -849,8 +849,19 @@ namespace Barotrauma
string quantityText = "";
if (linkedItems.Count > 1)
{
quantityText = " " + TextManager.GetWithVariable("campaignstore.quantity", "[amount]", (linkedItems.Count).ToString());
name += quantityText;
foreach (ItemPrefab distinctItem in linkedItems.Select(it => it.Prefab).Distinct())
{
if (quantityText != string.Empty)
{
quantityText += ", ";
}
int count = linkedItems.Count(it => it.Prefab == distinctItem);
quantityText += distinctItem.Name;
if (count > 1)
{
quantityText += " " + TextManager.GetWithVariable("campaignstore.quantity", "[amount]", count.ToString());
}
}
}
bool isOpen = false;
@@ -873,7 +884,7 @@ namespace Barotrauma
new GUITextBlock(rectT(0.3f, 1f, buttonLayout), text: slotText, font: GUI.SubHeadingFont);
GUILayoutGroup group = new GUILayoutGroup(rectT(0.7f, 1f, buttonLayout), isHorizontal: true) { Stretch = true };
string title = item.PendingItemSwap != null ? TextManager.GetWithVariable("upgrades.pendingitem", "[itemname]", name) : (linkedItems.Count > 1 ? item.Name + quantityText : item.Name);
string title = item.PendingItemSwap != null ? TextManager.GetWithVariable("upgrades.pendingitem", "[itemname]", name) : quantityText;
GUITextBlock text = new GUITextBlock(rectT(0.7f, 1f, group), text: title, font: GUI.SubHeadingFont, textAlignment: Alignment.Right, parseRichText: true)
{
TextColor = GUI.Style.Orange
@@ -896,7 +907,7 @@ namespace Barotrauma
if (isUninstallPending) { canUninstall = false; }
frames.Add(CreateUpgradeEntry(rectT(1f, 0.25f, parent.Content), currentOrPending.UpgradePreviewSprite,
TextManager.GetWithVariable(item.PendingItemSwap != null ? "upgrades.pendingitem" : "upgrades.installeditem", "[itemname]", name),
item.PendingItemSwap != null ? TextManager.GetWithVariable("upgrades.pendingitem", "[itemname]", name) : TextManager.GetWithVariable("upgrades.installeditem", "[itemname]", quantityText),
currentOrPending.Description,
0, null, addBuyButton: canUninstall, addProgressBar: false, buttonStyle: "WeaponUninstallButton"));
@@ -133,7 +133,6 @@ namespace Barotrauma
hidePersonalSlots = !hidePersonalSlots;
return true;
};
hidePersonalSlots = false;
SlotPositions = new Vector2[SlotTypes.Length];
@@ -258,6 +257,15 @@ namespace Barotrauma
if (IsInLimbSlot(item, InvSlotType.Any)) { return true; }
}
//don't draw equipment slots in wiring mode
if (Screen.Selected == GameMain.SubEditorScreen && GameMain.SubEditorScreen.WiringMode)
{
if (SlotTypes[i] != InvSlotType.Any && SlotTypes[i] != InvSlotType.LeftHand && SlotTypes[i] != InvSlotType.RightHand)
{
return true;
}
}
return false;
}
@@ -339,7 +347,7 @@ namespace Barotrauma
hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
hideButton.RectTransform.NonScaledSize = new Point(HideButtonWidth, HUDLayoutSettings.BottomRightInfoArea.Height);
hideButton.RectTransform.AbsoluteOffset = new Point(HUDLayoutSettings.BottomRightInfoArea.Left - HideButtonWidth + GUI.IntScaleCeiling(2f), HUDLayoutSettings.BottomRightInfoArea.Y + GUI.IntScaleCeiling(1f));
hideButton.Visible = true;
hideButton.Visible = Screen.Selected != GameMain.SubEditorScreen || !GameMain.SubEditorScreen.WiringMode;
SetIndicatorSizes();
}
@@ -562,7 +562,7 @@ namespace Barotrauma.Items.Components
{
if (selectedItem == null) { return false; }
if (fabricatedItem == null &&
!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition))
!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health))
{
outputSlot.Flash(GUI.Style.Red);
return false;
@@ -1104,8 +1104,10 @@ namespace Barotrauma
public static void UpdateDragging()
{
DraggingItems.RemoveAll(it => !Character.Controlled.CanInteractWith(it));
if (Screen.Selected == GameMain.GameScreen)
{
DraggingItems.RemoveAll(it => !Character.Controlled.CanInteractWith(it));
}
if (DraggingItems.Any() && PlayerInput.PrimaryMouseButtonReleased())
{
Character.Controlled.ClearInputs();
@@ -1470,7 +1472,7 @@ namespace Barotrauma
if (DraggingItems.Any() && inventory != null && slotIndex > -1 && slotIndex < inventory.visualSlots.Length)
{
if (inventory.CanBePut(DraggingItems.First(), slotIndex))
if (inventory.CanBePutInSlot(DraggingItems.First(), slotIndex))
{
canBePut = true;
}
@@ -4506,7 +4506,7 @@ namespace Barotrauma
{
var newItem = new Item(itemPrefab, Vector2.Zero, Submarine.MainSub);
if (inv.CanBePut(itemPrefab, i))
if (inv.CanBePutInSlot(itemPrefab, i, condition: null))
{
bool placedItem = inv.TryPutItem(newItem, i, false, true, dummyCharacter);
spawnedItem |= placedItem;
@@ -851,7 +851,7 @@ namespace Barotrauma
}
}
int noiseLoopIndex = 1;
if (Level.Loaded?.Type == LevelData.LevelType.LocationConnection)
{
// Find background noise loop for the current biome
@@ -859,7 +859,6 @@ namespace Barotrauma
GetSuitableMusicClips(Level.Loaded.LevelData?.Biome?.Identifier, currentIntensity) :
Enumerable.Empty<BackgroundMusic>();
int noiseLoopIndex = 1;
if (suitableNoiseLoops.Count() == 0)
{
targetMusic[noiseLoopIndex] = null;
@@ -870,6 +869,10 @@ namespace Barotrauma
targetMusic[noiseLoopIndex] = suitableNoiseLoops.GetRandom();
}
}
else
{
targetMusic[noiseLoopIndex] = null;
}
//get the appropriate intensity layers for current situation
IEnumerable<BackgroundMusic> suitableIntensityMusic = Screen.Selected == GameMain.GameScreen ?