From cc7905382582b52b41e49805c4a6901b0eacb719 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 23 Nov 2021 18:12:24 +0100 Subject: [PATCH] Fix round starting and db round spam Fixes https://github.com/space-wizards/space-station-14/issues/5467 RunLevel was being set after waiting for the DB, causing GameTicker.Update to fire during the wait --- Content.Server/GameTicking/GameTicker.RoundFlow.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 8636dd728d..074025c0f4 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -103,12 +103,6 @@ namespace Content.Server.GameTicking DebugTools.Assert(RunLevel == GameRunLevel.PreRoundLobby); Logger.InfoS("ticker", "Starting round!"); - var playerIds = _playersInLobby.Keys.Select(player => player.UserId.UserId).ToArray(); - RoundId = await _db.AddNewRound(playerIds); - - var startingEvent = new RoundStartingEvent(); - RaiseLocalEvent(startingEvent); - SendServerMessage(Loc.GetString("game-ticker-start-round")); List readyPlayers; @@ -126,6 +120,12 @@ namespace Content.Server.GameTicking RoundLengthMetric.Set(0); + var playerIds = _playersInLobby.Keys.Select(player => player.UserId.UserId).ToArray(); + RoundId = await _db.AddNewRound(playerIds); + + var startingEvent = new RoundStartingEvent(); + RaiseLocalEvent(startingEvent); + // Get the profiles for each player for easier lookup. var profiles = _prefsManager.GetSelectedProfilesForPlayers( readyPlayers