diff --git a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs index b5fc694833..dd8722607c 100644 --- a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs +++ b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Hands.EntitySystems; using Content.Shared.Input; using Content.Shared.Interaction; using Content.Shared.Item; +using Content.Shared.Mobs; +using Content.Shared.Mobs.Systems; using Content.Shared.Movement.Events; using Content.Shared.Movement.Pulling.Components; using Content.Shared.Movement.Pulling.Events; @@ -60,6 +62,7 @@ public sealed class PullingSystem : EntitySystem SubscribeLocalEvent(OnModifyUncuffDuration); SubscribeLocalEvent(OnStopBeingPulledAlert); + SubscribeLocalEvent(OnStateChanged); SubscribeLocalEvent(OnAfterState); SubscribeLocalEvent(OnPullerContainerInsert); SubscribeLocalEvent(OnPullerUnpaused); @@ -76,6 +79,17 @@ public sealed class PullingSystem : EntitySystem .Register(); } + private void OnStateChanged(EntityUid uid, PullerComponent component, ref UpdateMobStateEvent args) + { + if (component.Pulling == null) + return; + + if (TryComp(component.Pulling, out var comp) && (args.State == MobState.Critical || args.State == MobState.Dead)) + { + TryStopPull(component.Pulling.Value, comp); + } + } + private void OnBuckled(Entity ent, ref StrappedEvent args) { // Prevent people from pulling the entity they are buckled to