Files
tbd-station-14/Content.Server/GameTicking/Rules/Components/TraitorRuleComponent.cs
Rainfey 4e6c59cfe5 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>
2024-02-29 17:25:10 +11:00

61 lines
1.8 KiB
C#

using Content.Server.NPC.Components;
using Content.Shared.Dataset;
using Content.Shared.Random;
using Content.Shared.Roles;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.GameTicking.Rules.Components;
[RegisterComponent, Access(typeof(TraitorRuleSystem))]
public sealed partial class TraitorRuleComponent : Component
{
public readonly List<EntityUid> TraitorMinds = new();
[DataField]
public ProtoId<AntagPrototype> TraitorPrototypeId = "Traitor";
[DataField]
public ProtoId<NpcFactionPrototype> NanoTrasenFaction = "NanoTrasen";
[DataField]
public ProtoId<NpcFactionPrototype> SyndicateFaction = "Syndicate";
[DataField]
public ProtoId<WeightedRandomPrototype> ObjectiveGroup = "TraitorObjectiveGroups";
[DataField]
public ProtoId<DatasetPrototype> CodewordAdjectives = "adjectives";
[DataField]
public ProtoId<DatasetPrototype> CodewordVerbs = "verbs";
public int TotalTraitors => TraitorMinds.Count;
public string[] Codewords = new string[3];
public enum SelectionState
{
WaitingForSpawn = 0,
ReadyToStart = 1,
Started = 2,
}
/// <summary>
/// Current state of the rule
/// </summary>
public SelectionState SelectionStatus = SelectionState.WaitingForSpawn;
/// <summary>
/// When should traitors be selected and the announcement made
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan? AnnounceAt;
/// <summary>
/// Path to antagonist alert sound.
/// </summary>
[DataField]
public SoundSpecifier GreetSoundNotification = new SoundPathSpecifier("/Audio/Ambience/Antag/traitor_start.ogg");
}