diff --git a/Content.Server/_DV/Grappling/EntitySystems/GrapplingSystem.cs b/Content.Server/_DV/Grappling/EntitySystems/GrapplingSystem.cs index 22ad27545b..187e856a0b 100644 --- a/Content.Server/_DV/Grappling/EntitySystems/GrapplingSystem.cs +++ b/Content.Server/_DV/Grappling/EntitySystems/GrapplingSystem.cs @@ -57,6 +57,7 @@ public sealed partial class GrapplingSystem : SharedGrapplingSystem SubscribeLocalEvent(OnEscapeGrapplerAlert); SubscribeLocalEvent(OnGrapplerStateChanged); + SubscribeLocalEvent(OnGrappledStateChanged); SubscribeLocalEvent(OnGrappledMove); SubscribeLocalEvent(OnEscapeDoAfter); SubscribeLocalEvent(OnEscapeGrappledAlert); @@ -429,6 +430,24 @@ public sealed partial class GrapplingSystem : SharedGrapplingSystem } } + /// + /// Handles when a grappled entity enters crit or dies while being held by a grappler, releasing the + /// grappler for them. + /// + /// Grappled entity which has entered crit or death. + /// Args for the event. + private void OnGrappledStateChanged(Entity grappled, ref MobStateChangedEvent args) + { + if (grappled.Comp.Grappler == EntityUid.Invalid) + return; + + if (args.NewMobState == MobState.Critical || + args.NewMobState == MobState.Dead) + { + ReleaseGrapple(grappled.Comp.Grappler, manualRelease: true); + } + } + /// /// Handles releasing the effects of a grapple from both entities. ///