diff --git a/Content.Server/Pulling/PullingSystem.cs b/Content.Server/Pulling/PullingSystem.cs index e616e69d9c..8e26a50060 100644 --- a/Content.Server/Pulling/PullingSystem.cs +++ b/Content.Server/Pulling/PullingSystem.cs @@ -1,6 +1,10 @@ -using Content.Shared.Pulling; +using Content.Shared.Input; +using Content.Shared.Pulling; +using Content.Shared.Pulling.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Input.Binding; +using Robust.Shared.Players; namespace Content.Server.Pulling { @@ -15,6 +19,32 @@ namespace Content.Server.Pulling SubscribeLocalEvent(OnPullableMove); SubscribeLocalEvent(OnPullableStopMove); + + CommandBinds.Builder + .Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(HandleReleasePulledObject)) + .Register(); + } + + private void HandleReleasePulledObject(ICommonSession? session) + { + var player = session?.AttachedEntity; + + if (player == null) + { + return; + } + + if (!TryGetPulled(player, out var pulled)) + { + return; + } + + if (!pulled.TryGetComponent(out SharedPullableComponent? pullable)) + { + return; + } + + pullable.TryStopPull(); } } } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index 5783ee332d..19cf1385d9 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -62,7 +62,6 @@ namespace Content.Shared.Pulling CommandBinds.Builder .Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(HandleMovePulledObject)) - .Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(HandleReleasePulledObject)) .Register(); } @@ -194,28 +193,6 @@ namespace Content.Shared.Pulling return false; } - private void HandleReleasePulledObject(ICommonSession? session) - { - var player = session?.AttachedEntity; - - if (player == null) - { - return; - } - - if (!TryGetPulled(player, out var pulled)) - { - return; - } - - if (!pulled.TryGetComponent(out SharedPullableComponent? pullable)) - { - return; - } - - pullable.TryStopPull(); - } - private void SetPuller(IEntity puller, IEntity pulled) { _pullers[puller] = pulled;