CVar - Toggle display of round-end greentext (#35651)

* hide greentext if cvar false

* change IFs around a lil

* reviews
This commit is contained in:
Killerqu00
2025-03-04 17:59:44 +01:00
committed by GitHub
parent 5774b71b9b
commit 2d32e08bee
2 changed files with 18 additions and 1 deletions

View 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",