some backend stuff for air alarms

finally, some UI states!!!
This commit is contained in:
vulppine
2022-08-17 23:46:15 -07:00
parent 32e2686a4b
commit 1c651f051f
6 changed files with 188 additions and 112 deletions

View File

@@ -3,11 +3,13 @@ using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Shared.Atmos.Monitor;
using Robust.Server.GameObjects;
namespace Content.Server.Atmos.Monitor.Systems
{
public sealed class AtmosAlarmableSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
public override void Initialize()
{
SubscribeLocalEvent<AtmosAlarmableComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
@@ -34,9 +36,15 @@ namespace Content.Server.Atmos.Monitor.Systems
{
component.LastAlarmState = state;
component.HighestNetworkState = netMax;
UpdateAppearance(uid, netMax);
RaiseLocalEvent(component.Owner, new AtmosMonitorAlarmEvent(state, netMax), true);
}
}
}
private void UpdateAppearance(EntityUid uid, AtmosMonitorAlarmType alarm)
{
_appearance.SetData(uid, AtmosMonitorVisuals.AlarmType, alarm);
}
}
}