Add arrivals (#14755)
* Arrivals * More arrivals and shitty uhh preload * cvar * a * clockin + maps * shitter prevention * Placement * a * cvar for tests and dev * weh
This commit is contained in:
@@ -69,6 +69,16 @@ namespace Content.Server.GameTicking
|
||||
[ViewVariables]
|
||||
public int RoundId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the round's map is eligible to be updated.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CanUpdateMap()
|
||||
{
|
||||
return RunLevel == GameRunLevel.PreRoundLobby &&
|
||||
_roundStartTime - RoundPreloadTime > _gameTiming.CurTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all the maps for the given round.
|
||||
/// </summary>
|
||||
@@ -77,11 +87,13 @@ namespace Content.Server.GameTicking
|
||||
/// </remarks>
|
||||
private void LoadMaps()
|
||||
{
|
||||
if (_mapManager.MapExists(DefaultMap))
|
||||
return;
|
||||
|
||||
AddGamePresetRules();
|
||||
|
||||
DefaultMap = _mapManager.CreateMap();
|
||||
_mapManager.AddUninitializedMap(DefaultMap);
|
||||
var startTime = _gameTiming.RealTime;
|
||||
|
||||
var maps = new List<GameMapPrototype>();
|
||||
|
||||
@@ -121,9 +133,6 @@ namespace Content.Server.GameTicking
|
||||
|
||||
LoadGameMap(map, toLoad, null);
|
||||
}
|
||||
|
||||
var timeSpan = _gameTiming.RealTime - startTime;
|
||||
_sawmill.Info($"Loaded maps in {timeSpan.TotalMilliseconds:N2}ms.");
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +179,7 @@ namespace Content.Server.GameTicking
|
||||
|
||||
SendServerMessage(Loc.GetString("game-ticker-start-round"));
|
||||
|
||||
// Just in case it hasn't been loaded previously we'll try loading it.
|
||||
LoadMaps();
|
||||
|
||||
// map has been selected so update the lobby info text
|
||||
@@ -487,14 +497,23 @@ namespace Content.Server.GameTicking
|
||||
RoundLengthMetric.Inc(frameTime);
|
||||
}
|
||||
|
||||
if (RunLevel != GameRunLevel.PreRoundLobby || Paused ||
|
||||
_roundStartTime > _gameTiming.CurTime ||
|
||||
if (RunLevel != GameRunLevel.PreRoundLobby ||
|
||||
Paused ||
|
||||
_roundStartTime - RoundPreloadTime > _gameTiming.CurTime ||
|
||||
_roundStartCountdownHasNotStartedYetDueToNoPlayers)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StartRound();
|
||||
if (_roundStartTime < _gameTiming.CurTime)
|
||||
{
|
||||
StartRound();
|
||||
}
|
||||
// Preload maps so we can start faster
|
||||
else if (_roundStartTime - RoundPreloadTime < _gameTiming.CurTime)
|
||||
{
|
||||
LoadMaps();
|
||||
}
|
||||
}
|
||||
|
||||
public TimeSpan RoundDuration()
|
||||
|
||||
Reference in New Issue
Block a user