diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 499ae6c988..97d6299c07 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -54,7 +54,7 @@ namespace Content.Server.Hands.Systems SubscribeLocalEvent(OnDisarmed, before: new[] { typeof(StunSystem) }); - SubscribeLocalEvent(HandlePullAttempt); + SubscribeLocalEvent(HandlePullAttempt); SubscribeLocalEvent(HandlePullStarted); SubscribeLocalEvent(HandlePullStopped); @@ -148,7 +148,7 @@ namespace Content.Server.Hands.Systems #endregion #region pulling - private static void HandlePullAttempt(EntityUid uid, HandsComponent component, PullAttemptMessage args) + private static void HandlePullAttempt(EntityUid uid, HandsComponent component, PullAttemptEvent args) { if (args.Puller.Owner != uid) return; diff --git a/Content.Shared/Administration/AdminFrozenSystem.cs b/Content.Shared/Administration/AdminFrozenSystem.cs index 1b487c808c..cb443aabf0 100644 --- a/Content.Shared/Administration/AdminFrozenSystem.cs +++ b/Content.Shared/Administration/AdminFrozenSystem.cs @@ -2,6 +2,10 @@ using Content.Shared.ActionBlocker; using Content.Shared.Interaction.Events; using Content.Shared.Item; using Content.Shared.Movement; +using Content.Shared.Physics.Pull; +using Content.Shared.Pulling; +using Content.Shared.Pulling.Components; +using Content.Shared.Pulling.Events; using Content.Shared.Throwing; namespace Content.Shared.Administration; @@ -9,6 +13,7 @@ namespace Content.Shared.Administration; public sealed class AdminFrozenSystem : EntitySystem { [Dependency] private readonly ActionBlockerSystem _blocker = default!; + [Dependency] private readonly SharedPullingSystem _pulling = default!; public override void Initialize() { @@ -18,9 +23,25 @@ public sealed class AdminFrozenSystem : EntitySystem SubscribeLocalEvent((_, _, args) => args.Cancel()); SubscribeLocalEvent((_, _, args) => args.Cancel()); SubscribeLocalEvent((_, _, args) => args.Cancel()); - SubscribeLocalEvent(UpdateCanMove); + SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(UpdateCanMove); SubscribeLocalEvent(OnUpdateCanMove); + SubscribeLocalEvent(OnPullAttempt); + } + + private void OnPullAttempt(EntityUid uid, AdminFrozenComponent component, PullAttemptEvent args) + { + args.Cancelled = true; + } + + private void OnStartup(EntityUid uid, AdminFrozenComponent component, ComponentStartup args) + { + if (TryComp(uid, out var pullable)) + { + _pulling.TryStopPull(pullable); + } + + UpdateCanMove(uid, component, args); } private void OnUpdateCanMove(EntityUid uid, AdminFrozenComponent component, UpdateCanMoveEvent args) diff --git a/Content.Shared/Pulling/Events/PullAttemptEvent.cs b/Content.Shared/Pulling/Events/PullAttemptEvent.cs new file mode 100644 index 0000000000..3956637fca --- /dev/null +++ b/Content.Shared/Pulling/Events/PullAttemptEvent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.Physics; + +namespace Content.Shared.Physics.Pull +{ + public sealed class PullAttemptEvent : PullMessage + { + public PullAttemptEvent(IPhysBody puller, IPhysBody pulled) : base(puller, pulled) { } + + public bool Cancelled { get; set; } + } +} diff --git a/Content.Shared/Pulling/Events/PullAttemptMessage.cs b/Content.Shared/Pulling/Events/PullAttemptMessage.cs deleted file mode 100644 index f6c8b43377..0000000000 --- a/Content.Shared/Pulling/Events/PullAttemptMessage.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Robust.Shared.Physics; - -namespace Content.Shared.Physics.Pull -{ - public sealed class PullAttemptMessage : PullMessage - { - public PullAttemptMessage(IPhysBody puller, IPhysBody pulled) : base(puller, pulled) { } - - public bool Cancelled { get; set; } - } -} diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs index ded840c598..1daa0ec9cf 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs @@ -26,12 +26,12 @@ namespace Content.Shared.Pulling return false; } - if (!EntityManager.TryGetComponent(pulled, out var _physics)) + if (!EntityManager.TryGetComponent(pulled, out var physics)) { return false; } - if (_physics.BodyType == BodyType.Static) + if (physics.BodyType == BodyType.Static) { return false; } @@ -113,12 +113,12 @@ namespace Content.Shared.Pulling return false; } - if (!EntityManager.TryGetComponent(puller.Owner, out var pullerPhysics)) + if (!EntityManager.TryGetComponent(puller.Owner, out var pullerPhysics)) { return false; } - if (!EntityManager.TryGetComponent(pullable.Owner, out var pullablePhysics)) + if (!EntityManager.TryGetComponent(pullable.Owner, out var pullablePhysics)) { return false; } @@ -158,7 +158,7 @@ namespace Content.Shared.Pulling // Continue with pulling process. - var pullAttempt = new PullAttemptMessage(pullerPhysics, pullablePhysics); + var pullAttempt = new PullAttemptEvent(pullerPhysics, pullablePhysics); RaiseLocalEvent(puller.Owner, pullAttempt, broadcast: false);