* Reapply "Remove some BUI boilerplate" (#30214)
This reverts commit cb0ba66be3.
* Fix gas tank
* Fix PA
* Fix microwave
* Comms console underwrap
* Fix rcd
* log wehs
This commit is contained in:
@@ -23,11 +23,12 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
|
||||
public Action<string>? OnDisablePressed;
|
||||
public Action<string>? OnDestroyPressed;
|
||||
|
||||
private Entity<RoboticsConsoleComponent, LockComponent?> _console;
|
||||
private string? _selected;
|
||||
private Dictionary<string, CyborgControlData> _cyborgs = new();
|
||||
|
||||
public RoboticsConsoleWindow(EntityUid console)
|
||||
public EntityUid Entity;
|
||||
|
||||
public RoboticsConsoleWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -35,9 +36,6 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
|
||||
_lock = _entMan.System<LockSystem>();
|
||||
_sprite = _entMan.System<SpriteSystem>();
|
||||
|
||||
_console = (console, _entMan.GetComponent<RoboticsConsoleComponent>(console), null);
|
||||
_entMan.TryGetComponent(_console, out _console.Comp2);
|
||||
|
||||
Cyborgs.OnItemSelected += args =>
|
||||
{
|
||||
if (Cyborgs[args.ItemIndex].Metadata is not string address)
|
||||
@@ -66,6 +64,11 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
|
||||
DestroyButton.StyleClasses.Add(StyleBase.ButtonCaution);
|
||||
}
|
||||
|
||||
public void SetEntity(EntityUid uid)
|
||||
{
|
||||
Entity = uid;
|
||||
}
|
||||
|
||||
public void UpdateState(RoboticsConsoleState state)
|
||||
{
|
||||
_cyborgs = state.Cyborgs;
|
||||
@@ -81,7 +84,7 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
|
||||
|
||||
PopulateData();
|
||||
|
||||
var locked = _lock.IsLocked((_console, _console.Comp2));
|
||||
var locked = _lock.IsLocked(Entity);
|
||||
DangerZone.Visible = !locked;
|
||||
LockedMessage.Visible = locked;
|
||||
}
|
||||
@@ -135,13 +138,19 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
|
||||
|
||||
// how the turntables
|
||||
DisableButton.Disabled = !(data.HasBrain && data.CanDisable);
|
||||
DestroyButton.Disabled = _timing.CurTime < _console.Comp1.NextDestroy;
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
|
||||
DestroyButton.Disabled = _timing.CurTime < _console.Comp1.NextDestroy;
|
||||
if (_entMan.TryGetComponent(Entity, out RoboticsConsoleComponent? console))
|
||||
{
|
||||
DestroyButton.Disabled = _timing.CurTime < console.NextDestroy;
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyButton.Disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user