From 4a401c865d4454cc0ea7a37693da8773639ee40e Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 11 Jun 2019 21:43:02 +0300 Subject: [PATCH] (4d56b6900) Fixed ability to drop items into secure lockers (or other containers that require specific items) without having access to it. Closes #1559 --- Barotrauma/BarotraumaClient/Source/Characters/Character.cs | 3 ++- Barotrauma/BarotraumaShared/Source/Characters/Character.cs | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 633916804..b281ff3bb 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -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; } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 1ee54d3a3..504a9cd2e 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -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().FirstOrDefault(ic => ic.Inventory == inventory); + if (container != null && !container.HasRequiredItems(this, addMessage: false)) { return false; } } return true; }