Files
tbd-station-14/Content.Server/StationEvents/Events/AlertLevelInterceptionRule.cs
Mr. 27 c69bf2f2aa Add syndicate sleeper agents random event (#27501)
* Intercept rule (#10)

* add

* b

* add this back lol

* fix test fails (alert levels dont have prototypes)

* tweaks
2024-05-03 10:13:35 +10:00

23 lines
862 B
C#

using Content.Server.GameTicking.Components;
using Content.Server.StationEvents.Components;
using Content.Server.AlertLevel;
namespace Content.Server.StationEvents.Events;
public sealed class AlertLevelInterceptionRule : StationEventSystem<AlertLevelInterceptionRuleComponent>
{
[Dependency] private readonly AlertLevelSystem _alertLevelSystem = default!;
protected override void Started(EntityUid uid, AlertLevelInterceptionRuleComponent component, GameRuleComponent gameRule,
GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
if (!TryGetRandomStation(out var chosenStation))
return;
if (_alertLevelSystem.GetLevel(chosenStation.Value) != "green")
return;
_alertLevelSystem.SetLevel(chosenStation.Value, component.AlertLevel, true, true, true);
}
}