From 431a897a71f11122f048f80aa2df5e9c9e798c1a Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 16 Apr 2019 17:11:08 +0300 Subject: [PATCH] (b668306bc) Force personal slots back open when putting or attempting to put something into them --- .../Source/Items/CharacterInventory.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs index 62718645a..4b8d00255 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs @@ -176,6 +176,9 @@ namespace Barotrauma { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) { +#if CLIENT + if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; } +#endif if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List { InvSlotType.Any }, true)) { free = false; @@ -195,6 +198,9 @@ namespace Barotrauma { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null) { +#if CLIENT + if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; } +#endif bool removeFromOtherSlots = item.ParentInventory != this; if (placedInSlot == -1 && inWrongSlot) { @@ -248,7 +254,9 @@ namespace Barotrauma GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return false; } - +#if CLIENT + if (PersonalSlots.HasFlag(SlotTypes[index])) { hidePersonalSlots = false; } +#endif //there's already an item in the slot if (Items[index] != null) { @@ -273,7 +281,9 @@ namespace Barotrauma foreach (InvSlotType allowedSlot in allowedSlots) { if (!allowedSlot.HasFlag(SlotTypes[index])) continue; - +#if CLIENT + if (PersonalSlots.HasFlag(allowedSlot)) { hidePersonalSlots = false; } +#endif for (int i = 0; i < capacity; i++) { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) @@ -286,6 +296,8 @@ namespace Barotrauma } } + + if (!slotsFree) return false; return TryPutItem(item, user, new List() { placeToSlots }, createNetworkEvent);