Fix roundstart being called multiple times.
...By adding a guard against it. Look, it's not pretty but it works.
This commit is contained in:
@@ -41,6 +41,9 @@ namespace Content.Server.GameTicking
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private TimeSpan _roundStartTimeSpan;
|
private TimeSpan _roundStartTimeSpan;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private bool _startingRound;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private GameRunLevel _runLevel;
|
private GameRunLevel _runLevel;
|
||||||
|
|
||||||
@@ -66,6 +69,7 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
DefaultMap = _mapManager.CreateMap();
|
DefaultMap = _mapManager.CreateMap();
|
||||||
_pauseManager.AddUninitializedMap(DefaultMap);
|
_pauseManager.AddUninitializedMap(DefaultMap);
|
||||||
|
_startingRound = false;
|
||||||
var startTime = _gameTiming.RealTime;
|
var startTime = _gameTiming.RealTime;
|
||||||
var map = _gameMapManager.GetSelectedMapChecked(true);
|
var map = _gameMapManager.GetSelectedMapChecked(true);
|
||||||
var grid = _mapLoader.LoadBlueprint(DefaultMap, map.MapPath);
|
var grid = _mapLoader.LoadBlueprint(DefaultMap, map.MapPath);
|
||||||
@@ -105,10 +109,12 @@ namespace Content.Server.GameTicking
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
// If this game ticker is a dummy, do nothing!
|
// If this game ticker is a dummy or the round is already being started, do nothing!
|
||||||
if (DummyTicker)
|
if (DummyTicker || _startingRound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_startingRound = true;
|
||||||
|
|
||||||
DebugTools.Assert(RunLevel == GameRunLevel.PreRoundLobby);
|
DebugTools.Assert(RunLevel == GameRunLevel.PreRoundLobby);
|
||||||
Logger.InfoS("ticker", "Starting round!");
|
Logger.InfoS("ticker", "Starting round!");
|
||||||
|
|
||||||
@@ -253,6 +259,8 @@ namespace Content.Server.GameTicking
|
|||||||
_roundStartDateTime = DateTime.UtcNow;
|
_roundStartDateTime = DateTime.UtcNow;
|
||||||
RunLevel = GameRunLevel.InRound;
|
RunLevel = GameRunLevel.InRound;
|
||||||
|
|
||||||
|
_startingRound = false;
|
||||||
|
|
||||||
_roundStartTimeSpan = _gameTiming.RealTime;
|
_roundStartTimeSpan = _gameTiming.RealTime;
|
||||||
SendStatusToAll();
|
SendStatusToAll();
|
||||||
ReqWindowAttentionAll();
|
ReqWindowAttentionAll();
|
||||||
@@ -424,6 +432,8 @@ namespace Content.Server.GameTicking
|
|||||||
EntityManager.DeleteEntity(entity);
|
EntityManager.DeleteEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_startingRound = false;
|
||||||
|
|
||||||
_mapManager.Restart();
|
_mapManager.Restart();
|
||||||
|
|
||||||
// Clear up any game rules.
|
// Clear up any game rules.
|
||||||
|
|||||||
Reference in New Issue
Block a user