Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief * Zombie initial pass * Rebase, Traitor * Nukeops, More overloads * Revert RevolutionaryRuleComponent * Use TryRoundStartAttempt, Rewrite nukie spawning * Comments, Add task scheduler to GameRuleSystem * Zombie initial testing done * Sort methods, rework GameRuleTask * Add CCVar, Initial testing continues * Might as well get rid of the obsolete logging * Oops, i dont know how to log apparently * Suggested formatting fixes * Suggested changes * Fix merge issues * Minor optimisation * Allowed thief to choose other antags * Review changes * Spawn items on floor first, then inserting * minor tweaks * Shift as much as possible to ProtoId<> * Remove unneeded * Add exclusive antag attribute * Fix merge issues * Minor formatting fix * Convert to struct * Cleanup * Review cleanup (need to test a lot) * Some fixes, (mostly) tested * oop * Pass tests (for real) --------- Co-authored-by: Rainfall <rainfey0+git@gmail.com> Co-authored-by: AJCM <AJCM@tutanota.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Traitor.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
|
||||
namespace Content.Server.Traitor.Systems;
|
||||
@@ -16,15 +15,9 @@ public sealed class AutoTraitorSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AutoTraitorComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<AutoTraitorComponent, MindAddedMessage>(OnMindAdded);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, AutoTraitorComponent comp, MapInitEvent args)
|
||||
{
|
||||
TryMakeTraitor(uid, comp);
|
||||
}
|
||||
|
||||
private void OnMindAdded(EntityUid uid, AutoTraitorComponent comp, MindAddedMessage args)
|
||||
{
|
||||
TryMakeTraitor(uid, comp);
|
||||
@@ -60,15 +53,9 @@ public sealed class AutoTraitorSystem : EntitySystem
|
||||
if (!Resolve(uid, ref comp))
|
||||
return false;
|
||||
|
||||
if (!TryComp<MindContainerComponent>(uid, out var mindContainer) || mindContainer.Mind == null)
|
||||
return false;
|
||||
|
||||
var mindId = mindContainer.Mind.Value;
|
||||
if (!TryComp<MindComponent>(mindId, out var mind) || mind.Session == null)
|
||||
return false;
|
||||
|
||||
var session = mind.Session;
|
||||
_traitorRule.MakeTraitor(session, giveUplink: comp.GiveUplink, giveObjectives: comp.GiveObjectives);
|
||||
//Start the rule if it has not already been started
|
||||
var traitorRuleComponent = _traitorRule.StartGameRule();
|
||||
_traitorRule.MakeTraitor(uid, traitorRuleComponent, giveUplink: comp.GiveUplink, giveObjectives: comp.GiveObjectives);
|
||||
// prevent spamming anything if it fails
|
||||
RemComp<AutoTraitorComponent>(uid);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user