* shuffles devicelist to shared, adds an overlay for devicelist * adds space property to overlay * moves networkconfigurator to shared, makes devicelistsystem clientside check activedevicelist * dirties components upon change, adds networkedcomponent to sharednetworkconfigurator * state handlers for networked components * whoops * lots of shuffling, renaming, and access changes * randomizes color for every new entity added to the overlay * adds a client-side action to clear all network overlays if they're active * clones action (oops) * localization, adds a command for clearing network link overlays (in case the action disappears) * moves the entity manager up into the bui fields * makes that a dependency * attempts to just directly get the color from the dict when drawing, now * fixes up a few comments * adds dirty on init to devicelistcomponent * hacky solution related to mapping with a networkconfigurator * more stricter bound on that hacky solution * just checks if the life stage is initialized instead of if the entity was initialized * moves getalldevices to shared * readds linq import * tries to ensure that the show button is toggled on if the device we're trying to configure is currently being tracked by the overlay * some reorganization
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
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;
|
|
using Content.Shared.Atmos.Monitor;
|
|
using Content.Shared.DeviceNetwork;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Emag.Systems;
|
|
using Robust.Server.GameObjects;
|
|
|
|
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))
|
|
return;
|
|
|
|
if (this.IsPowered(uid, EntityManager))
|
|
{
|
|
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
|
|
{
|
|
alarm = AtmosAlarmType.Normal;
|
|
}
|
|
|
|
if (alarm == AtmosAlarmType.Normal)
|
|
{
|
|
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Danger);
|
|
}
|
|
else
|
|
{
|
|
_atmosAlarmable.ResetAllOnNetwork(uid);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnEmagged(EntityUid uid, FireAlarmComponent component, GotEmaggedEvent args)
|
|
{
|
|
if (TryComp<AtmosAlarmableComponent>(uid, out var alarmable))
|
|
{
|
|
// Remove the atmos alarmable component permanently from this device.
|
|
_atmosAlarmable.ForceAlert(uid, AtmosAlarmType.Emagged, alarmable);
|
|
RemCompDeferred<AtmosAlarmableComponent>(uid);
|
|
}
|
|
}
|
|
}
|