From d3844fdf7ae87e226b6c6745e4c2f2d1a53e3342 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 28 May 2022 13:46:17 +1200 Subject: [PATCH] Allow ghosts to ignore obstructions (#8397) --- .../Interaction/SharedInteractionSystem.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index ea8180f72d..aa2bae298b 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.ActionBlocker; using Content.Shared.Administration.Logs; using Content.Shared.CombatMode; using Content.Shared.Database; +using Content.Shared.Ghost; using Content.Shared.Hands.Components; using Content.Shared.Input; using Content.Shared.Interaction.Components; @@ -149,7 +150,7 @@ namespace Content.Shared.Interaction return true; } - UserInteraction(user.Value, coords, uid, altInteract: true); + UserInteraction(user.Value, coords, uid, altInteract: true, checkAccess: ShouldCheckAccess(user.Value)); return false; } @@ -163,11 +164,18 @@ namespace Content.Shared.Interaction return true; } - UserInteraction(userEntity.Value, coords, !Deleted(uid) ? uid : null); + UserInteraction(userEntity.Value, coords, !Deleted(uid) ? uid : null, checkAccess: ShouldCheckAccess(userEntity.Value)); return false; } + private bool ShouldCheckAccess(EntityUid user) + { + // This is for Admin/mapping convenience. If ever there are other ghosts that can still interact, this check + // might need to be more selective. + return !HasComp(user); + } + /// /// Resolves user interactions with objects. /// @@ -669,7 +677,7 @@ namespace Content.Shared.Interaction if (Deleted(uid)) return false; - InteractionActivate(user.Value, uid); + InteractionActivate(user.Value, uid, checkAccess: ShouldCheckAccess(user.Value)); return false; }