fire alarms will now attempt to register and sync against all connected devices whenever a device list is updated

This commit is contained in:
vulppine
2022-08-22 08:44:03 -07:00
parent a8bf2ccbb6
commit 2d22c37210
2 changed files with 11 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
using Content.Server.AlertLevel;
using Content.Server.Atmos.Monitor.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.AlertLevel;
@@ -12,15 +13,23 @@ namespace Content.Server.Atmos.Monitor.Systems
{
public sealed class FireAlarmSystem : EntitySystem
{
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
SubscribeLocalEvent<FireAlarmComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<FireAlarmComponent, DeviceListUpdateEvent>(OnDeviceListSync);
SubscribeLocalEvent<FireAlarmComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnDeviceListSync(EntityUid uid, FireAlarmComponent component, DeviceListUpdateEvent args)
{
_atmosDevNet.Register(uid, null);
_atmosDevNet.Sync(uid, null);
}
private void OnInteractHand(EntityUid uid, FireAlarmComponent component, InteractHandEvent args)
{
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))