]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
give revs briefing (#20749)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Thu, 5 Oct 2023 15:05:09 +0000 (16:05 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 15:05:09 +0000 (08:05 -0700)
Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs
Content.Server/Roles/RoleBriefingSystem.cs
Content.Server/Roles/RoleSystem.cs
Resources/Locale/en-US/game-ticking/game-presets/preset-revolutionary.ftl

index 17d9912f4bda7214ae05b84db15000646c9936bd..d6195aaa5403380807ded1567848710ca8815cd9 100644 (file)
@@ -58,6 +58,7 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
         SubscribeLocalEvent<CommandStaffComponent, MobStateChangedEvent>(OnCommandMobStateChanged);
         SubscribeLocalEvent<HeadRevolutionaryComponent, MobStateChangedEvent>(OnHeadRevMobStateChanged);
         SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
+        SubscribeLocalEvent<RevolutionaryRoleComponent, GetBriefingEvent>(OnGetBriefing);
         SubscribeLocalEvent<HeadRevolutionaryComponent, AfterFlashedEvent>(OnPostFlash);
     }
 
@@ -118,6 +119,15 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
         }
     }
 
+    private void OnGetBriefing(EntityUid uid, RevolutionaryRoleComponent comp, ref GetBriefingEvent args)
+    {
+        if (!TryComp<MindComponent>(uid, out var mind) || mind.OwnedEntity == null)
+            return;
+
+        var head = HasComp<HeadRevolutionaryComponent>(mind.OwnedEntity);
+        args.Append(Loc.GetString(head ? "head-rev-briefing" : "rev-briefing"));
+    }
+
     private void OnStartAttempt(RoundStartAttemptEvent ev)
     {
         var query = AllEntityQuery<RevolutionaryRuleComponent, GameRuleComponent>();
index 27cfdc1cad1dd7fc3c2af4bb5e79a728225443d0..c05366e150ea678fcd408b51a43ff281ac10cde9 100644 (file)
@@ -11,15 +11,6 @@ public sealed class RoleBriefingSystem : EntitySystem
 
     private void OnGetBriefing(EntityUid uid, RoleBriefingComponent comp, ref GetBriefingEvent args)
     {
-        if (args.Briefing == null)
-        {
-            // no previous briefing so just set it
-            args.Briefing = comp.Briefing;
-        }
-        else
-        {
-            // there is a previous briefing so append to it
-            args.Briefing += "\n" + comp.Briefing;
-        }
+        args.Append(comp.Briefing);
     }
 }
index 8e20708069ff513bf53ba739c4bb63f20593b69c..6ac0e24540e8d396fe54b30de151f7f20a1c41ec 100644 (file)
@@ -35,4 +35,28 @@ public sealed class RoleSystem : SharedRoleSystem
 /// Handlers can either replace or append to the briefing, whichever is more appropriate.
 /// </summary>
 [ByRefEvent]
-public record struct GetBriefingEvent(string? Briefing = null);
+public sealed class GetBriefingEvent
+{
+    public string? Briefing;
+
+    public GetBriefingEvent(string? briefing = null)
+    {
+        Briefing = briefing;
+    }
+
+    /// <summary>
+    /// If there is no briefing, sets it to the string.
+    /// If there is a briefing, adds a new line to separate it from the appended string.
+    /// </summary>
+    public void Append(string text)
+    {
+        if (Briefing == null)
+        {
+            Briefing = text;
+        }
+        else
+        {
+            Briefing += "\n" + text;
+        }
+    }
+}
index 2ef3e11ee8e1ccc8c2a42055b7e669811e255791..2d9415c92a1fced27b79fd51370bcf39f994643c 100644 (file)
@@ -10,6 +10,10 @@ head-rev-role-greeting =
     Beware, this won't work on Security, Command, or those wearing sunglasses.
     Viva la revolución!
 
+head-rev-briefing =
+    Use flashes to convert people to your cause.
+    Kill all heads to take over the station.
+
 head-rev-initial-name = [color=#5e9cff]{$name}[/color] was one of the Head Revolutionaries.
 head-rev-initial-name-user = [color=#5e9cff]{$name}[/color] ([color=gray]{$username}[/color]) was one of the Head Revolutionaries.
 
@@ -33,6 +37,8 @@ rev-role-greeting =
     Eliminate all of the command staff.
     Viva la revolución!
 
+rev-briefing = Help your head revolutionaries kill every head to take over the station.
+
 ## General
 
 rev-title = Revolutionaries