2024-05-02 20:13:35 -04:00
|
|
|
|
using Content.Server.StationEvents.Components;
|
|
|
|
|
|
using Content.Server.AlertLevel;
|
2024-06-04 11:53:24 +00:00
|
|
|
|
using Content.Shared.GameTicking.Components;
|
2024-05-02 20:13:35 -04:00
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
2024-06-04 11:53:24 +00:00
|
|
|
|
}
|