diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 403a177110..895ba9b831 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Item; using Content.Shared.Movement; using Content.Shared.Physics.Pull; using Content.Shared.Pulling.Components; +using Content.Shared.Pulling.Events; namespace Content.Shared.Cuffs { @@ -25,10 +26,20 @@ namespace Content.Shared.Cuffs SubscribeLocalEvent(OnUnequipAttempt); SubscribeLocalEvent(OnDropAttempt); SubscribeLocalEvent(OnPickupAttempt); + SubscribeLocalEvent(OnBeingPulledAttempt); SubscribeLocalEvent(OnPull); SubscribeLocalEvent(OnPull); } + + private void OnBeingPulledAttempt(EntityUid uid, SharedCuffableComponent component, BeingPulledAttemptEvent args) + { + if (!TryComp(uid, out var pullable)) + return; + + if (pullable.Puller != null && !component.CanStillInteract) // If we are being pulled already and cuffed, we can't get pulled again. + args.Cancel(); + } private void OnPull(EntityUid uid, SharedCuffableComponent component, PullMessage args) { if (!component.CanStillInteract) diff --git a/Content.Shared/Pulling/Events/BeingPulledAttemptEvent.cs b/Content.Shared/Pulling/Events/BeingPulledAttemptEvent.cs new file mode 100644 index 0000000000..6a3089c749 --- /dev/null +++ b/Content.Shared/Pulling/Events/BeingPulledAttemptEvent.cs @@ -0,0 +1,17 @@ +namespace Content.Shared.Pulling.Events +{ + /// + /// Directed event raised on the pulled to see if it can be pulled. + /// + public sealed class BeingPulledAttemptEvent : CancellableEntityEventArgs + { + public BeingPulledAttemptEvent(EntityUid puller, EntityUid pulled) + { + Puller = puller; + Pulled = pulled; + } + + public EntityUid Puller { get; } + public EntityUid Pulled { get; } + } +} diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs index 1daa0ec9cf..c73694d7ee 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs @@ -55,9 +55,11 @@ namespace Content.Shared.Pulling } } + var getPulled = new BeingPulledAttemptEvent(puller, pulled); + RaiseLocalEvent(pulled, getPulled); var startPull = new StartPullAttemptEvent(puller, pulled); RaiseLocalEvent(puller, startPull); - return !startPull.Cancelled; + return (!startPull.Cancelled && !getPulled.Cancelled); } public bool TogglePull(EntityUid puller, SharedPullableComponent pullable)