Add docking window to shuttle consoles (#8756)
* lewd * A * Realtime * Sleepy dork * Draw radar position * Accurate infiltrator * experiments * Better drawing * Labels * I need aan adult * Cleanup * Show toggles * display I guess * A * fix * fix * cleanupsies * Bit more polish * Make sure mass scanners actually work * Remove dummy state * fren * opposite * aghost crash * comment * What's in a name * woops * Show docking ports * Dock highlighting * Drawing dock * Shitty docks * Lots of docking drawing * Autodock working * dork * More graceful shutdown * zoomies * Lines and distance change * revert * Good enough * cleanup * Fix default range * Dock UI and loc update * Update on undock * Loc fixes
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using Content.Client.Shuttles.UI;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Content.Shared.Shuttles.Events;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Shuttles.BUI;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private ShuttleConsoleWindow? _window;
|
||||
|
||||
public ShuttleConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) {}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_window = new ShuttleConsoleWindow();
|
||||
_window.ShuttleModePressed += OnShuttleModePressed;
|
||||
_window.UndockPressed += OnUndockPressed;
|
||||
_window.StartAutodockPressed += OnAutodockPressed;
|
||||
_window.StopAutodockPressed += OnStopAutodockPressed;
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += OnClose;
|
||||
}
|
||||
|
||||
private void OnClose()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStopAutodockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new StopAutodockRequestMessage() {Entity = obj});
|
||||
}
|
||||
|
||||
private void OnAutodockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new AutodockRequestMessage() {Entity = obj});
|
||||
}
|
||||
|
||||
private void OnUndockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new UndockRequestMessage() {Entity = obj});
|
||||
}
|
||||
|
||||
private void OnShuttleModePressed(ShuttleMode obj)
|
||||
{
|
||||
SendMessage(new ShuttleModeRequestMessage() {Mode = obj});
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
if (state is not ShuttleConsoleBoundInterfaceState cState) return;
|
||||
_window?.UpdateState(cState);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user