Add static "IsPowered" method (#8434)
* Add static "IsPowered" method * Use IsPowered in more places Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
@@ -201,7 +202,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out ApcPowerReceiverComponent recv) && !recv.Powered)
|
||||
if (!this.IsPowered(uid, EntityManager))
|
||||
return;
|
||||
|
||||
_uiSystem.GetUiOrNull(component.Owner, SharedAirAlarmInterfaceKey.Key)?.Open(actor.PlayerSession);
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.DeviceNetwork;
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -229,8 +230,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
|
||||
private void OnFireEvent(EntityUid uid, AtmosMonitorComponent component, ref TileFireEvent args)
|
||||
{
|
||||
if (!TryComp<ApcPowerReceiverComponent>(uid, out var powerReceiverComponent)
|
||||
|| !powerReceiverComponent.Powered)
|
||||
if (!this.IsPowered(uid, EntityManager))
|
||||
return;
|
||||
|
||||
// if we're monitoring for atmos fire, then we make it similar to a smoke detector
|
||||
@@ -252,8 +252,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
|
||||
private void OnAtmosUpdate(EntityUid uid, AtmosMonitorComponent component, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
if (!TryComp<ApcPowerReceiverComponent>(uid, out var powerReceiverComponent)
|
||||
|| !powerReceiverComponent.Powered)
|
||||
if (!this.IsPowered(uid, EntityManager))
|
||||
return;
|
||||
|
||||
// can't hurt
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Atmos.Monitor.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.AlertLevel;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -27,8 +28,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
|
||||
if (EntityManager.TryGetComponent(args.User, out ActorComponent? actor)
|
||||
&& EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|
||||
&& EntityManager.TryGetComponent(uid, out ApcPowerReceiverComponent? power)
|
||||
&& power.Powered)
|
||||
&& this.IsPowered(uid, EntityManager))
|
||||
{
|
||||
if (monitor.HighestAlarmInNetwork == AtmosMonitorAlarmType.Normal)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user