diff --git a/Content.Client/Power/EntitySystems/PowerReceiverSystem.cs b/Content.Client/Power/EntitySystems/PowerReceiverSystem.cs index 4d56592c2322..61e20f751caf 100644 --- a/Content.Client/Power/EntitySystems/PowerReceiverSystem.cs +++ b/Content.Client/Power/EntitySystems/PowerReceiverSystem.cs @@ -1,6 +1,7 @@ -using Content.Client.Power.Components; +using Content.Client.Power.Components; using Content.Shared.Power.Components; using Content.Shared.Power.EntitySystems; +using Content.Shared.Examine; using Robust.Shared.GameStates; namespace Content.Client.Power.EntitySystems; @@ -10,9 +11,15 @@ public sealed class PowerReceiverSystem : SharedPowerReceiverSystem public override void Initialize() { base.Initialize(); + SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnHandleState); } + private void OnExamined(Entity ent, ref ExaminedEvent args) + { + args.PushMarkup(GetExamineText(ent.Comp.Powered)); + } + private void OnHandleState(EntityUid uid, ApcPowerReceiverComponent component, ref ComponentHandleState args) { if (args.Current is not ApcPowerReceiverComponentState state) diff --git a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs index 191d3fc4bdb9..9b15bdfd287a 100644 --- a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs @@ -46,6 +46,11 @@ public override void Initialize() _provQuery = GetEntityQuery(); } + private void OnExamined(Entity ent, ref ExaminedEvent args) + { + args.PushMarkup(GetExamineText(ent.Comp.Powered)); + } + private void OnGetVerbs(EntityUid uid, ApcPowerReceiverComponent component, GetVerbsEvent args) { if (!_adminManager.HasAdminFlag(args.User, AdminFlags.Admin)) @@ -61,17 +66,6 @@ private void OnGetVerbs(EntityUid uid, ApcPowerReceiverComponent component, GetV }); } - /// - ///Adds some markup to the examine text of whatever object is using this component to tell you if it's powered or not, even if it doesn't have an icon state to do this for you. - /// - private void OnExamined(EntityUid uid, ApcPowerReceiverComponent component, ExaminedEvent args) - { - args.PushMarkup(Loc.GetString("power-receiver-component-on-examine-main", - ("stateText", Loc.GetString( component.Powered - ? "power-receiver-component-on-examine-powered" - : "power-receiver-component-on-examine-unpowered")))); - } - private void OnProviderShutdown(EntityUid uid, ApcPowerProviderComponent component, ComponentShutdown args) { foreach (var receiver in component.LinkedReceivers) diff --git a/Content.Shared/Power/EntitySystems/SharedPowerReceiverSystem.cs b/Content.Shared/Power/EntitySystems/SharedPowerReceiverSystem.cs index be2a9dc3abc6..37ac75188968 100644 --- a/Content.Shared/Power/EntitySystems/SharedPowerReceiverSystem.cs +++ b/Content.Shared/Power/EntitySystems/SharedPowerReceiverSystem.cs @@ -1,6 +1,15 @@ -namespace Content.Shared.Power.EntitySystems; +using Content.Shared.Examine; +using Content.Shared.Power.Components; + +namespace Content.Shared.Power.EntitySystems; public abstract class SharedPowerReceiverSystem : EntitySystem { - + 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"))); + } }