mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
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>
This commit is contained in:
@@ -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<Revolutiona
|
||||
if (!_mind.TryGetMind(ev.Target, out var mindId, out var mind) && !alwaysConvertible)
|
||||
return;
|
||||
|
||||
if (HasComp<RevolutionaryComponent>(ev.Target) ||
|
||||
HasComp<MindShieldComponent>(ev.Target) ||
|
||||
!HasComp<HumanoidProfileComponent>(ev.Target) &&
|
||||
if (!HasComp<HumanoidProfileComponent>(ev.Target) &&
|
||||
!alwaysConvertible ||
|
||||
!_mobState.IsAlive(ev.Target) ||
|
||||
HasComp<ZombieComponent>(ev.Target) ||
|
||||
!HasComp<RevolutionaryConverterComponent>(ev.Used))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var attemptConvertEv = new AttemptConvertRevolutionaryEvent();
|
||||
RaiseLocalEvent(ev.Target, ref attemptConvertEv);
|
||||
|
||||
if (attemptConvertEv.Cancelled)
|
||||
return;
|
||||
|
||||
_npcFaction.AddFaction(ev.Target, RevolutionaryNpcFaction);
|
||||
var revComp = EnsureComp<RevolutionaryComponent>(ev.Target);
|
||||
|
||||
|
||||
@@ -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<MindShieldImplantComponent, ImplantImplantedEvent>(OnImplantImplanted);
|
||||
SubscribeLocalEvent<MindShieldImplantComponent, ImplantRemovedEvent>(OnImplantRemoved);
|
||||
SubscribeLocalEvent<MindShieldComponent, AttemptConvertRevolutionaryEvent>(OnAttemptConvert);
|
||||
}
|
||||
|
||||
private void OnImplantImplanted(Entity<MindShieldImplantComponent> ent, ref ImplantImplantedEvent ev)
|
||||
@@ -59,5 +61,10 @@ public sealed partial class MindShieldSystem : EntitySystem
|
||||
{
|
||||
RemComp<MindShieldComponent>(args.Implanted);
|
||||
}
|
||||
|
||||
private void OnAttemptConvert(Entity<MindShieldComponent> ent, ref AttemptConvertRevolutionaryEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ZombieComponent, GetCharacterUnrevivableIcEvent>(OnGetCharacterUnrevivableIC);
|
||||
SubscribeLocalEvent<ZombieComponent, MindAddedMessage>(OnMindAdded);
|
||||
SubscribeLocalEvent<ZombieComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
SubscribeLocalEvent<ZombieComponent, AttemptConvertRevolutionaryEvent>(OnAttemptConvert);
|
||||
|
||||
SubscribeLocalEvent<PendingZombieComponent, MapInitEvent>(OnPendingMapInit);
|
||||
SubscribeLocalEvent<PendingZombieComponent, BeforeRemoveAnomalyOnDeathEvent>(OnBeforeRemoveAnomalyOnDeath);
|
||||
@@ -320,5 +322,10 @@ namespace Content.Server.Zombies
|
||||
{
|
||||
_role.MindRemoveRole<ZombieRoleComponent>((args.Mind.Owner, args.Mind.Comp));
|
||||
}
|
||||
|
||||
private void OnAttemptConvert(Entity<ZombieComponent> ent, ref AttemptConvertRevolutionaryEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Revolutionary;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a revolutionary conversion is being attempted on an entity.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct AttemptConvertRevolutionaryEvent(bool Cancelled);
|
||||
@@ -24,6 +24,7 @@ public abstract partial class SharedRevolutionarySystem : EntitySystem
|
||||
SubscribeLocalEvent<RevolutionaryComponent, ComponentStartup>(DirtyRevComps);
|
||||
SubscribeLocalEvent<HeadRevolutionaryComponent, ComponentStartup>(DirtyRevComps);
|
||||
SubscribeLocalEvent<ShowAntagIconsComponent, ComponentStartup>(DirtyRevComps);
|
||||
SubscribeLocalEvent<RevolutionaryComponent, AttemptConvertRevolutionaryEvent>(OnAttemptConvert);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,4 +101,9 @@ public abstract partial class SharedRevolutionarySystem : EntitySystem
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAttemptConvert(Entity<RevolutionaryComponent> ent, ref AttemptConvertRevolutionaryEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user