Cleaner BoundUserInterfaces (#17736)

This commit is contained in:
TemporalOroboros
2023-07-08 09:02:17 -07:00
committed by GitHub
parent 55b4fb1649
commit 3ac4cf85db
137 changed files with 1069 additions and 972 deletions

View File

@@ -2,12 +2,13 @@ using Content.Client.Computer;
using Content.Client.Shuttles.UI;
using Content.Shared.Shuttles.BUIStates;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.Shuttles.BUI;
[UsedImplicitly]
public sealed class EmergencyConsoleBoundUserInterface : ComputerBoundUserInterface<EmergencyConsoleWindow, EmergencyConsoleBoundUserInterfaceState>
{
public EmergencyConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
public EmergencyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
}

View File

@@ -9,16 +9,17 @@ namespace Content.Client.Shuttles.BUI;
[UsedImplicitly]
public sealed class IFFConsoleBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private IFFConsoleWindow? _window;
public IFFConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
public IFFConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new IFFConsoleWindow();
_window.OnClose += Close;
_window.ShowIFF += SendIFFMessage;

View File

@@ -8,13 +8,17 @@ namespace Content.Client.Shuttles.BUI;
[UsedImplicitly]
public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private RadarConsoleWindow? _window;
public RadarConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
public RadarConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new RadarConsoleWindow();
_window.OnClose += Close;
_window.OpenCentered();

View File

@@ -1,6 +1,5 @@
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;
@@ -10,9 +9,12 @@ namespace Content.Client.Shuttles.BUI;
[UsedImplicitly]
public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private ShuttleConsoleWindow? _window;
public ShuttleConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
public ShuttleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
@@ -51,17 +53,17 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
private void OnStopAutodockPressed(EntityUid obj)
{
SendMessage(new StopAutodockRequestMessage() {DockEntity = obj});
SendMessage(new StopAutodockRequestMessage() { DockEntity = obj });
}
private void OnAutodockPressed(EntityUid obj)
{
SendMessage(new AutodockRequestMessage() {DockEntity = obj});
SendMessage(new AutodockRequestMessage() { DockEntity = obj });
}
private void OnUndockPressed(EntityUid obj)
{
SendMessage(new UndockRequestMessage() {DockEntity = obj});
SendMessage(new UndockRequestMessage() { DockEntity = obj });
}
protected override void UpdateState(BoundUserInterfaceState state)

View File

@@ -52,13 +52,13 @@ namespace Content.Client.Shuttles.Systems
return;
}
if (!TryComp<ShuttleConsoleComponent>(console, out var shuttleConsoleComponent))
if (!HasComp<ShuttleConsoleComponent>(console))
{
Logger.Warning($"Unable to set Helmsman console to {console}");
Log.Warning($"Unable to set Helmsman console to {console}");
return;
}
component.Console = shuttleConsoleComponent;
component.Console = console;
ActionBlockerSystem.UpdateCanMove(uid);
_input.Contexts.SetActiveContext("shuttle");
}