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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user