(b668306bc) Force personal slots back open when putting or attempting to put something into them

This commit is contained in:
Joonas Rikkonen
2019-04-16 17:11:08 +03:00
parent 4c83e5a598
commit 431a897a71
@@ -176,6 +176,9 @@ namespace Barotrauma
{ {
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) 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> { InvSlotType.Any }, true)) if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List<InvSlotType> { InvSlotType.Any }, true))
{ {
free = false; free = false;
@@ -195,6 +198,9 @@ namespace Barotrauma
{ {
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null) if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null)
{ {
#if CLIENT
if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
#endif
bool removeFromOtherSlots = item.ParentInventory != this; bool removeFromOtherSlots = item.ParentInventory != this;
if (placedInSlot == -1 && inWrongSlot) if (placedInSlot == -1 && inWrongSlot)
{ {
@@ -248,7 +254,9 @@ namespace Barotrauma
GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return false; return false;
} }
#if CLIENT
if (PersonalSlots.HasFlag(SlotTypes[index])) { hidePersonalSlots = false; }
#endif
//there's already an item in the slot //there's already an item in the slot
if (Items[index] != null) if (Items[index] != null)
{ {
@@ -273,7 +281,9 @@ namespace Barotrauma
foreach (InvSlotType allowedSlot in allowedSlots) foreach (InvSlotType allowedSlot in allowedSlots)
{ {
if (!allowedSlot.HasFlag(SlotTypes[index])) continue; if (!allowedSlot.HasFlag(SlotTypes[index])) continue;
#if CLIENT
if (PersonalSlots.HasFlag(allowedSlot)) { hidePersonalSlots = false; }
#endif
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
@@ -286,6 +296,8 @@ 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);