Content/Atmos: add status info to binary devices' examine text (#4928)
This commit is contained in:
@@ -3,11 +3,13 @@ using Content.Server.NodeContainer;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Atmos.Piping;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
{
|
||||
@@ -20,6 +22,19 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
SubscribeLocalEvent<GasValveComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<GasValveComponent, ActivateInWorldEvent>(OnActivate);
|
||||
SubscribeLocalEvent<GasValveComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args)
|
||||
{
|
||||
if (!valve.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||
return;
|
||||
|
||||
if (Loc.TryGetString("gas-valve-system-examined", out var str,
|
||||
("statusColor", valve.Open ? "green" : "orange"),
|
||||
("open", valve.Open)
|
||||
))
|
||||
args.PushMarkup(str);
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, GasValveComponent component, ComponentStartup args)
|
||||
|
||||
Reference in New Issue
Block a user