Examine text feedback for when things are powered (#1441)

This commit is contained in:
Kmc2000
2020-07-22 08:55:09 +01:00
committed by GitHub
parent d1151281b2
commit 92a9136eab

View File

@@ -8,7 +8,10 @@ using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using System;
using Content.Server.GameObjects.EntitySystems.Click;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Localization;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
{
@@ -16,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
/// Attempts to link with a nearby <see cref="IPowerProvider"/>s so that it can receive power from a <see cref="IApcNet"/>.
/// </summary>
[RegisterComponent]
public class PowerReceiverComponent : Component
public class PowerReceiverComponent : Component, IExamine
{
public override string Name => "PowerReceiver";
@@ -216,6 +219,14 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
ClearProvider();
}
}
///<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>
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("It appears to be {0}.", this.Powered ? "[color=darkgreen]powered[/color]" : "[color=darkred]un-powered[/color]"));
}
}
public class PowerStateEventArgs : EventArgs