From b84fd39e95d110a9cc1b0f64311329684ebc52d9 Mon Sep 17 00:00:00 2001 From: No Elka <125199100+NoElkaTheGod@users.noreply.github.com> Date: Sat, 26 Jul 2025 01:36:29 +0300 Subject: [PATCH] Improve comic cult evac behavior (#4083) * Achoo! * Bless you * Unfuck comments * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../Systems/EmergencyShuttleSystem.cs | 3 +++ .../Components/CosmicFinaleComponent.cs | 1 + .../_DV/CosmicCult/CosmicCultSystem.Finale.cs | 9 ++++++++- .../_DV/CosmicCult/MonumentSystem.cs | 19 ++++--------------- .../Shuttles/Events/EvacShuttleDockedEvent.cs | 7 +++++++ 5 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 Content.Server/_DV/Shuttles/Events/EvacShuttleDockedEvent.cs diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index bf3ad67d26..8c1ad1a864 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -18,6 +18,7 @@ using Content.Server.Station.Components; using Content.Server.Station.Events; using Content.Server.Station.Systems; using Content.Shared._DV.CustomObjectiveSummary; // DeltaV +using Content.Server._DV.Shuttles.Events; // DeltaV using Content.Shared.Access.Systems; using Content.Shared.CCVar; using Content.Shared.Database; @@ -441,6 +442,8 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem _consoleAccumulator = _configManager.GetCVar(CCVars.EmergencyShuttleDockTime); EmergencyShuttleArrived = true; + RaiseLocalEvent(new EvacShuttleDockedEvent()); // DeltaV + var query = AllEntityQuery(); var dockResults = new List(); diff --git a/Content.Server/_DV/CosmicCult/Components/CosmicFinaleComponent.cs b/Content.Server/_DV/CosmicCult/Components/CosmicFinaleComponent.cs index 1ee514761d..354760ff18 100644 --- a/Content.Server/_DV/CosmicCult/Components/CosmicFinaleComponent.cs +++ b/Content.Server/_DV/CosmicCult/Components/CosmicFinaleComponent.cs @@ -87,4 +87,5 @@ public enum FinaleState : byte ReadyFinale, ActiveFinale, Victory, + Unreachable, } diff --git a/Content.Server/_DV/CosmicCult/CosmicCultSystem.Finale.cs b/Content.Server/_DV/CosmicCult/CosmicCultSystem.Finale.cs index 5aca8a5e93..8fb3243e15 100644 --- a/Content.Server/_DV/CosmicCult/CosmicCultSystem.Finale.cs +++ b/Content.Server/_DV/CosmicCult/CosmicCultSystem.Finale.cs @@ -1,4 +1,6 @@ using Content.Server._DV.CosmicCult.Components; +using Content.Server.RoundEnd; +using Content.Server.Shuttles.Systems; using Content.Shared._DV.CosmicCult; using Content.Shared._DV.CosmicCult.Components; using Content.Shared.Audio; @@ -12,6 +14,9 @@ namespace Content.Server._DV.CosmicCult; public sealed partial class CosmicCultSystem : SharedCosmicCultSystem { + [Dependency] private readonly RoundEndSystem _roundEnd = default!; + [Dependency] private readonly EmergencyShuttleSystem _evac = default!; + /// /// Used to calculate when the finale song should start playing /// @@ -37,7 +42,7 @@ public sealed partial class CosmicCultSystem : SharedCosmicCultSystem _doAfter.TryStartDoAfter(doargs); args.Handled = true; } - else if (EntityIsCultist(args.User) && !args.Handled && !ent.Comp.Occupied && !ent.Comp.FinaleActive && ent.Comp.CurrentState != FinaleState.Unavailable) + else if (EntityIsCultist(args.User) && !args.Handled && !ent.Comp.Occupied && !ent.Comp.FinaleActive && ent.Comp.CurrentState == FinaleState.ReadyFinale) { ent.Comp.Occupied = true; var doargs = new DoAfterArgs(EntityManager, args.User, ent.Comp.InteractionTime, new StartFinaleDoAfterEvent(), ent, ent) @@ -98,6 +103,8 @@ public sealed partial class CosmicCultSystem : SharedCosmicCultSystem Dirty(uid, monument); _ui.SetUiState(uid.Owner, MonumentKey.Key, new MonumentBuiState(monument)); + + if (!_evac.EmergencyShuttleArrived && _roundEnd.IsRoundEndRequested()) _roundEnd.CancelRoundEndCountdown(checkCooldown: false); } private void OnFinaleCancelDoAfter(Entity uid, ref CancelFinaleDoAfterEvent args) diff --git a/Content.Server/_DV/CosmicCult/MonumentSystem.cs b/Content.Server/_DV/CosmicCult/MonumentSystem.cs index 519831f27a..5703ea0f5a 100644 --- a/Content.Server/_DV/CosmicCult/MonumentSystem.cs +++ b/Content.Server/_DV/CosmicCult/MonumentSystem.cs @@ -10,7 +10,7 @@ using Content.Shared._DV.CCVars; using Content.Shared._DV.CosmicCult; using Content.Shared._DV.CosmicCult.Components; using Content.Shared._DV.CosmicCult.Prototypes; -using Content.Shared._DV.CustomObjectiveSummary; +using Content.Server._DV.Shuttles.Events; using Content.Shared.Audio; using Content.Shared.Damage; using Content.Shared.Interaction; @@ -53,7 +53,7 @@ public sealed class MonumentSystem : SharedMonumentSystem { base.Initialize(); - SubscribeLocalEvent(OnShuttleEvac); // for no more finale once the evac shuttle leaves + SubscribeLocalEvent(OnEvacDocked); // for no more finale once the evac shuttle docks SubscribeLocalEvent(OnInfuseHeldEntropy); SubscribeLocalEvent(OnInfuseEntropy); } @@ -125,23 +125,12 @@ public sealed class MonumentSystem : SharedMonumentSystem /// /// on shuttle evac, disable the monument's UI, disable it from being activated, and stop the finale music if it was playing /// - private void OnShuttleEvac(EvacShuttleLeftEvent args) + private void OnEvacDocked(EvacShuttleDockedEvent args) { var evacQuery = EntityQueryEnumerator(); while (evacQuery.MoveNext(out var ent, out var monuComp, out var finaleComp)) { - Disable((ent, monuComp)); - finaleComp.Occupied = true; - _sound.StopStationEventMusic(ent, StationEventMusicType.CosmicCult); - if (TryComp(ent, out var uiComp)) - { - if (TryComp(ent, out var uiComp2)) //close the UI for everyone who has it open - { - _ui.CloseUi((ent, uiComp2), MonumentKey.Key); - } - - uiComp.Key = null; //kazne called this the laziest way to disable a UI ever - } + finaleComp.CurrentState = FinaleState.Unreachable; } } diff --git a/Content.Server/_DV/Shuttles/Events/EvacShuttleDockedEvent.cs b/Content.Server/_DV/Shuttles/Events/EvacShuttleDockedEvent.cs new file mode 100644 index 0000000000..230ef36029 --- /dev/null +++ b/Content.Server/_DV/Shuttles/Events/EvacShuttleDockedEvent.cs @@ -0,0 +1,7 @@ +namespace Content.Server._DV.Shuttles.Events; + +/// +/// DeltaV event for when the evac shuttle docks with the station. +/// +[Serializable] +public sealed class EvacShuttleDockedEvent : EventArgs;