Clean up if check

This commit is contained in:
DrSmugleaf
2020-07-08 15:37:18 +02:00
parent e1f9033a69
commit fb51aecfbf

View File

@@ -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,15 +265,18 @@ 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 ||
attacked != playerContainer.Owner)
{
// Either the attacked entity is null, not contained or in a different container
if (attacked == null ||
!ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) ||
attackedContainer != playerContainer))
attackedContainer != playerContainer)
{
return;
}
}
// TODO: Check if client should be able to see that object to click on it in the first place