From d9ddb0abc2891e11e8443e0790a0cf14293cf2c9 Mon Sep 17 00:00:00 2001 From: BarryNorfolk Date: Tue, 10 Feb 2026 19:37:28 +0100 Subject: [PATCH] Enable cancellation of gibbing due to parts --- .../Body/Systems/SharedBodySystem.Body.cs | 12 ++++++++++++ Content.Shared/Gibbing/GibbingSystem.cs | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Body.cs b/Content.Shared/Body/Systems/SharedBodySystem.Body.cs index e3f4c1122f..9179ebdfb7 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Body.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Body.cs @@ -59,6 +59,7 @@ public partial class SharedBodySystem SubscribeLocalEvent(OnBeingEquippedAttempt); // Shitmed Change SubscribeLocalEvent(OnBeingGibbed); + SubscribeLocalEvent(OnPartBeforeGibbed); // Shitmed Change SubscribeLocalEvent(OnPartBeingGibbed); // Shitmed Change } @@ -327,6 +328,17 @@ public partial class SharedBodySystem } // Shitmed Change Start + private void OnPartBeforeGibbed(Entity part, ref BeforeGibbedEvent args) + { + // Double check this is a root part, if it is then we can't gib it directly so cancel the whole + // gib event. + if (part.Comp.Body is { } bodyEnt) + { + if (IsPartRoot(bodyEnt, part, part: part) || !part.Comp.CanSever) + args.Cancel(); + } + } + private void OnPartBeingGibbed(Entity part, ref BeingGibbedEvent args) { if (part.Comp.Body is { } bodyEnt) diff --git a/Content.Shared/Gibbing/GibbingSystem.cs b/Content.Shared/Gibbing/GibbingSystem.cs index 08c8fc268e..77be017286 100644 --- a/Content.Shared/Gibbing/GibbingSystem.cs +++ b/Content.Shared/Gibbing/GibbingSystem.cs @@ -34,6 +34,14 @@ public sealed class GibbingSystem : EntitySystem if (!_net.IsServer) return new(); + // Shitmed Start + var beforeGibbed = new BeforeGibbedEvent(); + RaiseLocalEvent(ent, ref beforeGibbed); + + if (beforeGibbed.Cancelled) + return new(); + // Shitmed End + if (!_destructible.DestroyEntity(ent)) return new(); @@ -69,6 +77,11 @@ public sealed class GibbingSystem : EntitySystem } } +// Shitmed Start +[ByRefEvent] +public sealed class BeforeGibbedEvent() : CancellableEntityEventArgs; +// Shitmed End + /// /// Raised on an entity when it is being gibbed. ///