mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-12 20:01:11 +03:00
* prediction * fix * reviews * warnings * cleanup * grupdate * bruh --------- Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
28 lines
996 B
C#
28 lines
996 B
C#
using Content.Server.StationEvents.Components;
|
|
using Content.Shared.AlertLevel;
|
|
using Content.Shared.GameTicking.Components;
|
|
|
|
namespace Content.Server.StationEvents.Events;
|
|
|
|
public sealed partial class AlertLevelInterceptionRule : StationEventSystem<AlertLevelInterceptionRuleComponent>
|
|
{
|
|
[Dependency] private AlertLevelSystem _alertLevel = 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 (!_alertLevel.TryGetLevel(chosenStation.Value, out var level)
|
|
|| !_alertLevel.TryGetDefaultLevel(chosenStation.Value, out var defaultLevel)
|
|
|| level != defaultLevel)
|
|
return;
|
|
|
|
_alertLevel.SetLevel(chosenStation.Value,
|
|
component.AlertLevel,
|
|
force: true);
|
|
}
|
|
}
|