diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2d75298e690b36..3d68145de7fc04 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -23,4 +23,4 @@ /Resources/Maps/ @spanky-spanky /Resources/Prototypes/Maps/ @spanky-spanky /Resources/Prototypes/_Harmony/Maps/ @spanky-spanky -/Content.IntegrationTests/Tests/PostMapInitTest.cs @spanky-spanky +/Content.IntegrationTests/Tests/PostMapInitTest.cs @spanky-spanky \ No newline at end of file diff --git a/.github/labeler.yml b/.github/labeler.yml index 69b2ca87749c6e..ca5aeed1f3ca14 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -16,6 +16,10 @@ - changed-files: - any-glob-to-any-file: '**/*.swsl' +"Changes: Audio": +- changed-files: + - any-glob-to-any-file: '**/*.ogg' + "Changes: No C#": - changed-files: # Equiv to any-glob-to-all as long as this has one matcher. If ALL changed files are not C# files, then apply label. diff --git a/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs b/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs new file mode 100644 index 00000000000000..54e16bc86216c5 --- /dev/null +++ b/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs @@ -0,0 +1,23 @@ +using Content.Client.Atmos.UI; +using Content.Shared.Atmos.Components; +using Content.Shared.Atmos.EntitySystems; +using Content.Shared.Atmos.Piping.Binary.Components; + +namespace Content.Client.Atmos.EntitySystems; + +public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnPumpUpdate); + } + + private void OnPumpUpdate(Entity ent, ref AfterAutoHandleStateEvent args) + { + if (UserInterfaceSystem.TryGetOpenUi(ent.Owner, GasPressurePumpUiKey.Key, out var bui)) + { + bui.Update(); + } + } +} diff --git a/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs b/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs index 220fdbe875c929..0c07eec4025c35 100644 --- a/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs +++ b/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs @@ -1,65 +1,63 @@ using Content.Shared.Atmos; +using Content.Shared.Atmos.Components; using Content.Shared.Atmos.Piping.Binary.Components; +using Content.Shared.IdentityManagement; using Content.Shared.Localizations; using JetBrains.Annotations; -using Robust.Client.GameObjects; using Robust.Client.UserInterface; -namespace Content.Client.Atmos.UI +namespace Content.Client.Atmos.UI; + +/// +/// Initializes a and updates it when new server messages are received. +/// +[UsedImplicitly] +public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface { - /// - /// Initializes a and updates it when new server messages are received. - /// - [UsedImplicitly] - public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface - { - [ViewVariables] - private const float MaxPressure = Atmospherics.MaxOutputPressure; + [ViewVariables] + private const float MaxPressure = Atmospherics.MaxOutputPressure; + + [ViewVariables] + private GasPressurePumpWindow? _window; - [ViewVariables] - private GasPressurePumpWindow? _window; + public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } - public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } + protected override void Open() + { + base.Open(); - protected override void Open() - { - base.Open(); + _window = this.CreateWindow(); - _window = this.CreateWindow(); + _window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed; + _window.PumpOutputPressureChanged += OnPumpOutputPressurePressed; + Update(); + } - _window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed; - _window.PumpOutputPressureChanged += OnPumpOutputPressurePressed; - } + public void Update() + { + if (_window == null) + return; - private void OnToggleStatusButtonPressed() - { - if (_window is null) return; - SendMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus)); - } + _window.Title = Identity.Name(Owner, EntMan); - private void OnPumpOutputPressurePressed(string value) - { - var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f; - if (pressure > MaxPressure) pressure = MaxPressure; + if (!EntMan.TryGetComponent(Owner, out GasPressurePumpComponent? pump)) + return; - SendMessage(new GasPressurePumpChangeOutputPressureMessage(pressure)); - } + _window.SetPumpStatus(pump.Enabled); + _window.MaxPressure = pump.MaxTargetPressure; + _window.SetOutputPressure(pump.TargetPressure); + } - /// - /// Update the UI state based on server-sent info - /// - /// - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); - if (_window == null || state is not GasPressurePumpBoundUserInterfaceState cast) - return; + private void OnToggleStatusButtonPressed() + { + if (_window is null) return; + SendPredictedMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus)); + } - _window.Title = (cast.PumpLabel); - _window.SetPumpStatus(cast.Enabled); - _window.SetOutputPressure(cast.OutputPressure); - } + private void OnPumpOutputPressurePressed(float value) + { + SendPredictedMessage(new GasPressurePumpChangeOutputPressureMessage(value)); } } diff --git a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml index a0896a7b41e7b7..f2c2c7cec50862 100644 --- a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml +++ b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml @@ -1,22 +1,18 @@ - + xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" + SetSize="340 110" MinSize="340 110" Title="Pressure Pump"> -