forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
451 changed files
with
471,168 additions
and
130,362 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
{ | ||
"0": "XS", | ||
"10": "S", | ||
"30": "M", | ||
"100": "L", | ||
"1000": "XL" | ||
"100": "M", | ||
"1000": "L", | ||
"5000": "XL" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GasPressurePumpComponent, AfterAutoHandleStateEvent>(OnPumpUpdate); | ||
} | ||
|
||
private void OnPumpUpdate(Entity<GasPressurePumpComponent> ent, ref AfterAutoHandleStateEvent args) | ||
{ | ||
if (UserInterfaceSystem.TryGetOpenUi<GasPressurePumpBoundUserInterface>(ent.Owner, GasPressurePumpUiKey.Key, out var bui)) | ||
{ | ||
bui.Update(); | ||
} | ||
} | ||
} |
90 changes: 44 additions & 46 deletions
90
Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
/// <summary> | ||
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received. | ||
/// </summary> | ||
[UsedImplicitly] | ||
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface | ||
{ | ||
/// <summary> | ||
/// Initializes a <see cref="GasPressurePumpWindow"/> and updates it when new server messages are received. | ||
/// </summary> | ||
[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<GasPressurePumpWindow>(); | ||
|
||
_window = this.CreateWindow<GasPressurePumpWindow>(); | ||
_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); | ||
} | ||
|
||
/// <summary> | ||
/// Update the UI state based on server-sent info | ||
/// </summary> | ||
/// <param name="state"></param> | ||
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
MinSize="200 120" Title="Pressure Pump"> | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
SetSize="340 110" MinSize="340 110" Title="Pressure Pump"> | ||
<BoxContainer Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-status}"/> | ||
<Control MinSize="5 0" /> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-status}" Margin="0 0 5 0"/> | ||
<Button Name="ToggleStatusButton"/> | ||
<Control HorizontalExpand="True"/> | ||
<Button HorizontalAlignment="Right" Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" Disabled="True" Margin="0 0 5 0"/> | ||
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" /> | ||
</BoxContainer> | ||
|
||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"> | ||
<Label Text="{Loc comp-gas-pump-ui-pump-output-pressure}"/> | ||
<Control MinSize="5 0" /> | ||
<LineEdit Name="PumpPressureOutputInput" MinSize="70 0" /> | ||
<Control MinSize="5 0" /> | ||
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" /> | ||
<Control MinSize="5 0" /> | ||
<Control HorizontalExpand="True" /> | ||
<Button Name="SetOutputPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-rate}" HorizontalAlignment="Right" Disabled="True"/> | ||
<FloatSpinBox HorizontalExpand="True" Name="PumpPressureOutputInput" MinSize="70 0" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> | ||
</controls:FancyWindow> |
Oops, something went wrong.