From 9f0c3daa65ef8728529a3c34b9a885546614d727 Mon Sep 17 00:00:00 2001 From: moonheart08 Date: Sat, 9 Oct 2021 13:18:20 -0500 Subject: [PATCH] Restart round vote now correctly shows round end screen. (#4817) --- .../Tests/Commands/RestartRoundTest.cs | 6 ++-- .../GameTicking/Commands/NewRoundCommand.cs | 23 ------------ .../Commands/RestartRoundCommand.cs | 36 +++++++++++++++++++ Content.Server/RoundEnd/RoundEndSystem.cs | 2 +- .../Managers/VoteManager.DefaultVotes.cs | 3 +- 5 files changed, 42 insertions(+), 28 deletions(-) delete mode 100644 Content.Server/GameTicking/Commands/NewRoundCommand.cs create mode 100644 Content.Server/GameTicking/Commands/RestartRoundCommand.cs diff --git a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs index c6cf878851..b3f98ec8ad 100644 --- a/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs @@ -12,8 +12,8 @@ using Robust.Shared.Timing; namespace Content.IntegrationTests.Tests.Commands { [TestFixture] - [TestOf(typeof(NewRoundCommand))] - public class RestartRoundTest : ContentIntegrationTest + [TestOf(typeof(RestartRoundNowCommand))] + public class RestartRoundNowTest : ContentIntegrationTest { [Test] [TestCase(true)] @@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Commands tickBeforeRestart = entityManager.CurrentTick; - var command = new NewRoundCommand(); + var command = new RestartRoundNowCommand(); command.Execute(null, string.Empty, Array.Empty()); if (lobbyEnabled) diff --git a/Content.Server/GameTicking/Commands/NewRoundCommand.cs b/Content.Server/GameTicking/Commands/NewRoundCommand.cs deleted file mode 100644 index ec18326483..0000000000 --- a/Content.Server/GameTicking/Commands/NewRoundCommand.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Content.Server.Administration; -using Content.Shared.Administration; -using Robust.Shared.Console; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; - -namespace Content.Server.GameTicking.Commands -{ - [AdminCommand(AdminFlags.Server)] - public class NewRoundCommand : IConsoleCommand - { - public string Command => "restartround"; - public string Description => "Moves the server from PostRound to a new PreRoundLobby."; - public string Help => String.Empty; - - public void Execute(IConsoleShell shell, string argStr, string[] args) - { - var ticker = EntitySystem.Get(); - ticker.RestartRound(); - } - } -} diff --git a/Content.Server/GameTicking/Commands/RestartRoundCommand.cs b/Content.Server/GameTicking/Commands/RestartRoundCommand.cs new file mode 100644 index 0000000000..fb39907e08 --- /dev/null +++ b/Content.Server/GameTicking/Commands/RestartRoundCommand.cs @@ -0,0 +1,36 @@ +using System; +using Content.Server.Administration; +using Content.Server.RoundEnd; +using Content.Shared.Administration; +using Robust.Shared.Console; +using Robust.Shared.GameObjects; +using Robust.Shared.IoC; + +namespace Content.Server.GameTicking.Commands +{ + [AdminCommand(AdminFlags.Server)] + public class RestartRoundCommand : IConsoleCommand + { + public string Command => "restartround"; + public string Description => "Ends the current round and starts the countdown for the next lobby."; + public string Help => String.Empty; + + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + EntitySystem.Get().EndRound(); + } + } + + [AdminCommand(AdminFlags.Server)] + public class RestartRoundNowCommand : IConsoleCommand + { + public string Command => "restartroundnow"; + public string Description => "Moves the server from PostRound to a new PreRoundLobby."; + public string Help => String.Empty; + + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + EntitySystem.Get().EndRound(); + } + } +} diff --git a/Content.Server/RoundEnd/RoundEndSystem.cs b/Content.Server/RoundEnd/RoundEndSystem.cs index 87a6c96c9d..c1164ac85f 100644 --- a/Content.Server/RoundEnd/RoundEndSystem.cs +++ b/Content.Server/RoundEnd/RoundEndSystem.cs @@ -124,7 +124,7 @@ namespace Content.Server.RoundEnd OnRoundEndCountdownCancelled?.Invoke(); } - private void EndRound() + public void EndRound() { OnRoundEndCountdownFinished?.Invoke(); var gameTicker = Get(); diff --git a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs index 7faf616f55..950a8134af 100644 --- a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs +++ b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Content.Server.GameTicking; +using Content.Server.RoundEnd; using Content.Shared.CCVar; using Content.Shared.Voting; using Robust.Server.Player; @@ -63,7 +64,7 @@ namespace Content.Server.Voting.Managers if (votesYes / (float) total >= ratioRequired) { _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-restart-succeeded")); - EntitySystem.Get().RestartRound(); + EntitySystem.Get().EndRound(); } else {