* Mega Antag Refactor * last minute delta save * more workshopping * more shit * ok tested this for once * okkkkk sure * generic delays for starting rules * well darn * nukies partially * ouagh * ballin' faded and smonkin wed * obliterated the diff * Spread my arms and soak up congratulations * I've got plenty of love, but nothing to show for it * but there’s too much sunlight Shining on my laptop monitor, so I Can’t see anything with any amount of clarity * ok this junk * OOK! * fubar * most of sloth's review * oh boy * eek * hell yea! * ASDFJASDJFvsakcvjkzjnhhhyh
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);
|
|
}
|
|
}
|