* move MinMax to shared * cleanup MinMax * move other ticking components to shared just because * remove unused prototype file * update everything to use shared components * test * test 2 * test 3 --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
24 lines
863 B
C#
24 lines
863 B
C#
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);
|
||
}
|
||
}
|