Change Thief Syndie & Chameleon kit contents, add Syndie codeword paper (#30446)

* Initial commit

* more like bYE

* Fix exception during test
This commit is contained in:
SlamBamActionman
2024-08-05 10:03:24 +02:00
committed by GitHub
parent 8197382444
commit bf06d0e869
7 changed files with 161 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
protected override void Added(EntityUid uid, TraitorRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
{
base.Added(uid, component, gameRule, args);
MakeCodewords(component);
SetCodewords(component);
}
private void AfterEntitySelected(Entity<TraitorRuleComponent> ent, ref AfterAntagEntitySelectedEvent args)
@@ -50,17 +50,23 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
MakeTraitor(args.EntityUid, ent);
}
private void MakeCodewords(TraitorRuleComponent component)
private void SetCodewords(TraitorRuleComponent component)
{
component.Codewords = GenerateTraitorCodewords(component);
}
public string[] GenerateTraitorCodewords(TraitorRuleComponent component)
{
var adjectives = _prototypeManager.Index(component.CodewordAdjectives).Values;
var verbs = _prototypeManager.Index(component.CodewordVerbs).Values;
var codewordPool = adjectives.Concat(verbs).ToList();
var finalCodewordCount = Math.Min(component.CodewordCount, codewordPool.Count);
component.Codewords = new string[finalCodewordCount];
string[] codewords = new string[finalCodewordCount];
for (var i = 0; i < finalCodewordCount; i++)
{
component.Codewords[i] = _random.PickAndTake(codewordPool);
codewords[i] = _random.PickAndTake(codewordPool);
}
return codewords;
}
public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool giveUplink = true)