Predict ActivatableUIRequiresPower (#28405)

A lot of BUIs aren't going to handle the state coming in cleanly but we can fix em as we find em.
This commit is contained in:
metalgearsloth
2024-05-30 17:32:16 +10:00
committed by GitHub
parent e2bf127323
commit e4a5f2a145
4 changed files with 58 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
using Content.Client.Power.Components;
namespace Content.Client.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)
{
if (receiver == null && !entManager.TryGetComponent(uid, out receiver))
return false;
return receiver.Powered;
}
}