Files
crystall-punk-14/Content.Shared/Power/EntitySystems/SharedPowerReceiverSystem.cs

29 lines
1007 B
C#
Raw Permalink Normal View History

using System.Diagnostics.CodeAnalysis;
using Content.Shared.Power.Components;
namespace Content.Shared.Power.EntitySystems;
public abstract class SharedPowerReceiverSystem : EntitySystem
{
public abstract bool ResolveApc(EntityUid entity, [NotNullWhen(true)] ref SharedApcPowerReceiverComponent? component);
2024-09-27 10:22:17 +03:00
/// <summary>
/// Checks if entity is APC-powered device, and if it have power.
/// </summary>
public bool IsPowered(Entity<SharedApcPowerReceiverComponent?> entity)
{
if (!ResolveApc(entity.Owner, ref entity.Comp))
return true;
return entity.Comp.Powered;
}
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")));
}
}