diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 6294e55b3d..f4fbafcafc 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -28,7 +28,6 @@ namespace Content.Server.Interaction [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; - [Dependency] private readonly PullingSystem _pullSystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; @@ -37,17 +36,6 @@ namespace Content.Server.Interaction base.Initialize(); SubscribeNetworkEvent(HandleDragDropRequestEvent); - - CommandBinds.Builder - .Bind(ContentKeyFunctions.TryPullObject, - new PointerInputCmdHandler(HandleTryPullObject)) - .Register(); - } - - public override void Shutdown() - { - CommandBinds.Unregister(); - base.Shutdown(); } public override bool CanAccessViaStorage(EntityUid user, EntityUid target) @@ -125,28 +113,5 @@ namespace Content.Server.Interaction } } #endregion - - private bool HandleTryPullObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid) - { - if (!ValidateClientInput(session, coords, uid, out var userEntity)) - { - Logger.InfoS("system.interaction", $"TryPullObject input validation failed"); - return true; - } - - if (userEntity.Value == uid) - return false; - - if (Deleted(uid)) - return false; - - if (!InRangeUnobstructed(userEntity.Value, uid, popup: true)) - return false; - - if (!TryComp(uid, out SharedPullableComponent? pull)) - return false; - - return _pullSystem.TogglePull(userEntity.Value, pull); - } } } diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 155ccd1613..aebd930d93 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -13,6 +13,8 @@ using Content.Shared.Item; using Content.Shared.Movement.Components; using Content.Shared.Physics; using Content.Shared.Popups; +using Content.Shared.Pulling; +using Content.Shared.Pulling.Components; using Content.Shared.Throwing; using Content.Shared.Timing; using Content.Shared.Verbs; @@ -51,6 +53,7 @@ namespace Content.Shared.Interaction [Dependency] private readonly SharedVerbSystem _verbSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly UseDelaySystem _useDelay = default!; + [Dependency] private readonly SharedPullingSystem _pullSystem = default!; private const CollisionGroup InRangeUnobstructedMask = CollisionGroup.Impassable | CollisionGroup.InteractImpassable; @@ -75,6 +78,8 @@ namespace Content.Shared.Interaction new PointerInputCmdHandler(HandleUseInteraction)) .Bind(ContentKeyFunctions.ActivateItemInWorld, new PointerInputCmdHandler(HandleActivateItemInWorld)) + .Bind(ContentKeyFunctions.TryPullObject, + new PointerInputCmdHandler(HandleTryPullObject)) .Register(); } @@ -115,6 +120,30 @@ namespace Content.Shared.Interaction args.Cancel(); } + private bool HandleTryPullObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid) + { + if (!ValidateClientInput(session, coords, uid, out var userEntity)) + { + Logger.InfoS("system.interaction", $"TryPullObject input validation failed"); + return true; + } + + //is this user trying to pull themself? + if (userEntity.Value == uid) + return false; + + if (Deleted(uid)) + return false; + + if (!InRangeUnobstructed(userEntity.Value, uid, popup: true)) + return false; + + if (!TryComp(uid, out SharedPullableComponent? pull)) + return false; + + _pullSystem.TogglePull(userEntity.Value, pull); + return false; + } /// /// Handles the event were a client uses an item in their inventory or in their hands, either by