]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
CVar - Toggle display of round-end greentext (#35651)
authorKillerqu00 <47712032+Killerqu00@users.noreply.github.com>
Tue, 4 Mar 2025 16:59:44 +0000 (17:59 +0100)
committerGitHub <noreply@github.com>
Tue, 4 Mar 2025 16:59:44 +0000 (08:59 -0800)
* hide greentext if cvar false

* change IFs around a lil

* reviews

Content.Server/Objectives/ObjectivesSystem.cs
Content.Shared/CCVar/CCVars.Game.cs

index 73bb74d5244887f2c7b664d63ac6745af8de79db..7a995bd5cb750bf89b88d2509220cb2ecade72da 100644 (file)
@@ -12,9 +12,11 @@ using Robust.Shared.Random;
 using System.Linq;
 using System.Text;
 using Content.Server.Objectives.Commands;
+using Content.Shared.CCVar;
 using Content.Shared.Prototypes;
 using Content.Shared.Roles.Jobs;
 using Robust.Server.Player;
+using Robust.Shared.Configuration;
 using Robust.Shared.Utility;
 
 namespace Content.Server.Objectives;
@@ -27,15 +29,20 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!;
     [Dependency] private readonly SharedJobSystem _job = default!;
+    [Dependency] private readonly IConfigurationManager _cfg = default!;
 
     private IEnumerable<string>? _objectives;
 
+    private bool _showGreentext;
+
     public override void Initialize()
     {
         base.Initialize();
 
         SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
 
+        Subs.CVar(_cfg, CCVars.GameShowGreentext, value => _showGreentext = value, true);
+
         _prototypeManager.PrototypesReloaded += CreateCompletions;
     }
 
@@ -162,7 +169,11 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem
                     totalObjectives++;
 
                     agentSummary.Append("- ");
-                    if (progress > 0.99f)
+                    if (!_showGreentext)
+                    {
+                        agentSummary.AppendLine(objectiveTitle);
+                    }
+                    else if (progress > 0.99f)
                     {
                         agentSummary.AppendLine(Loc.GetString(
                             "objectives-objective-success",
index 13e72b9e3ceca768b3d66f35b66b8999436cbc9f..a316577fc1fa007efeb0c40e6dd6f07799b33f17 100644 (file)
@@ -53,6 +53,12 @@ public sealed partial class CCVars
     public static readonly CVarDef<bool>
         GameLobbyEnableWin = CVarDef.Create("game.enablewin", true, CVar.ARCHIVE);
 
+    /// <summary>
+    ///     Controls if round-end window shows whether the objective was completed or not.
+    /// </summary>
+    public static readonly CVarDef<bool>
+        GameShowGreentext = CVarDef.Create("game.showgreentext", true, CVar.ARCHIVE | CVar.SERVERONLY);
+
     /// <summary>
     ///     Controls the maximum number of character slots a player is allowed to have.
     /// </summary>