(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

View File

@@ -442,7 +442,8 @@ namespace Barotrauma
if (draggingItemToWorld)
{
if (item.OwnInventory == null ||
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem))
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem) ||
!CanAccessInventory(item.OwnInventory))
{
continue;
}

View File

@@ -1519,10 +1519,9 @@ namespace Barotrauma
if (inventory.Owner is Item)
{
var owner = (Item)inventory.Owner;
if (!CanInteractWith(owner))
{
return false;
}
if (!CanInteractWith(owner)) { return false; }
ItemContainer container = owner.GetComponents<ItemContainer>().FirstOrDefault(ic => ic.Inventory == inventory);
if (container != null && !container.HasRequiredItems(this, addMessage: false)) { return false; }
}
return true;
}