diff --git a/Content.Client/Command/CommunicationsConsoleMenu.cs b/Content.Client/Command/CommunicationsConsoleMenu.cs index 2213c84dbb..426ae84977 100644 --- a/Content.Client/Command/CommunicationsConsoleMenu.cs +++ b/Content.Client/Command/CommunicationsConsoleMenu.cs @@ -20,7 +20,7 @@ namespace Content.Client.Command private CommunicationsConsoleBoundUserInterface Owner { get; set; } private readonly CancellationTokenSource _timerCancelTokenSource = new CancellationTokenSource(); - + private readonly Button _emergencyShuttleButton; private readonly RichTextLabel _countdownLabel; public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner) @@ -31,14 +31,13 @@ namespace Content.Client.Command Owner = owner; _countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)}; - var emergencyShuttleButton = new Button() {Text = _localizationManager.GetString("Call emergency shuttle")}; - - emergencyShuttleButton.OnPressed += (e) => Owner.CallShuttle(); + _emergencyShuttleButton = new Button(); + _emergencyShuttleButton.OnPressed += (e) => Owner.EmergencyShuttleButtonPressed(); var vbox = new VBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand}; vbox.AddChild(_countdownLabel); - vbox.AddChild(emergencyShuttleButton); + vbox.AddChild(_emergencyShuttleButton); var hbox = new HBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand}; hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand}); @@ -56,9 +55,11 @@ namespace Content.Client.Command if (!Owner.CountdownStarted) { _countdownLabel.SetMessage(""); + _emergencyShuttleButton.Text = _localizationManager.GetString("Call emergency shuttle"); return; } + _emergencyShuttleButton.Text = _localizationManager.GetString("Recall emergency shuttle"); _countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s"); } diff --git a/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs b/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs index e123e5ac4d..5401ac8537 100644 --- a/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs @@ -33,11 +33,24 @@ namespace Content.Client.GameObjects.Components.Command _menu.OpenCentered(); } + public void EmergencyShuttleButtonPressed() + { + if(CountdownStarted) + RecallShuttle(); + else + CallShuttle(); + } + public void CallShuttle() { SendMessage(new CommunicationsConsoleCallEmergencyShuttleMessage()); } + public void RecallShuttle() + { + SendMessage(new CommunicationsConsoleRecallEmergencyShuttleMessage()); + } + protected override void ReceiveMessage(BoundUserInterfaceMessage message) { switch (message) diff --git a/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs b/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs index 4ce6a83883..a3ce594242 100644 --- a/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Command/CommunicationsConsoleComponent.cs @@ -49,6 +49,10 @@ namespace Content.Server.GameObjects.Components.Command case CommunicationsConsoleCallEmergencyShuttleMessage _: RoundEndSystem.RequestRoundEnd(); break; + + case CommunicationsConsoleRecallEmergencyShuttleMessage _: + RoundEndSystem.CancelRoundEndCountdown(); + break; } } diff --git a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs index 90bb676f16..e1b75529c6 100644 --- a/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs @@ -41,6 +41,11 @@ namespace Content.Server.GameObjects.EntitySystems public void CancelRoundEndCountdown() { + if (!IsRoundEndCountdownStarted) + return; + + IsRoundEndCountdownStarted = false; + _roundEndCancellationTokenSource.Cancel(); _roundEndCancellationTokenSource = new CancellationTokenSource(); diff --git a/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs b/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs index b5ad45c115..00d73272b1 100644 --- a/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs @@ -33,6 +33,14 @@ namespace Content.Shared.GameObjects.Components.Command } } + [Serializable, NetSerializable] + public class CommunicationsConsoleRecallEmergencyShuttleMessage : BoundUserInterfaceMessage + { + public CommunicationsConsoleRecallEmergencyShuttleMessage() + { + } + } + [Serializable, NetSerializable] public enum CommunicationsConsoleUiKey {