Equipped items can be swapped by double-clicking, fixed inventories getting messed up when swapping multi-slot items fails (e.g. drag a jumpsuit on an equipped diving suit).
This commit is contained in:
@@ -127,7 +127,6 @@ namespace Barotrauma
|
||||
if (doubleClickedItem != null)
|
||||
{
|
||||
bool wasPut = false;
|
||||
|
||||
if (doubleClickedItem.ParentInventory != this)
|
||||
{
|
||||
wasPut = TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots, true);
|
||||
@@ -152,7 +151,12 @@ namespace Barotrauma
|
||||
//not equipped -> attempt to equip
|
||||
if (IsInLimbSlot(doubleClickedItem, InvSlotType.Any))
|
||||
{
|
||||
wasPut = TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots.FindAll(i => i != InvSlotType.Any), true);
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (limbSlots[i] == InvSlotType.Any || !doubleClickedItem.AllowedSlots.Any(a => a.HasFlag(limbSlots[i]))) continue;
|
||||
wasPut = TryPutItem(doubleClickedItem, i, true, false, Character.Controlled, true);
|
||||
if (wasPut) break;
|
||||
}
|
||||
}
|
||||
//equipped -> attempt to unequip
|
||||
else if (doubleClickedItem.AllowedSlots.Contains(InvSlotType.Any))
|
||||
@@ -162,6 +166,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (wasPut)
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (Items[i] == doubleClickedItem) slots[i].ShowBorderHighlight(Color.Green, 0.1f, 0.9f);
|
||||
}
|
||||
}
|
||||
|
||||
draggingItem = null;
|
||||
GUI.PlayUISound(wasPut ? GUISoundType.PickItem : GUISoundType.PickItemFail);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user