Inventory.TryPutItem doesn't put an item in the inventory (or create a NetEntityEvent) if the item is already in it

This commit is contained in:
Regalis
2017-01-10 20:50:31 +02:00
parent df59f0d089
commit 3041138f03
3 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -143,7 +143,16 @@ namespace Barotrauma
/// </summary>
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
{
if (allowedSlots == null || ! allowedSlots.Any()) return false;
if (allowedSlots == null || !allowedSlots.Any()) return false;
for (int i = 0; i < capacity; i++)
{
//already in the inventory and in a suitable slot
if (Items[i] == item && allowedSlots.Any(a => a.HasFlag(limbSlots[i])))
{
return true;
}
}
//try to place the item in LimBlot.Any slot if that's allowed
if (allowedSlots.Contains(InvSlotType.Any))