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

View File

@@ -13,6 +13,8 @@
deviceNetId: AtmosDevices deviceNetId: AtmosDevices
receiveFrequencyId: AtmosMonitor receiveFrequencyId: AtmosMonitor
transmitFrequencyId: AtmosMonitor transmitFrequencyId: AtmosMonitor
sendBroadcastAttemptEvent: true
- type: DeviceList
- type: ApcNetworkConnection - type: ApcNetworkConnection
- type: AtmosMonitor - type: AtmosMonitor
monitorFire: true monitorFire: true