Station Anchor (#26098)

* Work on abstracting out chargeup functionality/ui from grav gen

* Work on station anchor

* Finish implementing station anchors

* uhh yeah

* ok.

* fix tests

* whoops

* Get the last extraneous yaml fail

* PJB review

* beast mode... ACTIVATE!

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: EmoGarbage404 <retron404@gmail.com>
This commit is contained in:
Julian Giebel
2024-08-31 16:40:28 +02:00
committed by GitHub
parent 8dbaca33e6
commit 417d3a87a2
30 changed files with 944 additions and 541 deletions

View File

@@ -0,0 +1,38 @@
using Content.Shared.Power;
using Robust.Client.UserInterface;
namespace Content.Client.Power.PowerCharge;
public sealed class PowerChargeBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private PowerChargeWindow? _window;
public PowerChargeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
public void SetPowerSwitch(bool on)
{
SendMessage(new SwitchChargingMachineMessage(on));
}
protected override void Open()
{
base.Open();
if (!EntMan.TryGetComponent(Owner, out PowerChargeComponent? component))
return;
_window = this.CreateWindow<PowerChargeWindow>();
_window.UpdateWindow(this, Loc.GetString(component.WindowTitle));
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not PowerChargeState chargeState)
return;
_window?.UpdateState(chargeState);
}
}