Predict gasthermomachines (#33837)

* Predict gasthermomachines

* despawn

* smellby
This commit is contained in:
metalgearsloth
2025-05-13 21:49:43 +10:00
committed by GitHub
parent 24141aa1e9
commit df2257cd92
16 changed files with 236 additions and 135 deletions

View File

@@ -1,19 +1,26 @@
using Content.Client.Power.Components;
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
namespace Content.Client.Atmos.UI;
[GenerateTypedNameReferences]
public sealed partial class GasThermomachineWindow : DefaultWindow
public sealed partial class GasThermomachineWindow : FancyWindow
{
[Dependency] private readonly IEntityManager _entManager = default!;
public bool Active = true;
public FloatSpinBox TemperatureSpinbox;
public EntityUid Entity;
public GasThermomachineWindow()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
SpinboxHBox.AddChild(
@@ -27,12 +34,10 @@ public sealed partial class GasThermomachineWindow : DefaultWindow
if (active)
{
ToggleStatusButton.Text = Loc.GetString("comp-gas-thermomachine-ui-status-enabled");
ToggleStatusButton.Pressed = true;
}
else
{
ToggleStatusButton.Text = Loc.GetString("comp-gas-thermomachine-ui-status-disabled");
ToggleStatusButton.Pressed = false;
}
}
@@ -40,4 +45,14 @@ public sealed partial class GasThermomachineWindow : DefaultWindow
{
TemperatureSpinbox.Value = temperature;
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (_entManager.TryGetComponent(Entity, out ApcPowerReceiverComponent? receiver))
{
SetActive(!receiver.PowerDisabled);
}
}
}