Skip to content

Commit

Permalink
Mirror: Fix rounds restarting in the next round (#164)
Browse files Browse the repository at this point in the history
## Mirror of PR #25856: [Fix rounds restarting in the next
round](space-wizards/space-station-14#25856)
from <img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `02cc9c05ddf853b613361690b88ba893ce57bab3`

PR opened by <img
src="https://avatars.githubusercontent.com/u/31366439?v=4"
width="16"/><a href="https://github.com/metalgearsloth">
metalgearsloth</a> at 2024-03-05 07:13:06 UTC
PR merged by <img
src="https://avatars.githubusercontent.com/u/19864447?v=4"
width="16"/><a href="https://github.com/web-flow"> web-flow</a> at
2024-03-12 18:54:28 UTC

---

PR changed 2 files with 10 additions and 2 deletions.

The PR had the following labels:


---

<details open="true"><summary><h1>Original Body</h1></summary>

> Doesn't fix them restarting in lobby I think but should fix most of
it.


</details>

Co-authored-by: metalgearsloth <[email protected]>
  • Loading branch information
SimpleStation14 and metalgearsloth authored May 9, 2024
1 parent 07692c4 commit cfd943c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -80,6 +81,7 @@ public override void Initialize()
Subs.CVar(_configManager, CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled);

SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundCleanup);
SubscribeLocalEvent<StationEmergencyShuttleComponent, ComponentStartup>(OnStationStartup);
SubscribeLocalEvent<StationCentcommComponent, ComponentShutdown>(OnCentcommShutdown);
SubscribeLocalEvent<StationCentcommComponent, ComponentInit>(OnCentcommInit);
Expand All @@ -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);
Expand Down

0 comments on commit cfd943c

Please sign in to comment.