Files
ss14-wl/Content.Client/Remotes/UI/DoorRemoteStatusControl.cs
Samuka 0fb6f26edb Xenoborg door control module (#41546)
* add door control module

* some commentary

* can't eject stuff anymore

* make xenoborg door remote eletrify doors

* clean yml

* anchors and aliases

* not show stuff about id in xenoborg access config

* engi xenoborg can see eletrified doors
2025-12-16 01:24:54 +00:00

45 lines
1.4 KiB
C#

using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.Remotes.Components;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface;
using Robust.Shared.Timing;
namespace Content.Client.Remotes.UI;
public sealed class DoorRemoteStatusControl(Entity<DoorRemoteComponent> ent) : Control
{
private RichTextLabel? _label;
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (_label == null)
{
_label = new RichTextLabel { StyleClasses = { StyleClass.ItemStatus } };
AddChild(_label);
}
else if (!ent.Comp.IsStatusControlUpdateRequired)
return;
UpdateLabel(_label);
ent.Comp.IsStatusControlUpdateRequired = false;
}
private void UpdateLabel(RichTextLabel label)
{
var modeStringLocalized = Loc.GetString(ent.Comp.Mode switch
{
OperatingMode.OpenClose => "door-remote-open-close-text",
OperatingMode.ToggleBolts => "door-remote-toggle-bolt-text",
OperatingMode.ToggleEmergencyAccess => "door-remote-emergency-access-text",
OperatingMode.ToggleOvercharge => "door-remote-toggle-eletrify-text",
_ => "door-remote-invalid-text"
});
label.SetMarkup(Loc.GetString("door-remote-mode-label", ("modeString", modeStringLocalized)));
}
}