From cfd943c04b331044aa84dba7bdfc56cd21f7f4dc Mon Sep 17 00:00:00 2001
From: SimpleStation14 <130339894+SimpleStation14@users.noreply.github.com>
Date: Wed, 8 May 2024 20:27:26 -0700
Subject: [PATCH] Mirror: Fix rounds restarting in the next round (#164)
## Mirror of PR #25856: [Fix rounds restarting in the next
round](https://github.com/space-wizards/space-station-14/pull/25856)
from
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)
###### `02cc9c05ddf853b613361690b88ba893ce57bab3`
PR opened by
metalgearsloth at 2024-03-05 07:13:06 UTC
PR merged by web-flow at
2024-03-12 18:54:28 UTC
---
PR changed 2 files with 10 additions and 2 deletions.
The PR had the following labels:
---
Original Body
> Doesn't fix them restarting in lobby I think but should fix most of
it.
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
---
.../Shuttles/Systems/EmergencyShuttleSystem.Console.cs | 3 ++-
.../Shuttles/Systems/EmergencyShuttleSystem.cs | 9 ++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
index 6d2c28edcfc..aeb2ebdbba1 100644
--- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
+++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
@@ -308,8 +308,9 @@ private void OnEmergencyAuthorize(EntityUid uid, EmergencyShuttleConsoleComponen
private void CleanupEmergencyConsole()
{
+ // Realistically most of this shit needs moving to a station component so each station has their own emergency shuttle
+ // and timer and all that jazz so I don't really care about debugging if it works on cleanup vs start.
_announced = false;
- _roundEndCancelToken = null;
ShuttlesLeft = false;
_launchedShuttles = false;
_consoleAccumulator = float.MinValue;
diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
index a7df41d8877..47aad6a6036 100644
--- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
+++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
@@ -19,6 +19,7 @@
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.DeviceNetwork;
+using Content.Shared.GameTicking;
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Events;
using Content.Shared.Tag;
@@ -80,6 +81,7 @@ public override void Initialize()
Subs.CVar(_configManager, CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled);
SubscribeLocalEvent(OnRoundStart);
+ SubscribeLocalEvent(OnRoundCleanup);
SubscribeLocalEvent(OnStationStartup);
SubscribeLocalEvent(OnCentcommShutdown);
SubscribeLocalEvent(OnCentcommInit);
@@ -93,10 +95,15 @@ public override void Initialize()
private void OnRoundStart(RoundStartingEvent ev)
{
CleanupEmergencyConsole();
- _roundEndCancelToken?.Cancel();
_roundEndCancelToken = new CancellationTokenSource();
}
+ private void OnRoundCleanup(RoundRestartCleanupEvent ev)
+ {
+ _roundEndCancelToken?.Cancel();
+ _roundEndCancelToken = null;
+ }
+
private void OnCentcommShutdown(EntityUid uid, StationCentcommComponent component, ComponentShutdown args)
{
ClearCentcomm(component);