alarmables should now attempt to update appearance on init

This commit is contained in:
vulppine
2022-08-30 21:41:29 -07:00
parent e0bf77490d
commit fa8c16358f

View File

@@ -41,10 +41,20 @@ public sealed class AtmosAlarmableSystem : EntitySystem
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<AtmosAlarmableComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv); SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
SubscribeLocalEvent<AtmosAlarmableComponent, PowerChangedEvent>(OnPowerChange); SubscribeLocalEvent<AtmosAlarmableComponent, PowerChangedEvent>(OnPowerChange);
} }
private void OnInit(EntityUid uid, AtmosAlarmableComponent component, ComponentInit args)
{
TryUpdateAlert(
uid,
TryGetHighestAlert(uid, out var alarm) ? alarm.Value : AtmosAlarmType.Normal,
component,
false);
}
private void OnPowerChange(EntityUid uid, AtmosAlarmableComponent component, PowerChangedEvent args) private void OnPowerChange(EntityUid uid, AtmosAlarmableComponent component, PowerChangedEvent args)
{ {
if (!args.Powered) if (!args.Powered)