Alert display lights now properly react to power changes. (#14839)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user