Content/Atmos: add status info to binary devices' examine text (#4928)

This commit is contained in:
E F R
2021-10-19 21:46:31 +00:00
committed by GitHub
parent f2fc1431aa
commit 0ab6ca9a12
6 changed files with 54 additions and 0 deletions

View File

@@ -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)