Sleeper agents event no longer occurs when evacuation is called (#30646)

no more evac sleeper agents
This commit is contained in:
Killerqu00 2024-08-05 05:17:53 +02:00 committed by deltanedas
parent f9ebd78a78
commit 8543b2c84c
3 changed files with 17 additions and 3 deletions

View File

@ -88,4 +88,10 @@ public sealed partial class StationEventComponent : Component
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan? EndTime;
/// <summary>
/// If false, the event won't trigger during ongoing evacuation.
/// </summary>
[DataField]
public bool OccursDuringRoundEnd = true;
}

View File

@ -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;
@ -19,7 +20,8 @@ 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 GlimmerSystem _glimmerSystem = default!; //Nyano - Summary: pulls in the glimmer system.
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
[Dependency] private readonly GlimmerSystem _glimmer = default!; //Nyano - Summary: pulls in the glimmer system.
public bool EventsEnabled { get; private set; }
private void SetEnabled(bool value) => EventsEnabled = value;
@ -197,13 +199,18 @@ public sealed class EventManagerSystem : EntitySystem
// This could not be cleanly done anywhere else.
if (_configurationManager.GetCVar(CCVars.GlimmerEnabled) &&
prototype.TryGetComponent<GlimmerEventComponent>(out var glimmerEvent) &&
(_glimmerSystem.Glimmer < glimmerEvent.MinimumGlimmer ||
_glimmerSystem.Glimmer > glimmerEvent.MaximumGlimmer))
(_glimmer.Glimmer < glimmerEvent.MinimumGlimmer ||
_glimmer.Glimmer > glimmerEvent.MaximumGlimmer))
{
return false;
}
// Nyano - End modified code block.
if (_roundEnd.IsRoundEndRequested() && !stationEvent.OccursDuringRoundEnd)
{
return false;
}
return true;
}
}

View File

@ -537,6 +537,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: