Expose preset in status (#23586)

This commit is contained in:
Vasilis
2024-01-06 04:14:25 +01:00
committed by GitHub
parent 86c1e36cd5
commit a2fdad31ed

View File

@@ -27,7 +27,7 @@ namespace Content.Server.GameTicking
/// For access to the round ID in status responses.
/// </summary>
[Dependency] private readonly SharedGameTicker _gameTicker = default!;
private void InitializeStatusShell()
{
IoCManager.Resolve<IStatusHost>().OnStatusRequest += GetStatusResponse;
@@ -35,6 +35,8 @@ namespace Content.Server.GameTicking
private void GetStatusResponse(JsonNode jObject)
{
var preset = CurrentPreset ?? Preset;
// This method is raised from another thread, so this better be thread safe!
lock (_statusShellLock)
{
@@ -45,6 +47,8 @@ namespace Content.Server.GameTicking
jObject["soft_max_players"] = _cfg.GetCVar(CCVars.SoftMaxPlayers);
jObject["panic_bunker"] = _cfg.GetCVar(CCVars.PanicBunkerEnabled);
jObject["run_level"] = (int) _runLevel;
if (preset != null)
jObject["preset"] = Loc.GetString(preset.ModeTitle);
if (_runLevel >= GameRunLevel.InRound)
{
jObject["round_start_time"] = _roundStartDateTime.ToString("o");