diff --git a/Content.Server/GameTicking/Rules/Components/TraitorRuleComponent.cs b/Content.Server/GameTicking/Rules/Components/TraitorRuleComponent.cs index 31775d67b3f..e8630243bca 100644 --- a/Content.Server/GameTicking/Rules/Components/TraitorRuleComponent.cs +++ b/Content.Server/GameTicking/Rules/Components/TraitorRuleComponent.cs @@ -29,11 +29,11 @@ public sealed partial class TraitorRuleComponent : Component public ProtoId CodewordVerbs = "verbs"; [DataField] - public ProtoId ObjectiveIssuers = "TraitorFlavor"; + public ProtoId ObjectiveIssuers = "TraitorFlavor"; // Corvax-Next-Traitors public int TotalTraitors => TraitorMinds.Count; public string[] Codewords = new string[3]; - public string ObjectiveIssuer = string.Empty; + public string ObjectiveIssuer = string.Empty; // Corvax-Next-Traitors public enum SelectionState { diff --git a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs index d05cf53e550..ad162b49229 100644 --- a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs @@ -41,7 +41,7 @@ public override void Initialize() SubscribeLocalEvent(AfterEntitySelected); - SubscribeLocalEvent(OnObjectivesTextGetInfo, after: new[] { typeof(AntagSelectionSystem) }); + SubscribeLocalEvent(OnObjectivesTextGetInfo, after: new[] { typeof(AntagSelectionSystem) }); // Corvax-Next-Traitors SubscribeLocalEvent(OnObjectivesTextPrepend); } @@ -83,7 +83,7 @@ public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool var briefing = Loc.GetString("traitor-role-codewords-short", ("codewords", string.Join(", ", component.Codewords))); var issuer = _random.Pick(_prototypeManager.Index(component.ObjectiveIssuers).Values); - component.ObjectiveIssuer = issuer; + component.ObjectiveIssuer = issuer; // Corvax-Next-Traitors Note[]? code = null; if (giveUplink) @@ -103,7 +103,7 @@ public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool code = EnsureComp(pda.Value).Code; } - _antag.SendBriefing(traitor, GenerateBriefing(component.Codewords, code, issuer), Color.Crimson, component.GreetSoundNotification); + _antag.SendBriefing(traitor, GenerateBriefing(component.Codewords, code, issuer), Color.Crimson, component.GreetSoundNotification); // Corvax-Next-Traitors component.TraitorMinds.Add(mindId); @@ -111,7 +111,7 @@ public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool // Assign briefing _roleSystem.MindAddRole(mindId, new RoleBriefingComponent { - Briefing = GenerateBriefingCharacter(component.Codewords, code, issuer) + Briefing = GenerateBriefingCharacter(component.Codewords, code, issuer) // Corvax-Next-Traitors }, mind, true); // Send codewords to only the traitor client @@ -127,10 +127,12 @@ public bool MakeTraitor(EntityUid traitor, TraitorRuleComponent component, bool return true; } +// Corvax-Next-Traitors-Start private void OnObjectivesTextGetInfo(EntityUid uid, TraitorRuleComponent comp, ref ObjectivesTextGetInfoEvent args) { args.Faction = Loc.GetString($"traitor-round-end-agent-name"); } +// Corvax-Next-Traitors-End // TODO: AntagCodewordsComponent private void OnObjectivesTextPrepend(EntityUid uid, TraitorRuleComponent comp, ref ObjectivesTextPrependEvent args) @@ -139,6 +141,7 @@ private void OnObjectivesTextPrepend(EntityUid uid, TraitorRuleComponent comp, r } // TODO: figure out how to handle this? add priority to briefing event? +// Corvax-Next-Traitors-Start private string GenerateBriefing(string[] codewords, Note[]? uplinkCode, string objectiveIssuer) { var sb = new StringBuilder(); @@ -175,6 +178,7 @@ private string GenerateBriefingCharacter(string[] codewords, Note[]? uplinkCode, sb.AppendLine(Loc.GetString($"traitor-{objectiveIssuer}-goal")); sb.AppendLine("\n" + Loc.GetString($"traitor-role-clarity")); + // Corvax-Next-Traitors-End return sb.ToString(); } diff --git a/Content.Server/Objectives/ObjectivesSystem.cs b/Content.Server/Objectives/ObjectivesSystem.cs index 83886073e79..f8e7ae5e68f 100644 --- a/Content.Server/Objectives/ObjectivesSystem.cs +++ b/Content.Server/Objectives/ObjectivesSystem.cs @@ -52,7 +52,8 @@ public override void Shutdown() private void OnRoundEndText(RoundEndTextAppendEvent ev) { // go through each gamerule getting data for the roundend summary. - var summaries = new Dictionary>>>(); + var summaries = new Dictionary>>>(); // Corvax-Next-Traitors + var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var gameRule)) { @@ -65,6 +66,7 @@ private void OnRoundEndText(RoundEndTextAppendEvent ev) continue; // first group the gamerules by their factions, for example 2 different dragons + // Corvax-Next-Traitors-Start var agent = info.Faction ?? info.AgentName; if (!summaries.ContainsKey(agent)) summaries[agent] = new Dictionary>>(); @@ -124,6 +126,8 @@ private void OnRoundEndText(RoundEndTextAppendEvent ev) ev.AddLine(result.AppendLine().ToString()); } + // Corvax-Next-Traitors-End + } } @@ -259,7 +263,8 @@ private bool IsInCustody(EntityUid mindId, MindComponent? mind = null) /// Get the title for a player's mind used in round end. /// Pass in the original entity name which is shown alongside username. /// - public string GetTitle(Entity mind, string name = "") + public string GetTitle(Entity mind, string name = "") // Corvax-Next-Traitors + { if (Resolve(mind, ref mind.Comp) && mind.Comp.OriginalOwnerUserId != null && @@ -313,7 +318,7 @@ private void CreateCompletions() /// The objectives system already checks if the game rule is added so you don't need to check that in this event's handler. /// [ByRefEvent] -public record struct ObjectivesTextGetInfoEvent(List<(EntityUid, string)> Minds, string AgentName, string? Faction = null); +public record struct ObjectivesTextGetInfoEvent(List<(EntityUid, string)> Minds, string AgentName, string? Faction = null); // Corvax-Next-Traitors /// /// Raised on the game rule before text for each agent's objectives is added, letting you prepend something.