mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-06-09 10:06:46 +02:00
77dd687183
* Working commit * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * fix the tests I broke * Remove methods that the client shouldn't be calling. Hamburger. * light cleanup for now * review * whoop * Commit this shit * More stages. Something something, hamburger. * last of the sprites. Now it's just lights, shaking, and sounds * move comments * bomb * fuck it I'm done * whoops! * fix test fails * review * actually this is better™️ * forgot about you! * remove unused space * make it actually build smile * borger * grah!!!! * review time * Adj powerfactor --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using Content.Shared.Atmos.Components;
|
|
using Content.Shared.Atmos.EntitySystems;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.UserInterface.Systems.Atmos.GasTank
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class GasTankBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private GasTankWindow? _window;
|
|
|
|
public GasTankBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
public void SetOutputPressure(float value)
|
|
{
|
|
SendPredictedMessage(new GasTankSetPressureMessage
|
|
{
|
|
Pressure = value
|
|
});
|
|
}
|
|
|
|
public void ToggleInternals()
|
|
{
|
|
SendPredictedMessage(new GasTankToggleInternalsMessage());
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
_window = this.CreateWindow<GasTankWindow>();
|
|
_window.Entity = Owner;
|
|
_window.SetTitle(EntMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
|
_window.OnOutputPressure += SetOutputPressure;
|
|
_window.OnToggleInternals += ToggleInternals;
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
if (EntMan.TryGetComponent(Owner, out GasTankComponent? component))
|
|
{
|
|
var canConnect = EntMan.System<SharedGasTankSystem>().CanConnectToInternals((Owner, component));
|
|
_window?.Update(canConnect, component.IsConnected, component.ReleasePressure);
|
|
}
|
|
|
|
if (state is GasTankBoundUserInterfaceState cast)
|
|
_window?.UpdateState(cast);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
_window?.Close();
|
|
}
|
|
}
|
|
}
|