2024-08-25 22:18:42 +10:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2024-07-29 00:28:17 -07:00
|
|
|
using Content.Shared.Examine;
|
|
|
|
|
using Content.Shared.Power.Components;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Power.EntitySystems;
|
2024-05-29 23:46:22 -07:00
|
|
|
|
|
|
|
|
public abstract class SharedPowerReceiverSystem : EntitySystem
|
|
|
|
|
{
|
2024-08-25 22:18:42 +10:00
|
|
|
public abstract bool ResolveApc(EntityUid entity, [NotNullWhen(true)] ref SharedApcPowerReceiverComponent? component);
|
|
|
|
|
|
|
|
|
|
public bool IsPowered(Entity<SharedApcPowerReceiverComponent?> entity)
|
|
|
|
|
{
|
|
|
|
|
if (!ResolveApc(entity.Owner, ref entity.Comp))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return entity.Comp.Powered;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 00:28:17 -07:00
|
|
|
protected string GetExamineText(bool powered)
|
|
|
|
|
{
|
|
|
|
|
return Loc.GetString("power-receiver-component-on-examine-main",
|
|
|
|
|
("stateText", Loc.GetString(powered
|
|
|
|
|
? "power-receiver-component-on-examine-powered"
|
|
|
|
|
: "power-receiver-component-on-examine-unpowered")));
|
|
|
|
|
}
|
2024-05-29 23:46:22 -07:00
|
|
|
}
|