Add round ID to status HTTP API (#21904)
* added round_id * Update Content.Server/GameTicking/GameTicker.StatusShell.cs Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: Moony <moony@hellomouse.net> Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json.Nodes;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Robust.Server.ServerStatus;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
@@ -22,7 +23,11 @@ namespace Content.Server.GameTicking
|
||||
/// For access to CVars in status responses.
|
||||
/// </summary>
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 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 +40,7 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
jObject["name"] = _baseServer.ServerName;
|
||||
jObject["map"] = _gameMapManager.GetSelectedMap()?.MapName;
|
||||
jObject["round_id"] = _gameTicker.RoundId;
|
||||
jObject["players"] = _playerManager.PlayerCount;
|
||||
jObject["soft_max_players"] = _cfg.GetCVar(CCVars.SoftMaxPlayers);
|
||||
jObject["run_level"] = (int) _runLevel;
|
||||
|
||||
Reference in New Issue
Block a user