From 864b741942d4482b7e6cb7ec974c419eb0856ea8 Mon Sep 17 00:00:00 2001 From: themias <89101928+themias@users.noreply.github.com> Date: Wed, 20 May 2026 16:50:43 -0400 Subject: [PATCH] Cleanup - remove zombie hardcoding in RevolutionaryRuleSystem (#43986) * Cleanup - remove zombie hardcoding in RevolutionaryRuleSystem * Update Content.Shared/Revolutionary/SharedRevolutionary.cs Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> * fix * review * didnt save for some reason --------- Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> --- .../GameTicking/Rules/RevolutionaryRuleSystem.cs | 14 ++++++++------ Content.Server/Mindshield/MindShieldSystem.cs | 7 +++++++ Content.Server/Zombies/ZombieSystem.cs | 7 +++++++ .../Revolutionary/SharedRevolutionary.cs | 7 +++++++ .../Revolutionary/SharedRevolutionarySystem.cs | 6 ++++++ 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 Content.Shared/Revolutionary/SharedRevolutionary.cs diff --git a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs index 01ab21e1e4..2c8dbf0486 100644 --- a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs @@ -17,16 +17,15 @@ using Content.Shared.GameTicking.Components; using Content.Shared.Humanoid; using Content.Shared.IdentityManagement; using Content.Shared.Mind.Components; -using Content.Shared.Mindshield.Components; using Content.Shared.Mobs; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.NPC.Prototypes; using Content.Shared.NPC.Systems; +using Content.Shared.Revolutionary; using Content.Shared.Revolutionary.Components; using Content.Shared.Roles.Components; using Content.Shared.Stunnable; -using Content.Shared.Zombies; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Content.Shared.Cuffs.Components; @@ -142,17 +141,20 @@ public sealed partial class RevolutionaryRuleSystem : GameRuleSystem(ev.Target) || - HasComp(ev.Target) || - !HasComp(ev.Target) && + if (!HasComp(ev.Target) && !alwaysConvertible || !_mobState.IsAlive(ev.Target) || - HasComp(ev.Target) || !HasComp(ev.Used)) { return; } + var attemptConvertEv = new AttemptConvertRevolutionaryEvent(); + RaiseLocalEvent(ev.Target, ref attemptConvertEv); + + if (attemptConvertEv.Cancelled) + return; + _npcFaction.AddFaction(ev.Target, RevolutionaryNpcFaction); var revComp = EnsureComp(ev.Target); diff --git a/Content.Server/Mindshield/MindShieldSystem.cs b/Content.Server/Mindshield/MindShieldSystem.cs index 0dac9d64f8..6aa36269ec 100644 --- a/Content.Server/Mindshield/MindShieldSystem.cs +++ b/Content.Server/Mindshield/MindShieldSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Roles; using Content.Shared.Database; using Content.Shared.Implants; using Content.Shared.Mindshield.Components; +using Content.Shared.Revolutionary; using Content.Shared.Revolutionary.Components; using Content.Shared.Roles.Components; using Robust.Shared.Containers; @@ -28,6 +29,7 @@ public sealed partial class MindShieldSystem : EntitySystem SubscribeLocalEvent(OnImplantImplanted); SubscribeLocalEvent(OnImplantRemoved); + SubscribeLocalEvent(OnAttemptConvert); } private void OnImplantImplanted(Entity ent, ref ImplantImplantedEvent ev) @@ -59,5 +61,10 @@ public sealed partial class MindShieldSystem : EntitySystem { RemComp(args.Implanted); } + + private void OnAttemptConvert(Entity ent, ref AttemptConvertRevolutionaryEvent args) + { + args.Cancelled = true; + } } diff --git a/Content.Server/Zombies/ZombieSystem.cs b/Content.Server/Zombies/ZombieSystem.cs index dc2ebcb85e..099258f3f1 100644 --- a/Content.Server/Zombies/ZombieSystem.cs +++ b/Content.Server/Zombies/ZombieSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Mobs; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Popups; +using Content.Shared.Revolutionary; using Content.Shared.Roles; using Content.Shared.Roles.Components; using Content.Shared.Weapons.Melee.Events; @@ -71,6 +72,7 @@ namespace Content.Server.Zombies SubscribeLocalEvent(OnGetCharacterUnrevivableIC); SubscribeLocalEvent(OnMindAdded); SubscribeLocalEvent(OnMindRemoved); + SubscribeLocalEvent(OnAttemptConvert); SubscribeLocalEvent(OnPendingMapInit); SubscribeLocalEvent(OnBeforeRemoveAnomalyOnDeath); @@ -320,5 +322,10 @@ namespace Content.Server.Zombies { _role.MindRemoveRole((args.Mind.Owner, args.Mind.Comp)); } + + private void OnAttemptConvert(Entity ent, ref AttemptConvertRevolutionaryEvent args) + { + args.Cancelled = true; + } } } diff --git a/Content.Shared/Revolutionary/SharedRevolutionary.cs b/Content.Shared/Revolutionary/SharedRevolutionary.cs new file mode 100644 index 0000000000..6de1e00751 --- /dev/null +++ b/Content.Shared/Revolutionary/SharedRevolutionary.cs @@ -0,0 +1,7 @@ +namespace Content.Shared.Revolutionary; + +/// +/// Raised when a revolutionary conversion is being attempted on an entity. +/// +[ByRefEvent] +public record struct AttemptConvertRevolutionaryEvent(bool Cancelled); diff --git a/Content.Shared/Revolutionary/SharedRevolutionarySystem.cs b/Content.Shared/Revolutionary/SharedRevolutionarySystem.cs index fda8187234..8b25fdc89c 100644 --- a/Content.Shared/Revolutionary/SharedRevolutionarySystem.cs +++ b/Content.Shared/Revolutionary/SharedRevolutionarySystem.cs @@ -24,6 +24,7 @@ public abstract partial class SharedRevolutionarySystem : EntitySystem SubscribeLocalEvent(DirtyRevComps); SubscribeLocalEvent(DirtyRevComps); SubscribeLocalEvent(DirtyRevComps); + SubscribeLocalEvent(OnAttemptConvert); } /// @@ -100,4 +101,9 @@ public abstract partial class SharedRevolutionarySystem : EntitySystem Dirty(uid, comp); } } + + private void OnAttemptConvert(Entity ent, ref AttemptConvertRevolutionaryEvent args) + { + args.Cancelled = true; + } }