Split codewords into its own system (#37928)
* Split codewords into its own system * Fix admin log * Nuke unused code * Fix formatting errors * Fix tests * Make the codeword system add itself if called when not active * Put comment in right place. * Review: Rename prototypes * Review: Make codewords serializable * Fix build * Reviews: Change the system to not be a gamerule. * Fix YAML Linter * Fix test fail * Remove unused import
This commit is contained in:
@@ -7,6 +7,7 @@ using Content.Server.Traitor.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using Content.Server.Codewords;
|
||||
using Content.Shared.Paper;
|
||||
|
||||
namespace Content.Server.Traitor.Systems;
|
||||
@@ -17,6 +18,7 @@ public sealed class TraitorCodePaperSystem : EntitySystem
|
||||
[Dependency] private readonly TraitorRuleSystem _traitorRuleSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly PaperSystem _paper = default!;
|
||||
[Dependency] private readonly CodewordSystem _codewordSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -48,23 +50,12 @@ public sealed class TraitorCodePaperSystem : EntitySystem
|
||||
traitorCode = null;
|
||||
|
||||
var codesMessage = new FormattedMessage();
|
||||
List<string> codeList = new();
|
||||
// Find the first nuke that matches the passed location.
|
||||
if (_gameTicker.IsGameRuleAdded<TraitorRuleComponent>())
|
||||
{
|
||||
var ruleEnts = _gameTicker.GetAddedGameRules();
|
||||
foreach (var ruleEnt in ruleEnts)
|
||||
{
|
||||
if (TryComp(ruleEnt, out TraitorRuleComponent? traitorComp))
|
||||
{
|
||||
codeList.AddRange(traitorComp.Codewords.ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
var codeList = _codewordSystem.GetCodewords(component.CodewordFaction).ToList();
|
||||
|
||||
if (codeList.Count == 0)
|
||||
{
|
||||
if (component.FakeCodewords)
|
||||
codeList = _traitorRuleSystem.GenerateTraitorCodewords(new TraitorRuleComponent()).ToList();
|
||||
codeList = _codewordSystem.GenerateCodewords(component.CodewordGenerator).ToList();
|
||||
else
|
||||
codeList = [Loc.GetString("traitor-codes-none")];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user