file-scoped namespaces

This commit is contained in:
vulppine
2022-08-23 10:55:46 -07:00
parent df25715ed3
commit b3a4ef9997
20 changed files with 2503 additions and 2525 deletions

View File

@@ -9,60 +9,59 @@ using Content.Shared.Interaction;
using Content.Shared.Emag.Systems;
using Robust.Server.GameObjects;
namespace Content.Server.Atmos.Monitor.Systems
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 SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
SubscribeLocalEvent<FireAlarmComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<FireAlarmComponent, DeviceListUpdateEvent>(OnDeviceListSync);
SubscribeLocalEvent<FireAlarmComponent, GotEmaggedEvent>(OnEmagged);
}
public override void Initialize()
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))
{
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))
{
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
{
alarm = AtmosMonitorAlarmType.Normal;
}
alarm = AtmosMonitorAlarmType.Normal;
}
if (alarm == AtmosMonitorAlarmType.Normal)
{
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Danger);
}
else
{
_atmosAlarmable.ResetAllOnNetwork(uid);
}
if (alarm == AtmosMonitorAlarmType.Normal)
{
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Danger);
}
else
{
_atmosAlarmable.ResetAllOnNetwork(uid);
}
}
}
private void OnEmagged(EntityUid uid, FireAlarmComponent component, GotEmaggedEvent args)
private void OnEmagged(EntityUid uid, FireAlarmComponent component, GotEmaggedEvent args)
{
if (TryComp<AtmosMonitorComponent>(uid, out var atmosMonitor))
{
if (TryComp<AtmosMonitorComponent>(uid, out var atmosMonitor))
if (atmosMonitor?.MonitorFire == true)
{
if (atmosMonitor?.MonitorFire == true)
{
atmosMonitor.MonitorFire = false;
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Emagged);
args.Handled = true;
}
atmosMonitor.MonitorFire = false;
_atmosAlarmable.ForceAlert(uid, AtmosMonitorAlarmType.Emagged);
args.Handled = true;
}
}
}