Fix crash when getting server status
- Adds _roundStartDateTime field to GameTicker, the UTC time when the round started.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Robust.Server.ServerStatus;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameTicking
|
||||
{
|
||||
@@ -11,6 +13,12 @@ namespace Content.Server.GameTicking
|
||||
/// </summary>
|
||||
private readonly object _statusShellLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Round start time in UTC, for status shell purposes.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private DateTime _roundStartDateTime;
|
||||
|
||||
private void InitializeStatusShell()
|
||||
{
|
||||
IoCManager.Resolve<IStatusHost>().OnStatusRequest += GetStatusResponse;
|
||||
@@ -26,7 +34,7 @@ namespace Content.Server.GameTicking
|
||||
jObject["run_level"] = (int) _runLevel;
|
||||
if (_runLevel >= GameRunLevel.InRound)
|
||||
{
|
||||
jObject["round_start_time"] = _roundStartTime.ToString("o");
|
||||
jObject["round_start_time"] = _roundStartDateTime.ToString("o");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user