Files
Delta-v/Content.Client/Tools/UI/WelderStatusControl.cs
T
cc39ded995 Nanite Applicator (#2314)
* tool added

* comments and fixes

* final fix

* chore: automatically update REUSE headers

* final fix

* chore: automatically update REUSE headers

* fix localization

* fix

* chore: automatically update REUSE headers

* fixed the comment location

* test fix

* fix

* chore: automatically update REUSE headers

* not syndicate anymore

* Update Content.Server/Repairable/RepairableSystem.cs

sure

Co-authored-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com>

* nesting fixed

---------

Co-authored-by: Vanessa Louwagie <vanessalouwagie@outlook.com>
Co-authored-by: monolith8319 <195513600+monolith8319@users.noreply.github.com>
Co-authored-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com>
2026-07-05 10:10:44 -05:00

57 lines
2.2 KiB
C#

using Content.Client.Items.UI;
using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.FixedPoint;
using Content.Shared.Tools.Components;
using Content.Shared.Tools.Systems;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.Tools.UI;
public sealed class WelderStatusControl : PollingItemStatusControl<WelderStatusControl.Data>
{
private readonly Entity<WelderComponent> _parent;
private readonly IEntityManager _entityManager;
private readonly SharedToolSystem _toolSystem;
private readonly RichTextLabel _label;
public WelderStatusControl(Entity<WelderComponent> parent, IEntityManager entityManager, SharedToolSystem toolSystem)
{
_parent = parent;
_entityManager = entityManager;
_toolSystem = toolSystem;
_label = new RichTextLabel { StyleClasses = { StyleClass.ItemStatus } };
AddChild(_label);
UpdateDraw();
}
protected override Data PollData()
{
var (fuel, capacity) = _toolSystem.GetWelderFuelAndCapacity(_parent, _parent.Comp);
return new Data(fuel, capacity, _parent.Comp.Enabled, _parent.Comp.OnlyDisplayFuel); // Monolith - Nanite Applicators
}
protected override void Update(in Data data)
{
// BEGIN Monolith - Nanite applicator
if (data.OnlyDisplayFuel)
{
_label.SetMarkup(Loc.GetString("welder-component-on-examine-less-detailed-message",
("colorName", data.Fuel < data.FuelCapacity / 4f ? "darkorange" : "orange"),
("fuelLeft", data.Fuel),
("fuelCapacity", data.FuelCapacity)));
return;
}
// END Monolith
_label.SetMarkup(Loc.GetString("welder-component-on-examine-detailed-message",
("colorName", data.Fuel < data.FuelCapacity / 4f ? "darkorange" : "orange"),
("fuelLeft", data.Fuel),
("fuelCapacity", data.FuelCapacity),
("status", Loc.GetString(data.Lit ? "welder-component-on-examine-welder-lit-message" : "welder-component-on-examine-welder-not-lit-message"))));
}
public record struct Data(FixedPoint2 Fuel, FixedPoint2 FuelCapacity, bool Lit, bool OnlyDisplayFuel = false); // Monolith - Nanite Applicators
}