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:
13
Content.Server/Power/EntitySystems/StaticPowerSystem.cs
Normal file
13
Content.Server/Power/EntitySystems/StaticPowerSystem.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Content.Server.Power.Components;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems;
|
||||
|
||||
public static class StaticPowerSystem
|
||||
{
|
||||
// Using this makes the call shorter.
|
||||
// ReSharper disable once UnusedParameter.Global
|
||||
public static bool IsPowered(this EntitySystem system, EntityUid uid, IEntityManager entManager, ApcPowerReceiverComponent? receiver = null)
|
||||
{
|
||||
return entManager.TryGetComponent<ApcPowerReceiverComponent>(uid, out receiver) && receiver.Powered;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user