1
0

AlertLevelInterceptionRule.cs 863 B

1234567891011121314151617181920212223
  1. using Content.Server.StationEvents.Components;
  2. using Content.Server.AlertLevel;
  3. using Content.Shared.GameTicking.Components;
  4. namespace Content.Server.StationEvents.Events;
  5. public sealed class AlertLevelInterceptionRule : StationEventSystem<AlertLevelInterceptionRuleComponent>
  6. {
  7. [Dependency] private readonly AlertLevelSystem _alertLevelSystem = default!;
  8. protected override void Started(EntityUid uid, AlertLevelInterceptionRuleComponent component, GameRuleComponent gameRule,
  9. GameRuleStartedEvent args)
  10. {
  11. base.Started(uid, component, gameRule, args);
  12. if (!TryGetRandomStation(out var chosenStation))
  13. return;
  14. if (_alertLevelSystem.GetLevel(chosenStation.Value) != "green")
  15. return;
  16. _alertLevelSystem.SetLevel(chosenStation.Value, component.AlertLevel, true, true, true);
  17. }
  18. }