Alert display lights now properly react to power changes. (#14839)

This commit is contained in:
Menshin
2023-03-25 04:10:48 +01:00
committed by GitHub
parent 76b5439dc3
commit 735701d915
3 changed files with 20 additions and 10 deletions

View File

@@ -1,3 +1,4 @@
using Content.Server.Power.Components;
using Content.Server.Station.Systems;
using Content.Shared.AlertLevel;
using Robust.Server.GameObjects;
@@ -13,6 +14,7 @@ public sealed class AlertLevelDisplaySystem : EntitySystem
{
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertChanged);
SubscribeLocalEvent<AlertLevelDisplayComponent, ComponentInit>(OnDisplayInit);
SubscribeLocalEvent<AlertLevelDisplayComponent, PowerChangedEvent>(OnPowerChanged);
}
private void OnAlertChanged(AlertLevelChangedEvent args)
@@ -23,7 +25,7 @@ public sealed class AlertLevelDisplaySystem : EntitySystem
}
}
private void OnDisplayInit(EntityUid uid, AlertLevelDisplayComponent component, ComponentInit args)
private void OnDisplayInit(EntityUid uid, AlertLevelDisplayComponent alertLevelDisplay, ComponentInit args)
{
if (TryComp(uid, out AppearanceComponent? appearance))
{
@@ -34,4 +36,11 @@ public sealed class AlertLevelDisplaySystem : EntitySystem
}
}
}
private void OnPowerChanged(EntityUid uid, AlertLevelDisplayComponent alertLevelDisplay, ref PowerChangedEvent args)
{
if (!TryComp(uid, out AppearanceComponent? appearance))
return;
_appearance.SetData(uid, AlertLevelDisplay.Powered, args.Powered, appearance);
}
}