From fb51aecfbf648dcfa6a3bc19239598d8e16a9d86 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Wed, 8 Jul 2020 15:37:18 +0200 Subject: [PATCH] Clean up if check --- .../EntitySystems/Click/InteractionSystem.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index c5b6ff54e2..1e2d95ae3c 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -11,11 +11,9 @@ using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Input; using JetBrains.Annotations; using Robust.Server.GameObjects; -using Robust.Server.GameObjects.EntitySystems; using Robust.Server.Interfaces.Player; using Robust.Shared.Containers; using Robust.Shared.GameObjects; -using Robust.Shared.GameObjects.Components; using Robust.Shared.Input; using Robust.Shared.Input.Binding; using Robust.Shared.Interfaces.GameObjects; @@ -267,14 +265,17 @@ namespace Content.Server.GameObjects.EntitySystems.Click 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 + // In a container where the attacked entity is not the container's owner if (ContainerHelpers.TryGetContainer(player, out var playerContainer) && - attacked != playerContainer.Owner && - (attacked == null || - !ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) || - attackedContainer != playerContainer)) + attacked != playerContainer.Owner) { - return; + // Either the attacked entity is null, not contained or in a different container + if (attacked == null || + !ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) || + attackedContainer != playerContainer) + { + return; + } } // TODO: Check if client should be able to see that object to click on it in the first place