(4d56b6900) Fixed ability to drop items into secure lockers (or other containers that require specific items) without having access to it. Closes #1559

This commit is contained in:
Joonas Rikkonen
2019-06-11 21:43:02 +03:00
parent a145b04662
commit 4a401c865d
2 changed files with 5 additions and 5 deletions
@@ -442,7 +442,8 @@ namespace Barotrauma
if (draggingItemToWorld) if (draggingItemToWorld)
{ {
if (item.OwnInventory == null || if (item.OwnInventory == null ||
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem)) !item.OwnInventory.CanBePut(CharacterInventory.draggingItem) ||
!CanAccessInventory(item.OwnInventory))
{ {
continue; continue;
} }
@@ -1519,10 +1519,9 @@ namespace Barotrauma
if (inventory.Owner is Item) if (inventory.Owner is Item)
{ {
var owner = (Item)inventory.Owner; var owner = (Item)inventory.Owner;
if (!CanInteractWith(owner)) if (!CanInteractWith(owner)) { return false; }
{ ItemContainer container = owner.GetComponents<ItemContainer>().FirstOrDefault(ic => ic.Inventory == inventory);
return false; if (container != null && !container.HasRequiredItems(this, addMessage: false)) { return false; }
}
} }
return true; return true;
} }