From 35d817e25276cd17d9ba551e1e29700a944b9b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Wed, 23 Sep 2020 11:53:31 +0200 Subject: [PATCH] Comms console now restarts the round correctly. --- .../GameObjects/EntitySystems/RoundEndSystem.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs index f912a63ec5..0b77a41a13 100644 --- a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs @@ -1,9 +1,11 @@ using System; using System.Threading; +using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.GameTicking; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; +using Robust.Shared.Localization; using Timer = Robust.Shared.Timers.Timer; namespace Content.Server.GameObjects.EntitySystems @@ -12,6 +14,9 @@ namespace Content.Server.GameObjects.EntitySystems { [Dependency] private readonly IGameTicker _gameTicker = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IChatManager _chatManager = default!; + + public const float RestartRoundTime = 20f; private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource(); public bool IsRoundEndCountdownStarted { get; private set; } @@ -58,6 +63,10 @@ namespace Content.Server.GameObjects.EntitySystems { OnRoundEndCountdownFinished?.Invoke(); _gameTicker.EndRound(); + + _chatManager.DispatchServerAnnouncement(Loc.GetString("Restarting the round in {0} seconds...", RestartRoundTime)); + + Timer.Spawn(TimeSpan.FromSeconds(RestartRoundTime), () => _gameTicker.RestartRound(), CancellationToken.None); } } }