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) foreach (Key key in keys)
{ {
if (key == null) continue; if (key == null) { continue; }
key.Reset(); 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 else
{ {
@@ -280,13 +285,13 @@ namespace Barotrauma
{ {
cam.OffsetAmount = targetOffsetAmount = item.Prefab.OffsetOnSelected * item.OffsetOnSelectedMultiplier; 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))) SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
{ {
cam.OffsetAmount = targetOffsetAmount = 0.0f; cam.OffsetAmount = targetOffsetAmount = 0.0f;
cursorPosition = cursorPosition =
SelectedConstruction.Position + 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 PlayerInput.MouseSpeed.ClampLength(10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking
} }
else if (!GameMain.Config.EnableMouseLook) else if (!GameMain.Config.EnableMouseLook)
{ {
@@ -439,7 +439,8 @@ namespace Barotrauma
bool mouseOnPortrait = false; bool mouseOnPortrait = false;
if (character.Stun <= 0.1f && !character.IsDead) 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()) if (character.Info != null && !character.ShouldLockHud())
{ {
@@ -1914,13 +1914,17 @@ namespace Barotrauma
i++; i++;
} }
if (selectedLimbIndex > -1) if (selectedLimbIndex > -1 && selectedLimbText != null)
{ {
var selectedLimbArea = GetLimbHighlightArea(limbHealths[selectedLimbIndex], drawArea); LimbHealth limbHealth = limbHealths[selectedLimbIndex];
GUI.DrawLine(spriteBatch, if (limbHealth?.IndicatorSprite != null)
new Vector2(selectedLimbText.Rect.X, selectedLimbText.Rect.Center.Y), {
selectedLimbArea.Center.ToVector2(), Rectangle selectedLimbArea = GetLimbHighlightArea(limbHealth, drawArea);
Color.LightGray * 0.5f, width: 4); GUI.DrawLine(spriteBatch,
new Vector2(selectedLimbText.Rect.X, selectedLimbText.Rect.Center.Y),
selectedLimbArea.Center.ToVector2(),
Color.LightGray * 0.5f, width: 4);
}
} }
if (draggingMed != null) if (draggingMed != null)
@@ -1005,12 +1005,6 @@ namespace Barotrauma
// Sub editor drag and highlight // Sub editor drag and highlight
case SubEditorScreen editor: case SubEditorScreen editor:
{ {
// Portrait area
if (editor.WiringMode && HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition))
{
return CursorState.Hand;
}
foreach (var mapEntity in MapEntity.mapEntityList) foreach (var mapEntity in MapEntity.mapEntityList)
{ {
if (MapEntity.StartMovingPos != Vector2.Zero) if (MapEntity.StartMovingPos != Vector2.Zero)
@@ -849,8 +849,19 @@ namespace Barotrauma
string quantityText = ""; string quantityText = "";
if (linkedItems.Count > 1) if (linkedItems.Count > 1)
{ {
quantityText = " " + TextManager.GetWithVariable("campaignstore.quantity", "[amount]", (linkedItems.Count).ToString()); foreach (ItemPrefab distinctItem in linkedItems.Select(it => it.Prefab).Distinct())
name += quantityText; {
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; bool isOpen = false;
@@ -873,7 +884,7 @@ namespace Barotrauma
new GUITextBlock(rectT(0.3f, 1f, buttonLayout), text: slotText, font: GUI.SubHeadingFont); 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 }; 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) GUITextBlock text = new GUITextBlock(rectT(0.7f, 1f, group), text: title, font: GUI.SubHeadingFont, textAlignment: Alignment.Right, parseRichText: true)
{ {
TextColor = GUI.Style.Orange TextColor = GUI.Style.Orange
@@ -896,7 +907,7 @@ namespace Barotrauma
if (isUninstallPending) { canUninstall = false; } if (isUninstallPending) { canUninstall = false; }
frames.Add(CreateUpgradeEntry(rectT(1f, 0.25f, parent.Content), currentOrPending.UpgradePreviewSprite, 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, currentOrPending.Description,
0, null, addBuyButton: canUninstall, addProgressBar: false, buttonStyle: "WeaponUninstallButton")); 0, null, addBuyButton: canUninstall, addProgressBar: false, buttonStyle: "WeaponUninstallButton"));
@@ -133,7 +133,6 @@ namespace Barotrauma
hidePersonalSlots = !hidePersonalSlots; hidePersonalSlots = !hidePersonalSlots;
return true; return true;
}; };
hidePersonalSlots = false; hidePersonalSlots = false;
SlotPositions = new Vector2[SlotTypes.Length]; SlotPositions = new Vector2[SlotTypes.Length];
@@ -258,6 +257,15 @@ namespace Barotrauma
if (IsInLimbSlot(item, InvSlotType.Any)) { return true; } 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; return false;
} }
@@ -339,7 +347,7 @@ namespace Barotrauma
hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft); hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
hideButton.RectTransform.NonScaledSize = new Point(HideButtonWidth, HUDLayoutSettings.BottomRightInfoArea.Height); 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.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(); SetIndicatorSizes();
} }
@@ -562,7 +562,7 @@ namespace Barotrauma.Items.Components
{ {
if (selectedItem == null) { return false; } if (selectedItem == null) { return false; }
if (fabricatedItem == null && 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); outputSlot.Flash(GUI.Style.Red);
return false; return false;
@@ -1104,8 +1104,10 @@ namespace Barotrauma
public static void UpdateDragging() 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()) if (DraggingItems.Any() && PlayerInput.PrimaryMouseButtonReleased())
{ {
Character.Controlled.ClearInputs(); Character.Controlled.ClearInputs();
@@ -1470,7 +1472,7 @@ namespace Barotrauma
if (DraggingItems.Any() && inventory != null && slotIndex > -1 && slotIndex < inventory.visualSlots.Length) 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; canBePut = true;
} }
@@ -4506,7 +4506,7 @@ namespace Barotrauma
{ {
var newItem = new Item(itemPrefab, Vector2.Zero, Submarine.MainSub); 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); bool placedItem = inv.TryPutItem(newItem, i, false, true, dummyCharacter);
spawnedItem |= placedItem; spawnedItem |= placedItem;
@@ -851,7 +851,7 @@ namespace Barotrauma
} }
} }
int noiseLoopIndex = 1;
if (Level.Loaded?.Type == LevelData.LevelType.LocationConnection) if (Level.Loaded?.Type == LevelData.LevelType.LocationConnection)
{ {
// Find background noise loop for the current biome // Find background noise loop for the current biome
@@ -859,7 +859,6 @@ namespace Barotrauma
GetSuitableMusicClips(Level.Loaded.LevelData?.Biome?.Identifier, currentIntensity) : GetSuitableMusicClips(Level.Loaded.LevelData?.Biome?.Identifier, currentIntensity) :
Enumerable.Empty<BackgroundMusic>(); Enumerable.Empty<BackgroundMusic>();
int noiseLoopIndex = 1;
if (suitableNoiseLoops.Count() == 0) if (suitableNoiseLoops.Count() == 0)
{ {
targetMusic[noiseLoopIndex] = null; targetMusic[noiseLoopIndex] = null;
@@ -870,6 +869,10 @@ namespace Barotrauma
targetMusic[noiseLoopIndex] = suitableNoiseLoops.GetRandom(); targetMusic[noiseLoopIndex] = suitableNoiseLoops.GetRandom();
} }
} }
else
{
targetMusic[noiseLoopIndex] = null;
}
//get the appropriate intensity layers for current situation //get the appropriate intensity layers for current situation
IEnumerable<BackgroundMusic> suitableIntensityMusic = Screen.Selected == GameMain.GameScreen ? IEnumerable<BackgroundMusic> suitableIntensityMusic = Screen.Selected == GameMain.GameScreen ?
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -37,6 +37,14 @@ namespace Barotrauma
public void SpawnInventoryItems(Character character, Inventory inventory) public void SpawnInventoryItems(Character character, Inventory inventory)
{ {
if (character == null)
{
throw new System.InvalidOperationException($"Failed to spawn inventory items. Character was null.");
}
if (itemData == null)
{
throw new System.InvalidOperationException($"Failed to spawn inventory items for the character \"{character.Name}\". No saved inventory data.");
}
character.SpawnInventoryItems(inventory, itemData); character.SpawnInventoryItems(inventory, itemData);
} }
@@ -426,7 +426,14 @@ namespace Barotrauma.Networking
} }
else else
{ {
characterData.SpawnInventoryItems(character, character.Inventory); if (characterData.HasItemData)
{
characterData.SpawnInventoryItems(character, character.Inventory);
}
else
{
character.GiveJobItems(mainSubSpawnPoints[i]);
}
characterData.ApplyHealthData(character); characterData.ApplyHealthData(character);
character.GiveIdCardTags(mainSubSpawnPoints[i]); character.GiveIdCardTags(mainSubSpawnPoints[i]);
characterData.HasSpawned = true; characterData.HasSpawned = true;
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.1400.7.0</Version> <Version>0.1400.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -2527,9 +2527,8 @@ namespace Barotrauma
// Don't target items that we own. // Don't target items that we own.
// This is a rare case, and almost entirely related to Humanhusks, so let's check it last to reduce unnecessary checks (although the check shouldn't be expensive) // This is a rare case, and almost entirely related to Humanhusks, so let's check it last to reduce unnecessary checks (although the check shouldn't be expensive)
if (owner == character) { continue; } if (owner == character) { continue; }
if (owner != null && IsFriendly(Character, owner)) if (owner != null && (IsFriendly(Character, owner) || owner.AiTarget != null && ignoredTargets.Contains(owner.AiTarget)))
{ {
// If the item is held by a friendly character, ignore it.
continue; continue;
} }
} }
@@ -480,19 +480,18 @@ namespace Barotrauma
isCurrentObjectiveFindSafety || isCurrentObjectiveFindSafety ||
Character.AnimController.InWater || Character.AnimController.InWater ||
Character.AnimController.HeadInWater || Character.AnimController.HeadInWater ||
Character.CurrentHull == null ||
Character.Submarine == null || Character.Submarine == null ||
(Character.Submarine.TeamID != Character.TeamID && !Character.IsEscorted) || (Character.Submarine.TeamID != Character.TeamID && !Character.IsEscorted) ||
ObjectiveManager.CurrentObjective.GetSubObjectivesRecursive(true).Any(o => o.KeepDivingGearOn); ObjectiveManager.CurrentObjective.GetSubObjectivesRecursive(true).Any(o => o.KeepDivingGearOn) ||
Character.CurrentHull.OxygenPercentage < HULL_LOW_OXYGEN_PERCENTAGE + 10;
bool IsOrderedToWait() => Character.IsOnPlayerTeam && ObjectiveManager.CurrentOrder is AIObjectiveGoTo goTo && goTo.Target == Character;
bool removeDivingSuit = !shouldKeepTheGearOn && !IsOrderedToWait();
if (oxygenLow && Character.CurrentHull.Oxygen > 0 && (!isCurrentObjectiveFindSafety || Character.OxygenAvailable < 1)) if (oxygenLow && Character.CurrentHull.Oxygen > 0 && (!isCurrentObjectiveFindSafety || Character.OxygenAvailable < 1))
{ {
shouldKeepTheGearOn = false; shouldKeepTheGearOn = false;
// Remove the suit before we pass out
removeDivingSuit = true;
} }
else if (Character.CurrentHull.OxygenPercentage < HULL_LOW_OXYGEN_PERCENTAGE + 10)
{
shouldKeepTheGearOn = true;
}
bool removeDivingSuit = !shouldKeepTheGearOn && Character.Submarine?.TeamID == Character.TeamID && (!(ObjectiveManager.CurrentOrder is AIObjectiveGoTo goTo) || goTo.Target != Character);
bool takeMaskOff = !shouldKeepTheGearOn; bool takeMaskOff = !shouldKeepTheGearOn;
if (!shouldKeepTheGearOn && !oxygenLow) if (!shouldKeepTheGearOn && !oxygenLow)
{ {
@@ -242,7 +242,7 @@ namespace Barotrauma
Character followTarget = Target as Character; Character followTarget = Target as Character;
bool needsDivingSuit = targetIsOutside; bool needsDivingSuit = targetIsOutside;
bool needsDivingGear = needsDivingSuit || HumanAIController.NeedsDivingGear(targetHull, out needsDivingSuit); bool needsDivingGear = needsDivingSuit || HumanAIController.NeedsDivingGear(targetHull, out needsDivingSuit);
if (!needsDivingGear && mimic) if (mimic)
{ {
if (HumanAIController.HasDivingSuit(followTarget)) if (HumanAIController.HasDivingSuit(followTarget))
{ {
@@ -312,7 +312,7 @@ namespace Barotrauma
} }
} }
} }
if (itemNameList.Count > 0) if (itemNameList.Any())
{ {
string itemListStr = ""; string itemListStr = "";
if (itemNameList.Count == 1) if (itemNameList.Count == 1)
@@ -342,12 +342,17 @@ namespace Barotrauma
} }
}); });
} }
else if (cprSuitability <= 0)
{
character.Speak(TextManager.GetWithVariable("dialogcannottreatpatient", "[name]", targetCharacter.DisplayName, formatCapitals: false), identifier: "cannottreatpatient", minDurationBetweenSimilar: 20.0f);
Abandon = true;
}
} }
} }
else if (!targetCharacter.IsUnconscious) else if (!targetCharacter.IsUnconscious)
{ {
//no suitable treatments found, not inside our own sub (= can't search for more treatments), the target isn't unconscious (= can't give CPR) //no suitable treatments found, not inside our own sub (= can't search for more treatments), the target isn't unconscious (= can't give CPR)
// -> abandon character.Speak(TextManager.GetWithVariable("dialogcannottreatpatient", "[name]", targetCharacter.DisplayName, formatCapitals: false), identifier: "cannottreatpatient", minDurationBetweenSimilar: 20.0f);
Abandon = true; Abandon = true;
return; return;
} }
@@ -2708,25 +2708,18 @@ namespace Barotrauma
UpdateAIChatMessages(deltaTime); UpdateAIChatMessages(deltaTime);
//Do ragdoll shenanigans before Stun because it's still technically a stun, innit? Less network updates for us! //Do ragdoll shenanigans before Stun because it's still technically a stun, innit? Less network updates for us!
bool allowRagdoll = GameMain.NetworkMember != null ? GameMain.NetworkMember.ServerSettings.AllowRagdollButton : true; bool allowRagdoll = GameMain.NetworkMember?.ServerSettings?.AllowRagdollButton ?? true;
bool tooFastToUnragdoll = AnimController.Collider.LinearVelocity.LengthSquared() > 1f; bool tooFastToUnragdoll = AnimController.Collider.LinearVelocity.LengthSquared() > 5.0f * 5.0f;
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient)
{
tooFastToUnragdoll = false;
}
if (IsForceRagdolled) if (IsForceRagdolled)
{ {
IsRagdolled = IsForceRagdolled; IsRagdolled = IsForceRagdolled;
} }
else if (IsRemotePlayer)
{
IsRagdolled = IsKeyDown(InputType.Ragdoll);
}
//Keep us ragdolled if we were forced or we're too speedy to unragdoll //Keep us ragdolled if we were forced or we're too speedy to unragdoll
else if (allowRagdoll && (!IsRagdolled || !tooFastToUnragdoll)) else if (allowRagdoll && (!IsRagdolled || !tooFastToUnragdoll))
{ {
if (ragdollingLockTimer > 0.0f) if (ragdollingLockTimer > 0.0f)
{ {
SetInput(InputType.Ragdoll, false, true);
ragdollingLockTimer -= deltaTime; ragdollingLockTimer -= deltaTime;
} }
else else
@@ -2908,7 +2901,7 @@ namespace Barotrauma
} }
private float despawnTimer; private float despawnTimer;
private void UpdateDespawn(float deltaTime, bool ignoreThresholds = false) private void UpdateDespawn(float deltaTime, bool ignoreThresholds = false, bool createNetworkEvents = true)
{ {
if (!EnableDespawn) { return; } if (!EnableDespawn) { return; }
@@ -2979,10 +2972,10 @@ namespace Barotrauma
if (itemContainer == null) { return; } if (itemContainer == null) { return; }
foreach (Item inventoryItem in Inventory.AllItemsMod) foreach (Item inventoryItem in Inventory.AllItemsMod)
{ {
if (!itemContainer.Inventory.TryPutItem(inventoryItem, user: null)) if (!itemContainer.Inventory.TryPutItem(inventoryItem, user: null, createNetworkEvent: createNetworkEvents))
{ {
//if the item couldn't be put inside the despawn container, just drop it //if the item couldn't be put inside the despawn container, just drop it
inventoryItem.Drop(dropper: this); inventoryItem.Drop(dropper: this, createNetworkEvent: createNetworkEvents);
} }
} }
} }
@@ -2994,7 +2987,7 @@ namespace Barotrauma
public void DespawnNow(bool createNetworkEvents = true) public void DespawnNow(bool createNetworkEvents = true)
{ {
despawnTimer = GameMain.Config.CorpseDespawnDelay; despawnTimer = GameMain.Config.CorpseDespawnDelay;
UpdateDespawn(1.0f, ignoreThresholds: true); UpdateDespawn(1.0f, ignoreThresholds: true, createNetworkEvents: createNetworkEvents);
Spawner.Update(createNetworkEvents); Spawner.Update(createNetworkEvents);
} }
@@ -3990,7 +3983,7 @@ namespace Barotrauma
//now there's just one, try to put the extra items where they fit (= stack them) //now there's just one, try to put the extra items where they fit (= stack them)
for (int i = 0; i < inventory.Capacity; i++) for (int i = 0; i < inventory.Capacity; i++)
{ {
if (inventory.CanBePut(newItem, i)) if (inventory.CanBePutInSlot(newItem, i))
{ {
slotIndices[0] = i; slotIndices[0] = i;
canBePutInOriginalInventory = true; canBePutInOriginalInventory = true;
@@ -4000,7 +3993,7 @@ namespace Barotrauma
} }
else else
{ {
canBePutInOriginalInventory = inventory.CanBePut(newItem, slotIndices[0], ignoreCondition: true); canBePutInOriginalInventory = inventory.CanBePutInSlot(newItem, slotIndices[0], ignoreCondition: true);
} }
if (canBePutInOriginalInventory) if (canBePutInOriginalInventory)
@@ -47,7 +47,7 @@ namespace Barotrauma
requiredDeliveryAmount = Math.Min(prefab.ConfigElement.GetAttributeFloat("requireddeliveryamount", 0.98f), 1.0f); requiredDeliveryAmount = Math.Min(prefab.ConfigElement.GetAttributeFloat("requireddeliveryamount", 0.98f), 1.0f);
//this can get called between rounds when the client receives a campaign save //this can get called between rounds when the client receives a campaign save
//don't attempt to determine cargo if the sub hasn't been fully loaded //don't attempt to determine cargo if the sub hasn't been fully loaded
if (sub == null || sub.Loading || sub.Removed || Submarine.Unloading) if (sub == null || sub.Loading || sub.Removed || Submarine.Unloading || !Submarine.Loaded.Contains(sub))
{ {
return; return;
} }
@@ -18,7 +18,7 @@ namespace Barotrauma
//string = filename, point = min,max //string = filename, point = min,max
private readonly HashSet<Tuple<CharacterPrefab, Point>> monsterPrefabs = new HashSet<Tuple<CharacterPrefab, Point>>(); private readonly HashSet<Tuple<CharacterPrefab, Point>> monsterPrefabs = new HashSet<Tuple<CharacterPrefab, Point>>();
private readonly float itemSpawnRadius = 800.0f; private float itemSpawnRadius = 800.0f;
private readonly float approachItemsRadius = 1000.0f; private readonly float approachItemsRadius = 1000.0f;
private readonly float nestObjectRadius = 1000.0f; private readonly float nestObjectRadius = 1000.0f;
private readonly float monsterSpawnRadius = 3000.0f; private readonly float monsterSpawnRadius = 3000.0f;
@@ -107,7 +107,8 @@ namespace Barotrauma
//ruin/cave/wreck items are allowed to spawn close to the sub //ruin/cave/wreck items are allowed to spawn close to the sub
float minDistance = spawnPositionType == Level.PositionType.Ruin || spawnPositionType == Level.PositionType.Cave || spawnPositionType == Level.PositionType.Wreck ? float minDistance = spawnPositionType == Level.PositionType.Ruin || spawnPositionType == Level.PositionType.Cave || spawnPositionType == Level.PositionType.Wreck ?
0.0f : Level.Loaded.Size.X * 0.3f; 0.0f : Level.Loaded.Size.X * 0.3f;
Level.Loaded.TryGetInterestingPosition(true, spawnPositionType, 0.0f, out Vector2 nestPosition);
nestPosition = Level.Loaded.GetRandomItemPos(spawnPositionType, 100.0f, minDistance, 30.0f);
List<GraphEdge> spawnEdges = new List<GraphEdge>(); List<GraphEdge> spawnEdges = new List<GraphEdge>();
if (spawnPositionType == Level.PositionType.Cave) if (spawnPositionType == Level.PositionType.Cave)
{ {
@@ -149,20 +150,21 @@ namespace Barotrauma
if (!spawnEdges.Any()) if (!spawnEdges.Any())
{ {
GraphEdge closestEdge = null; GraphEdge closestEdge = null;
float closestDist = float.PositiveInfinity; float closestDistSqr = float.PositiveInfinity;
foreach (var edge in nearbyCells.SelectMany(c => c.Edges)) foreach (var edge in nearbyCells.SelectMany(c => c.Edges))
{ {
if (!edge.NextToCave || !edge.IsSolid) { continue; } if (!edge.NextToCave || !edge.IsSolid) { continue; }
float dist = Vector2.DistanceSquared(edge.Center, nestPosition); float dist = Vector2.DistanceSquared(edge.Center, nestPosition);
if (dist < closestDist) if (dist < closestDistSqr)
{ {
closestEdge = edge; closestEdge = edge;
closestDist = dist; closestDistSqr = dist;
} }
} }
if (closestEdge != null) if (closestEdge != null)
{ {
spawnEdges.Add(closestEdge); spawnEdges.Add(closestEdge);
itemSpawnRadius = Math.Max(itemSpawnRadius, (float)Math.Sqrt(closestDistSqr) * 1.5f);
} }
} }
} }
@@ -427,7 +427,7 @@ namespace Barotrauma
{ {
if (!(secondLinkedEntity is Item linkedItem) || linkedItem == item) { continue; } if (!(secondLinkedEntity is Item linkedItem) || linkedItem == item) { continue; }
if (linkedItem.AllowSwapping && if (linkedItem.AllowSwapping &&
linkedItem.Prefab.SwappableItem != null && linkedItem.Prefab.SwappableItem.CanBeBought && linkedItem.Prefab.SwappableItem != null && (linkedItem.Prefab.SwappableItem.CanBeBought || item.Prefab.SwappableItem.ReplacementOnUninstall == linkedItem.prefab.Identifier) &&
linkedItem.Prefab.SwappableItem.SwapIdentifier.Equals(item.Prefab.SwappableItem.SwapIdentifier, StringComparison.OrdinalIgnoreCase)) linkedItem.Prefab.SwappableItem.SwapIdentifier.Equals(item.Prefab.SwappableItem.SwapIdentifier, StringComparison.OrdinalIgnoreCase))
{ {
linkedItems.Add(linkedItem); linkedItems.Add(linkedItem);
@@ -132,17 +132,17 @@ namespace Barotrauma
return false; return false;
} }
public override bool CanBePut(Item item, int i, bool ignoreCondition = false) public override bool CanBePutInSlot(Item item, int i, bool ignoreCondition = false)
{ {
return return
base.CanBePut(item, i, ignoreCondition) && item.AllowedSlots.Any(s => s.HasFlag(SlotTypes[i])) && base.CanBePutInSlot(item, i, ignoreCondition) && item.AllowedSlots.Any(s => s.HasFlag(SlotTypes[i])) &&
(SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1); (SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1);
} }
public override bool CanBePut(ItemPrefab itemPrefab, int i, float? condition) public override bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition)
{ {
return return
base.CanBePut(itemPrefab, i, condition) && base.CanBePutInSlot(itemPrefab, i, condition) &&
(SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1); (SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1);
} }
@@ -261,7 +261,7 @@ namespace Barotrauma
/// <summary> /// <summary>
/// If there is room, puts the item in the inventory and returns true, otherwise returns false /// If there is room, puts the item in the inventory and returns true, otherwise returns false
/// </summary> /// </summary>
public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true) public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
if (allowedSlots == null || !allowedSlots.Any()) { return false; } if (allowedSlots == null || !allowedSlots.Any()) { return false; }
if (item == null) if (item == null)
@@ -326,7 +326,7 @@ namespace Barotrauma
#if CLIENT #if CLIENT
if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; } if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
#endif #endif
if (!slots[i].First().AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(slots[i].FirstOrDefault(), character, new List<InvSlotType> { InvSlotType.Any }, true)) if (!slots[i].First().AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(slots[i].FirstOrDefault(), character, new List<InvSlotType> { InvSlotType.Any }, true, ignoreCondition))
{ {
free = false; free = false;
#if CLIENT #if CLIENT
@@ -371,7 +371,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (SlotTypes[i] != InvSlotType.Any) { continue; } if (SlotTypes[i] != InvSlotType.Any) { continue; }
if (!slots[i].Empty() && CanBePut(item, i)) if (!slots[i].Empty() && CanBePutInSlot(item, i))
{ {
return i; return i;
} }
@@ -387,7 +387,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (SlotTypes[i] != InvSlotType.Any) { continue; } if (SlotTypes[i] != InvSlotType.Any) { continue; }
if (CanBePut(item, i)) if (CanBePutInSlot(item, i))
{ {
return i; return i;
} }
@@ -402,14 +402,14 @@ namespace Barotrauma
} }
else else
{ {
if (!CanBePut(item, i)) { continue; } if (!CanBePutInSlot(item, i)) { continue; }
} }
return i; return i;
} }
return -1; return -1;
} }
public override bool TryPutItem(Item item, int index, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true) public override bool TryPutItem(Item item, int index, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
if (index < 0 || index >= slots.Length) if (index < 0 || index >= slots.Length)
{ {
@@ -424,7 +424,7 @@ namespace Barotrauma
if (slots[index].Any()) if (slots[index].Any())
{ {
if (slots[index].Contains(item)) { return false; } if (slots[index].Contains(item)) { return false; }
return base.TryPutItem(item, index, allowSwapping, allowCombine, user, createNetworkEvent); return base.TryPutItem(item, index, allowSwapping, allowCombine, user, createNetworkEvent, ignoreCondition);
} }
if (SlotTypes[index] == InvSlotType.Any) if (SlotTypes[index] == InvSlotType.Any)
@@ -460,7 +460,7 @@ namespace Barotrauma
if (!slotsFree) { return false; } if (!slotsFree) { return false; }
return TryPutItem(item, user, new List<InvSlotType>() { placeToSlots }, createNetworkEvent); return TryPutItem(item, user, new List<InvSlotType>() { placeToSlots }, createNetworkEvent, ignoreCondition);
} }
} }
} }
@@ -342,7 +342,7 @@ namespace Barotrauma.Items.Components
allowInsideFixture: true); allowInsideFixture: true);
hitBodies.Clear(); hitBodies.Clear();
hitBodies.AddRange(bodies); hitBodies.AddRange(bodies.Distinct());
lastPickedFraction = Submarine.LastPickedFraction; lastPickedFraction = Submarine.LastPickedFraction;
Type lastHitType = null; Type lastHitType = null;
@@ -483,7 +483,7 @@ namespace Barotrauma.Items.Components
foreach (ushort id in itemIds[i]) foreach (ushort id in itemIds[i])
{ {
if (!(Entity.FindEntityByID(id) is Item item)) { continue; } if (!(Entity.FindEntityByID(id) is Item item)) { continue; }
Inventory.TryPutItem(item, i, false, false, null, false); Inventory.TryPutItem(item, i, false, false, null, createNetworkEvent: false, ignoreCondition: true);
} }
} }
itemIds = null; itemIds = null;
@@ -211,7 +211,7 @@ namespace Barotrauma.Items.Components
{ {
for (int i = inputContainer.Inventory.Capacity - 2; i >= 0; i--) for (int i = inputContainer.Inventory.Capacity - 2; i >= 0; i--)
{ {
while (inputContainer.Inventory.GetItemAt(i) is Item item1 && inputContainer.Inventory.CanBePut(item1, i + 1)) while (inputContainer.Inventory.GetItemAt(i) is Item item1 && inputContainer.Inventory.CanBePutInSlot(item1, i + 1))
{ {
if (!inputContainer.Inventory.TryPutItem(item1, i + 1, allowSwapping: false, allowCombine: false, user: null, createNetworkEvent: true)) if (!inputContainer.Inventory.TryPutItem(item1, i + 1, allowSwapping: false, allowCombine: false, user: null, createNetworkEvent: true))
{ {
@@ -170,7 +170,7 @@ namespace Barotrauma.Items.Components
private void StartFabricating(FabricationRecipe selectedItem, Character user, bool addToServerLog = true) private void StartFabricating(FabricationRecipe selectedItem, Character user, bool addToServerLog = true)
{ {
if (selectedItem == null) { return; } if (selectedItem == null) { return; }
if (!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition)) { return; } if (!outputContainer.Inventory.CanBePut(selectedItem.TargetItem, selectedItem.OutCondition * selectedItem.TargetItem.Health)) { return; }
#if CLIENT #if CLIENT
itemList.Enabled = false; itemList.Enabled = false;
@@ -308,7 +308,7 @@ namespace Barotrauma.Items.Components
} }
Character tempUser = user; Character tempUser = user;
int amountFittingContainer = outputContainer.Inventory.HowManyCanBePut(fabricatedItem.TargetItem, fabricatedItem.OutCondition); int amountFittingContainer = outputContainer.Inventory.HowManyCanBePut(fabricatedItem.TargetItem, fabricatedItem.OutCondition * fabricatedItem.TargetItem.Health);
for (int i = 0; i < fabricatedItem.Amount; i++) for (int i = 0; i < fabricatedItem.Amount; i++)
{ {
if (i < amountFittingContainer) if (i < amountFittingContainer)
@@ -380,7 +380,7 @@ namespace Barotrauma
return ownerItem.ParentInventory.ItemOwnsSelf(item); return ownerItem.ParentInventory.ItemOwnsSelf(item);
} }
public virtual int FindAllowedSlot(Item item) public virtual int FindAllowedSlot(Item item, bool ignoreCondition = false)
{ {
if (ItemOwnsSelf(item)) { return -1; } if (ItemOwnsSelf(item)) { return -1; }
@@ -392,7 +392,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (slots[i].CanBePut(item)) { return i; } if (slots[i].CanBePut(item, ignoreCondition)) { return i; }
} }
return -1; return -1;
@@ -405,7 +405,7 @@ namespace Barotrauma
{ {
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (CanBePut(item, i)) { return true; } if (CanBePutInSlot(item, i)) { return true; }
} }
return false; return false;
} }
@@ -413,7 +413,7 @@ namespace Barotrauma
/// <summary> /// <summary>
/// Can the item be put in the specified slot. /// Can the item be put in the specified slot.
/// </summary> /// </summary>
public virtual bool CanBePut(Item item, int i, bool ignoreCondition = false) public virtual bool CanBePutInSlot(Item item, int i, bool ignoreCondition = false)
{ {
if (ItemOwnsSelf(item)) { return false; } if (ItemOwnsSelf(item)) { return false; }
if (i < 0 || i >= slots.Length) { return false; } if (i < 0 || i >= slots.Length) { return false; }
@@ -424,12 +424,12 @@ namespace Barotrauma
{ {
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (CanBePut(itemPrefab, i, condition)) { return true; } if (CanBePutInSlot(itemPrefab, i, condition)) { return true; }
} }
return false; return false;
} }
public virtual bool CanBePut(ItemPrefab itemPrefab, int i, float? condition = null) public virtual bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition = null)
{ {
if (i < 0 || i >= slots.Length) { return false; } if (i < 0 || i >= slots.Length) { return false; }
return slots[i].CanBePut(itemPrefab, condition); return slots[i].CanBePut(itemPrefab, condition);
@@ -454,16 +454,16 @@ namespace Barotrauma
/// <summary> /// <summary>
/// If there is room, puts the item in the inventory and returns true, otherwise returns false /// If there is room, puts the item in the inventory and returns true, otherwise returns false
/// </summary> /// </summary>
public virtual bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true) public virtual bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
int slot = FindAllowedSlot(item); int slot = FindAllowedSlot(item, ignoreCondition);
if (slot < 0) { return false; } if (slot < 0) { return false; }
PutItem(item, slot, user, true, createNetworkEvent); PutItem(item, slot, user, true, createNetworkEvent);
return true; return true;
} }
public virtual bool TryPutItem(Item item, int i, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true) public virtual bool TryPutItem(Item item, int i, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
if (i < 0 || i >= slots.Length) if (i < 0 || i >= slots.Length)
{ {
@@ -481,12 +481,12 @@ namespace Barotrauma
//item in the slot removed as a result of combining -> put this item in the now free slot //item in the slot removed as a result of combining -> put this item in the now free slot
if (!slots[i].Any()) if (!slots[i].Any())
{ {
return TryPutItem(item, i, allowSwapping, allowCombine, user, createNetworkEvent); return TryPutItem(item, i, allowSwapping, allowCombine, user, createNetworkEvent, ignoreCondition);
} }
return true; return true;
} }
} }
if (CanBePut(item, i)) if (CanBePutInSlot(item, i, ignoreCondition))
{ {
PutItem(item, i, user, true, createNetworkEvent); PutItem(item, i, user, true, createNetworkEvent);
return true; return true;
@@ -21,7 +21,7 @@ namespace Barotrauma
this.container = container; this.container = container;
} }
public override int FindAllowedSlot(Item item) public override int FindAllowedSlot(Item item, bool ignoreCondition = false)
{ {
if (ItemOwnsSelf(item)) { return -1; } if (ItemOwnsSelf(item)) { return -1; }
@@ -32,18 +32,18 @@ namespace Barotrauma
//try to stack first //try to stack first
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (slots[i].Any() && CanBePut(item, i)) { return i; } if (slots[i].Any() && CanBePutInSlot(item, i, ignoreCondition)) { return i; }
} }
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (CanBePut(item, i)) { return i; } if (CanBePutInSlot(item, i, ignoreCondition)) { return i; }
} }
return -1; return -1;
} }
public override bool CanBePut(Item item, int i, bool ignoreCondition = false) public override bool CanBePutInSlot(Item item, int i, bool ignoreCondition = false)
{ {
if (ItemOwnsSelf(item)) { return false; } if (ItemOwnsSelf(item)) { return false; }
if (i < 0 || i >= slots.Length) { return false; } if (i < 0 || i >= slots.Length) { return false; }
@@ -51,7 +51,7 @@ namespace Barotrauma
return item != null && slots[i].CanBePut(item, ignoreCondition) && slots[i].ItemCount < container.MaxStackSize; return item != null && slots[i].CanBePut(item, ignoreCondition) && slots[i].ItemCount < container.MaxStackSize;
} }
public override bool CanBePut(ItemPrefab itemPrefab, int i, float? condition) public override bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition)
{ {
if (i < 0 || i >= slots.Length) { return false; } if (i < 0 || i >= slots.Length) { return false; }
if (!container.CanBeContained(itemPrefab)) { return false; } if (!container.CanBeContained(itemPrefab)) { return false; }
@@ -88,9 +88,9 @@ namespace Barotrauma
return true; return true;
} }
public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true) public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
bool wasPut = base.TryPutItem(item, user, allowedSlots, createNetworkEvent); bool wasPut = base.TryPutItem(item, user, allowedSlots, createNetworkEvent, ignoreCondition);
if (wasPut) if (wasPut)
{ {
@@ -108,9 +108,9 @@ namespace Barotrauma
return wasPut; return wasPut;
} }
public override bool TryPutItem(Item item, int i, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true) public override bool TryPutItem(Item item, int i, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true, bool ignoreCondition = false)
{ {
bool wasPut = base.TryPutItem(item, i, allowSwapping, allowCombine, user, createNetworkEvent); bool wasPut = base.TryPutItem(item, i, allowSwapping, allowCombine, user, createNetworkEvent, ignoreCondition);
if (wasPut && item.ParentInventory == this) if (wasPut && item.ParentInventory == this)
{ {
foreach (Character c in Character.CharacterList) foreach (Character c in Character.CharacterList)
@@ -2724,7 +2724,7 @@ namespace Barotrauma
if (tries == 10) if (tries == 10)
{ {
position = EndPosition - Vector2.UnitY * 300.0f; position = startPos;
} }
} while (tries < 10); } while (tries < 10);
@@ -1266,7 +1266,7 @@ namespace Barotrauma
{ {
List<(ItemContainer container, int freeSlots)> containers = new List<(ItemContainer container, int freeSlots)>(); List<(ItemContainer container, int freeSlots)> containers = new List<(ItemContainer container, int freeSlots)>();
var connectedSubs = GetConnectedSubs(); var connectedSubs = GetConnectedSubs();
foreach (Item item in Item.ItemList) foreach (Item item in Item.ItemList.ToList())
{ {
if (!connectedSubs.Contains(item.Submarine)) { continue; } if (!connectedSubs.Contains(item.Submarine)) { continue; }
if (!item.HasTag("cargocontainer")) { continue; } if (!item.HasTag("cargocontainer")) { continue; }
Binary file not shown.
+30 -1
View File
@@ -1,5 +1,34 @@
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.14.7.0 v0.1400.8.0
---------------------------------------------------------------------------------------------------------
Changes:
- Hide the equipment slots and character portait in wiring mode.
- Added platforms behind Remora Drone's hatches.
Fixes:
- Fixed "entity not found" error when ending a pirate mission round after any of the pirates have been killed in multiplayer campaign.
- Fixed crashing when trying to spawn inventory items for a character who left before respawning during the previous round.
- Fixed bots following the player when trying to heal them even when they don't have the required items.
- Fixed bots suffocating when they run out of oxygen tanks if ordered to wait wearing a suit.
- Fixed bots not equipping a diving suit when they already have a mask when following a target that has a suit equipped.
- Fixed biome noise loops still playing after the round ends.
- Fixed detonator rapidly draining condition from flash powder and incendium instead of exploding them immediately (potentially resulting in partially used items).
- Fixed inability to drag/combine items in cabinets in the sub editor (unstable only).
- Fixed inability to place items into a stack in the sub editor when the container is full (unstable only).
- Fixed fabricators still being unable to craft some items when the output slot is not empty, even if the item is stackable (unstable only).
- Fixed stacks of half-used items dropping from cabinets between rounds.
- Another attempt to fix "collection was modifed" exception when instantiating cargo missions in multiplayer.
- Fixed submarine upgrade menu displaying the same name for different types of turrets linked to the same loader (unstable only).
- Fixed turret hardpoints linked to the same loader as some turret not getting swapped alongside the turret (unstable only).
- Fixed nest missions sometimes completing immediately, because the eggs spawn far enough from the initially chosen spawnpoint to be considered "taken away" from the cave (unstable only).
- Fixed exploit in plastiseal crafting recipe (plastiseal deconstructing to 1 bandage even though 1 bandage can be used to craft 2 plastiseal).
- Fixed RepairTools applying their effects multiple times to items whose bodies consist of multiple fixtures. Caused minerals to get deattached 3 times faster than they should.
- Fixed AFK kicks when staying in any of the campaign UIs (store, etc) or other input-blocking menus for too long.
- Fixed monsters sometimes targeting owners of targeted items although the owner is ignored.
---------------------------------------------------------------------------------------------------------
v0.1400.7.0
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
Changes: Changes: