fish-station/Content.Server/StationEvents/Events/AlertLevelInterceptionRule.cs
iertis 45ea2b6732
announce and maintance accesses (#1080)
* announce and maintance accesses

* some fixes

* Uwы

* Delay

* i think that this is final
2025-01-10 21:37:50 +03:00

24 lines
950 B
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Content.Server.StationEvents.Components;
using Content.Server.AlertLevel;
using Content.Shared.GameTicking.Components;
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);
RaiseLocalEvent(new AlertAccessesEvent(chosenStation.Value)); // Sunrise-added
}
}