Skip to content

Commit

Permalink
Revert "Set ticker on PostInject"
Browse files Browse the repository at this point in the history
This reverts commit 1489f9e.
  • Loading branch information
sleepyyapril committed Jan 5, 2025
1 parent 5dd6cf0 commit fe182a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Content.Server/Administration/ServerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ 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<GameTicker>();

// Get
RegisterActorHandler(HttpMethod.Get, "/admin/info", InfoHandler);
Expand Down Expand Up @@ -217,7 +215,8 @@ private async Task ActionForcePreset(IStatusHandlerContext context, Actor actor)

await RunOnMainThread(async () =>
{
if (_ticker.RunLevel != GameRunLevel.PreRoundLobby)
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{
await RespondError(
context,
Expand All @@ -227,7 +226,7 @@ await RespondError(
return;
}

var preset = _ticker.FindGamePreset(body.PresetId);
var preset = ticker.FindGamePreset(body.PresetId);
if (preset == null)
{
await RespondError(
Expand All @@ -238,7 +237,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);
Expand Down

0 comments on commit fe182a6

Please sign in to comment.