From 7de23c935bf0869efbc01a3b4615b283693b0f6e Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Mon, 22 Nov 2021 21:12:47 +0100 Subject: [PATCH] Expose round duration as a method on GameTicker --- .../GameTicking/GameTicker.RoundFlow.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index a358697a57..8636dd728d 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.Linq; using Content.Server.Database; using Content.Server.GameTicking.Events; @@ -20,7 +19,6 @@ using Robust.Shared.Log; using Robust.Shared.Maths; using Robust.Shared.Player; using Robust.Shared.Random; -using Robust.Shared.Timing; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -199,7 +197,7 @@ namespace Content.Server.GameTicking } Preset.OnGameStarted(); - _roundStartTimeSpan = IoCManager.Resolve().RealTime; + _roundStartTimeSpan = _gameTiming.RealTime; SendStatusToAll(); ReqWindowAttentionAll(); UpdateLateJoinStatus(); @@ -222,12 +220,12 @@ namespace Content.Server.GameTicking var roundEndText = text + $"\n{Preset?.GetRoundEndDescription() ?? string.Empty}"; //Get the timespan of the round. - var roundDuration = IoCManager.Resolve().RealTime.Subtract(_roundStartTimeSpan); + var roundDuration = RoundDuration(); //Generate a list of basic player info to display in the end round summary. var listOfPlayerInfo = new List(); // Grab the great big book of all the Minds, we'll need them for this. - var allMinds = EntitySystem.Get().AllMinds; + var allMinds = Get().AllMinds; foreach (var mind in allMinds) { if (mind != null) @@ -321,7 +319,7 @@ namespace Content.Server.GameTicking private void ResettingCleanup() { // Move everybody currently in the server to lobby. - foreach (var player in _playerManager.GetAllPlayers()) + foreach (var player in _playerManager.ServerSessions) { PlayerJoinLobby(player); } @@ -396,6 +394,11 @@ namespace Content.Server.GameTicking StartRound(); } + + public TimeSpan RoundDuration() + { + return _gameTiming.RealTime.Subtract(_roundStartTimeSpan); + } } public enum GameRunLevel