Revert "Load Maps on Round Start, not Round Restart. Shut down server if Round fails to Start 5 times. (#6977)" (#6980)

This reverts commit 4098f7fd9b.
This commit is contained in:
Moony
2022-03-03 13:34:16 -06:00
committed by GitHub
parent 4098f7fd9b
commit 255865b7b7
5 changed files with 17 additions and 51 deletions

View File

@@ -14,7 +14,6 @@ using Content.Shared.GameTicking;
using Content.Shared.Preferences;
using Content.Shared.Station;
using Prometheus;
using Robust.Server;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -40,10 +39,7 @@ namespace Content.Server.GameTicking
"ss14_round_length",
"Round length in seconds.");
#if EXCEPTION_TOLERANCE
[ViewVariables]
private int _roundStartFailCount = 0;
#endif
[Dependency] private readonly IServerDbManager _db = default!;
[ViewVariables]
private TimeSpan _roundStartTimeSpan;
@@ -194,8 +190,6 @@ namespace Content.Server.GameTicking
SendServerMessage(Loc.GetString("game-ticker-start-round"));
LoadMaps();
StartGamePresetRules();
RoundLengthMetric.Set(0);
@@ -264,24 +258,11 @@ namespace Content.Server.GameTicking
}
catch(Exception e)
{
_roundStartFailCount++;
if (RoundStartFailShutdownCount > 0 && _roundStartFailCount >= RoundStartFailShutdownCount)
{
Logger.FatalS("ticker", $"Failed to start a round {_roundStartFailCount} time(s) in a row... Shutting down!");
_runtimeLog.LogException(e, nameof(GameTicker));
_baseServer.Shutdown("Restarting server");
return;
}
Logger.WarningS("ticker", $"Exception caught while trying to start the round! Restarting round...");
Logger.WarningS("ticker", $"Exception caught while trying to start the round! Restarting...");
_runtimeLog.LogException(e, nameof(GameTicker));
RestartRound();
return;
}
// Round started successfully! Reset counter...
_roundStartFailCount = 0;
#endif
}
@@ -392,6 +373,7 @@ namespace Content.Server.GameTicking
RunLevel = GameRunLevel.PreRoundLobby;
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
ResettingCleanup();
LoadMaps();
if (!LobbyEnabled)
{
@@ -429,18 +411,18 @@ namespace Content.Server.GameTicking
unCastData.ContentData()?.WipeMind();
}
_startingRound = false;
_mapManager.Restart();
// Delete all remaining entities.
foreach (var entity in EntityManager.GetEntities().ToArray())
// Delete all entities.
foreach (var entity in EntityManager.GetEntities().ToList())
{
// TODO: Maybe something less naive here?
// FIXME: Actually, definitely.
EntityManager.DeleteEntity(entity);
}
_startingRound = false;
_mapManager.Restart();
_roleBanManager.Restart();
// Clear up any game rules.