From 6503cb7833738ebbb7d02e7d6a68ea60d8f8d4cb Mon Sep 17 00:00:00 2001 From: Killerqu00 <47712032+Killerqu00@users.noreply.github.com> Date: Mon, 5 Aug 2024 05:17:53 +0200 Subject: [PATCH] Sleeper agents event no longer occurs when evacuation is called (#30646) no more evac sleeper agents --- .../StationEvents/Components/StationEventComponent.cs | 6 ++++++ Content.Server/StationEvents/EventManagerSystem.cs | 7 +++++++ Resources/Prototypes/GameRules/events.yml | 1 + 3 files changed, 14 insertions(+) diff --git a/Content.Server/StationEvents/Components/StationEventComponent.cs b/Content.Server/StationEvents/Components/StationEventComponent.cs index fdd1d3962e..a188d5c052 100644 --- a/Content.Server/StationEvents/Components/StationEventComponent.cs +++ b/Content.Server/StationEvents/Components/StationEventComponent.cs @@ -81,4 +81,10 @@ public sealed partial class StationEventComponent : Component [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))] [AutoPausedField] public TimeSpan? EndTime; + + /// + /// If false, the event won't trigger during ongoing evacuation. + /// + [DataField] + public bool OccursDuringRoundEnd = true; } diff --git a/Content.Server/StationEvents/EventManagerSystem.cs b/Content.Server/StationEvents/EventManagerSystem.cs index f2fdb8ff5a..2e44040fcc 100644 --- a/Content.Server/StationEvents/EventManagerSystem.cs +++ b/Content.Server/StationEvents/EventManagerSystem.cs @@ -1,6 +1,7 @@ using System.Linq; using Content.Server.Chat.Managers; using Content.Server.GameTicking; +using Content.Server.RoundEnd; using Content.Server.StationEvents.Components; using Content.Shared.CCVar; using Robust.Server.Player; @@ -18,6 +19,7 @@ public sealed class EventManagerSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IChatManager _chat = default!; [Dependency] public readonly GameTicker GameTicker = default!; + [Dependency] private readonly RoundEndSystem _roundEnd = default!; public bool EventsEnabled { get; private set; } private void SetEnabled(bool value) => EventsEnabled = value; @@ -191,6 +193,11 @@ public sealed class EventManagerSystem : EntitySystem return false; } + if (_roundEnd.IsRoundEndRequested() && !stationEvent.OccursDuringRoundEnd) + { + return false; + } + return true; } } diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index 73b2920ca7..01a9f00257 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -496,6 +496,7 @@ startAudio: path: /Audio/Announcements/intercept.ogg duration: null # the rule has to last the whole round not 1 second + occursDuringRoundEnd: false - type: AlertLevelInterceptionRule - type: AntagSelection definitions: