CVar - Toggle display of round-end greentext (#35651)
* hide greentext if cvar false * change IFs around a lil * reviews
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user