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:
Joonas Rikkonen
2018-03-02 13:45:58 +02:00
parent f1f190a997
commit 07d3d69040
13 changed files with 65 additions and 30 deletions
@@ -50,7 +50,7 @@ namespace Barotrauma
//TODO: make sure the weapon is ready to use (projectiles/batteries loaded)
if (!character.SelectedItems.Contains(weapon))
{
if (character.Inventory.TryPutItem(weapon, 3, false, character))
if (character.Inventory.TryPutItem(weapon, 3, false, false, character))
{
weapon.Equip(character);
}
@@ -119,7 +119,7 @@ namespace Barotrauma
if (targetSlot > -1 && character.Inventory.IsInLimbSlot(targetItem, InvSlotType.Any))
{
character.Inventory.TryPutItem(targetItem, targetSlot, false, character);
character.Inventory.TryPutItem(targetItem, targetSlot, false, false, character);
}
}
else
@@ -113,7 +113,7 @@ namespace Barotrauma
character.Inventory.Items[i].Drop();
}
}
if (character.Inventory.TryPutItem(component.Item, i, true, character))
if (character.Inventory.TryPutItem(component.Item, i, true, false, character))
{
component.Item.Equip(character);
break;
@@ -657,7 +657,7 @@ namespace Barotrauma
if (item == null) continue;
item.TryInteract(this, true, true, true);
inventory.TryPutItem(item, i, false, null, false);
inventory.TryPutItem(item, i, false, false, null, false);
}
}
}
@@ -214,7 +214,7 @@ namespace Barotrauma
for (int i = 0; i < character.Inventory.Items.Length; i++)
{
if (character.Inventory.Items[i] == null) continue;
husk.Inventory.TryPutItem(character.Inventory.Items[i], i, true, null);
husk.Inventory.TryPutItem(character.Inventory.Items[i], i, true, false, null);
}
yield return CoroutineStatus.Success;