mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-25 17:46:41 +03:00
This cherry-pick's Wizden's Antag Refactor, which is needed for all future antag updates, as well as for me to cherry-pick over Cultists(Who are going to need some editing to fit the antag refactor), Changelings, Heretics, and Wizards. I actually selected the White-Dream-Public version of the Antag Refactor, due to it having commits made tailored to our repository, so it comes prepackaged with all the changes necessary for our repo-specific content. https://github.com/frosty-dev/ss14-wwdp/pull/10 Signed-off-by: Timemaster99 <57200767+Timemaster99@users.noreply.github.com> Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com> Co-authored-by: Jeff <velcroboy333@hotmail.com> Co-authored-by: Timemaster99 <57200767+Timemaster99@users.noreply.github.com> Co-authored-by: Timemaster99 <elijahrobot@gmail.com> Co-authored-by: luckywill339@gmail.com <luckywill339@gmail.com> Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com> Co-authored-by: Azzy <azzydev@icloud.com>
30 lines
942 B
C#
30 lines
942 B
C#
using Content.Server.Antag;
|
|
using Content.Server.Traitor.Components;
|
|
using Content.Shared.Mind.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.Traitor.Systems;
|
|
|
|
/// <summary>
|
|
/// Makes entities with <see cref="AutoTraitorComponent"/> a traitor either immediately if they have a mind or when a mind is added.
|
|
/// </summary>
|
|
public sealed class AutoTraitorSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
|
|
|
[ValidatePrototypeId<EntityPrototype>]
|
|
private const string DefaultTraitorRule = "Traitor";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AutoTraitorComponent, MindAddedMessage>(OnMindAdded);
|
|
}
|
|
|
|
private void OnMindAdded(EntityUid uid, AutoTraitorComponent comp, MindAddedMessage args)
|
|
{
|
|
_antag.ForceMakeAntag<AutoTraitorComponent>(args.Mind.Comp.Session, DefaultTraitorRule);
|
|
}
|
|
}
|