From e0f888344e28f265325c33392739d14a1959343f Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 7 Jul 2020 01:40:08 +0200 Subject: [PATCH] Add more interaction checks --- .../EntitySystems/Click/InteractionSystem.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 355e74d16a..c5b6ff54e2 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -262,9 +262,17 @@ namespace Content.Server.GameObjects.EntitySystems.Click } } - if (!ActionBlockerSystem.CanInteract(player) || - ContainerHelpers.TryGetContainer(player, out var container) && - container.Owner != attacked) + if (!ActionBlockerSystem.CanInteract(player)) + { + return; + } + + // In a container where the attacked entity is not the container's owner and either the attacked entity is null, not contained or in a different container + if (ContainerHelpers.TryGetContainer(player, out var playerContainer) && + attacked != playerContainer.Owner && + (attacked == null || + !ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) || + attackedContainer != playerContainer)) { return; }