diff --git a/Content.Server/Administration/ServerApi.cs b/Content.Server/Administration/ServerApi.cs index c48b5b3fa5..7899d38b44 100644 --- a/Content.Server/Administration/ServerApi.cs +++ b/Content.Server/Administration/ServerApi.cs @@ -63,10 +63,12 @@ public sealed partial class ServerApi : IPostInjectInit private string _token = string.Empty; private ISawmill _sawmill = default!; + private GameTicker _ticker = default!; void IPostInjectInit.PostInject() { _sawmill = _logManager.GetSawmill("serverApi"); + _ticker = _entityManager.System(); // Get RegisterActorHandler(HttpMethod.Get, "/admin/info", InfoHandler); @@ -215,8 +217,7 @@ private async Task ActionForcePreset(IStatusHandlerContext context, Actor actor) await RunOnMainThread(async () => { - var ticker = _entitySystemManager.GetEntitySystem(); - if (ticker.RunLevel != GameRunLevel.PreRoundLobby) + if (_ticker.RunLevel != GameRunLevel.PreRoundLobby) { await RespondError( context, @@ -226,7 +227,7 @@ await RespondError( return; } - var preset = ticker.FindGamePreset(body.PresetId); + var preset = _ticker.FindGamePreset(body.PresetId); if (preset == null) { await RespondError( @@ -237,7 +238,7 @@ await RespondError( return; } - ticker.SetGamePreset(preset); + _ticker.SetGamePreset(preset); _sawmill.Info($"Forced the game to start with preset {body.PresetId} by {FormatLogActor(actor)}."); await RespondOk(context);