Literally Murder IExamine (#7352)

This commit is contained in:
Rane
2022-04-08 17:17:25 -04:00
committed by GitHub
parent 427f7378c3
commit 7900abb888
27 changed files with 372 additions and 469 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.Power.Components;
using Robust.Shared.GameObjects;
using Content.Shared.Examine;
namespace Content.Server.Power.EntitySystems
{
public sealed class PowerReceiverSystem : EntitySystem
@@ -8,6 +7,7 @@ namespace Content.Server.Power.EntitySystems
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ApcPowerReceiverComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ApcPowerReceiverComponent, ExtensionCableSystem.ProviderConnectedEvent>(OnProviderConnected);
SubscribeLocalEvent<ApcPowerReceiverComponent, ExtensionCableSystem.ProviderDisconnectedEvent>(OnProviderDisconnected);
@@ -17,6 +17,16 @@ namespace Content.Server.Power.EntitySystems
SubscribeLocalEvent<ApcPowerProviderComponent, ExtensionCableSystem.ReceiverDisconnectedEvent>(OnReceiverDisconnected);
}
///<summary>
///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.
///</summary>
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)