diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs index 4587b419d3..273d194196 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs @@ -1,8 +1,9 @@ #nullable enable using System.Collections.Generic; using System.Linq; -using Content.Client.GameObjects.EntitySystems; +using Content.Client.Atmos.EntitySystems; using Content.Shared.Atmos; +using Content.Shared.Atmos.Prototypes; using JetBrains.Annotations; using Robust.Client.AutoGenerated; using Robust.Client.Console; diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs index 0acd97e52b..2465d8c61d 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs @@ -1,8 +1,9 @@ #nullable enable using System.Collections.Generic; using System.Linq; -using Content.Client.GameObjects.EntitySystems; +using Content.Client.Atmos.EntitySystems; using Content.Shared.Atmos; +using Content.Shared.Atmos.Prototypes; using JetBrains.Annotations; using Robust.Client.AutoGenerated; using Robust.Client.Console; diff --git a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Client/Atmos/Components/GasAnalyzerComponent.cs similarity index 95% rename from Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs rename to Content.Client/Atmos/Components/GasAnalyzerComponent.cs index 41720a8408..bb5ee4e7bd 100644 --- a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Client/Atmos/Components/GasAnalyzerComponent.cs @@ -1,7 +1,7 @@ using Content.Client.Items.Components; using Content.Client.Message; using Content.Client.Stylesheets; -using Content.Shared.GameObjects.Components; +using Content.Shared.Atmos.Components; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.GameObjects; @@ -9,7 +9,7 @@ using Robust.Shared.Localization; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; -namespace Content.Client.GameObjects.Components.Atmos +namespace Content.Client.Atmos.Components { [RegisterComponent] internal class GasAnalyzerComponent : SharedGasAnalyzerComponent, IItemStatus diff --git a/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs similarity index 95% rename from Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs rename to Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs index 880475471e..fe18e1fc5f 100644 --- a/Content.Client/GameObjects/EntitySystems/AtmosDebugOverlaySystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs @@ -1,9 +1,8 @@ #nullable enable -using System; using System.Collections.Generic; -using Content.Client.Atmos; -using Content.Shared.GameObjects.EntitySystems.Atmos; +using Content.Client.Atmos.Overlays; using Content.Shared.Atmos; +using Content.Shared.Atmos.EntitySystems; using Content.Shared.GameTicking; using JetBrains.Annotations; using Robust.Client.Graphics; @@ -11,7 +10,7 @@ using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; -namespace Content.Client.GameObjects.EntitySystems +namespace Content.Client.Atmos.EntitySystems { [UsedImplicitly] internal sealed class AtmosDebugOverlaySystem : SharedAtmosDebugOverlaySystem, IResettingEntitySystem diff --git a/Content.Client/GameObjects/EntitySystems/AtmosphereSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosphereSystem.cs similarity index 53% rename from Content.Client/GameObjects/EntitySystems/AtmosphereSystem.cs rename to Content.Client/Atmos/EntitySystems/AtmosphereSystem.cs index 9b6f57f06d..ee67361146 100644 --- a/Content.Client/GameObjects/EntitySystems/AtmosphereSystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosphereSystem.cs @@ -1,7 +1,7 @@ -using Content.Shared.GameObjects.EntitySystems.Atmos; +using Content.Shared.Atmos.EntitySystems; using JetBrains.Annotations; -namespace Content.Client.GameObjects.EntitySystems +namespace Content.Client.Atmos.EntitySystems { [UsedImplicitly] public class AtmosphereSystem : SharedAtmosphereSystem diff --git a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs similarity index 97% rename from Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs rename to Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs index 2efe25f0e9..470c4cae0c 100644 --- a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -1,20 +1,19 @@ #nullable enable using System; using System.Collections.Generic; -using Content.Client.Atmos; +using Content.Client.Atmos.Overlays; using Content.Shared.Atmos; -using Content.Shared.GameObjects.EntitySystems.Atmos; +using Content.Shared.Atmos.EntitySystems; using JetBrains.Annotations; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.Utility; using Robust.Shared.IoC; -using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Utility; -namespace Content.Client.GameObjects.EntitySystems +namespace Content.Client.Atmos.EntitySystems { [UsedImplicitly] internal sealed class GasTileOverlaySystem : SharedGasTileOverlaySystem diff --git a/Content.Client/Atmos/AtmosDebugOverlay.cs b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs similarity index 98% rename from Content.Client/Atmos/AtmosDebugOverlay.cs rename to Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs index c0987545c1..cf6cd4b424 100644 --- a/Content.Client/Atmos/AtmosDebugOverlay.cs +++ b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs @@ -1,15 +1,14 @@ -using Content.Client.GameObjects.EntitySystems; -using Content.Shared.GameObjects.EntitySystems.Atmos; +using Content.Client.Atmos.EntitySystems; using Content.Shared.Atmos; +using Content.Shared.Atmos.EntitySystems; using Robust.Client.Graphics; +using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; -using Robust.Shared.Enums; -using System; -namespace Content.Client.Atmos +namespace Content.Client.Atmos.Overlays { public class AtmosDebugOverlay : Overlay { diff --git a/Content.Client/Atmos/GasTileOverlay.cs b/Content.Client/Atmos/Overlays/GasTileOverlay.cs similarity index 95% rename from Content.Client/Atmos/GasTileOverlay.cs rename to Content.Client/Atmos/Overlays/GasTileOverlay.cs index 30e31ef0c2..06b5c3bc4f 100644 --- a/Content.Client/Atmos/GasTileOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileOverlay.cs @@ -1,12 +1,12 @@ -using Content.Client.GameObjects.EntitySystems; -using Robust.Shared.Enums; +using Content.Client.Atmos.EntitySystems; using Robust.Client.Graphics; +using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; -namespace Content.Client.Atmos +namespace Content.Client.Atmos.Overlays { public class GasTileOverlay : Overlay { diff --git a/Content.Client/Atmos/Piping/EnabledAtmosDeviceVisualizer.cs b/Content.Client/Atmos/Piping/EnabledAtmosDeviceVisualizer.cs new file mode 100644 index 0000000000..93b2913567 --- /dev/null +++ b/Content.Client/Atmos/Piping/EnabledAtmosDeviceVisualizer.cs @@ -0,0 +1,39 @@ +using System; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public abstract class EnabledAtmosDeviceVisualizer : AppearanceVisualizer + { + [DataField("enabledState")] + private string _enabledState = string.Empty; + protected abstract object LayerMap { get; } + protected abstract Enum DataKey { get; } + + public override void InitializeEntity(IEntity entity) + { + base.InitializeEntity(entity); + + if (!entity.TryGetComponent(out ISpriteComponent? sprite)) + return; + + sprite.LayerMapSet(LayerMap, sprite.AddLayerState(_enabledState)); + sprite.LayerSetVisible(LayerMap, false); + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) + return; + + if(component.TryGetData(DataKey, out bool enabled)) + sprite.LayerSetVisible(LayerMap, enabled); + } + } +} diff --git a/Content.Client/Atmos/Piping/OutletInjectorVisualizer.cs b/Content.Client/Atmos/Piping/OutletInjectorVisualizer.cs new file mode 100644 index 0000000000..2d4cad5cf6 --- /dev/null +++ b/Content.Client/Atmos/Piping/OutletInjectorVisualizer.cs @@ -0,0 +1,18 @@ +using System; +using Content.Shared.Atmos.Piping; +using JetBrains.Annotations; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class OutletInjectorVisualizer : EnabledAtmosDeviceVisualizer + { + protected override object LayerMap => Layers.Enabled; + protected override Enum DataKey => OutletInjectorVisuals.Enabled; + + enum Layers + { + Enabled, + } + } +} diff --git a/Content.Client/Atmos/Piping/PassiveVentVisualizer.cs b/Content.Client/Atmos/Piping/PassiveVentVisualizer.cs new file mode 100644 index 0000000000..a932eb055a --- /dev/null +++ b/Content.Client/Atmos/Piping/PassiveVentVisualizer.cs @@ -0,0 +1,18 @@ +using System; +using Content.Shared.Atmos.Piping; +using JetBrains.Annotations; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class PassiveVentVisualizer : EnabledAtmosDeviceVisualizer + { + protected override object LayerMap => Layers.Enabled; + protected override Enum DataKey => PassiveVentVisuals.Enabled; + + enum Layers + { + Enabled, + } + } +} diff --git a/Content.Client/GameObjects/Components/Atmos/Piping/PipeConnectorVisualizer.cs b/Content.Client/Atmos/Piping/PipeConnectorVisualizer.cs similarity index 91% rename from Content.Client/GameObjects/Components/Atmos/Piping/PipeConnectorVisualizer.cs rename to Content.Client/Atmos/Piping/PipeConnectorVisualizer.cs index dbdc1df5e9..93e70bf8d3 100644 --- a/Content.Client/GameObjects/Components/Atmos/Piping/PipeConnectorVisualizer.cs +++ b/Content.Client/Atmos/Piping/PipeConnectorVisualizer.cs @@ -1,6 +1,6 @@ #nullable enable using System; -using Content.Shared.GameObjects.Components.Atmos; +using Content.Shared.Atmos; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -10,9 +10,8 @@ using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; -using YamlDotNet.RepresentationModel; -namespace Content.Client.GameObjects.Components.Atmos.Piping +namespace Content.Client.Atmos.Piping { [UsedImplicitly] public class PipeConnectorVisualizer : AppearanceVisualizer, ISerializationHooks @@ -33,7 +32,7 @@ namespace Content.Client.GameObjects.Components.Atmos.Piping if (resourceCache.TryGetResource(rsiString, out RSIResource? rsi)) _connectorRsi = rsi.RSI; else - Logger.Error($"{nameof(PipeVisualizer)} could not load to load RSI {rsiString}."); + Logger.Error($"{nameof(PipeConnectorVisualizer)} could not load to load RSI {rsiString}."); } public override void InitializeEntity(IEntity entity) diff --git a/Content.Client/Atmos/Piping/PressurePumpVisualizer.cs b/Content.Client/Atmos/Piping/PressurePumpVisualizer.cs new file mode 100644 index 0000000000..acdf4350d0 --- /dev/null +++ b/Content.Client/Atmos/Piping/PressurePumpVisualizer.cs @@ -0,0 +1,18 @@ +using System; +using Content.Shared.Atmos.Piping; +using JetBrains.Annotations; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class PressurePumpVisualizer : EnabledAtmosDeviceVisualizer + { + protected override object LayerMap => Layers.Enabled; + protected override Enum DataKey => PressurePumpVisuals.Enabled; + + enum Layers + { + Enabled, + } + } +} diff --git a/Content.Client/Atmos/Piping/ScrubberVisualizer.cs b/Content.Client/Atmos/Piping/ScrubberVisualizer.cs new file mode 100644 index 0000000000..b4add93bcd --- /dev/null +++ b/Content.Client/Atmos/Piping/ScrubberVisualizer.cs @@ -0,0 +1,52 @@ +using Content.Shared.Atmos.Piping.Unary.Visuals; +using Content.Shared.Atmos.Visuals; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class ScrubberVisualizer : AppearanceVisualizer + { + private string _offState = "scrub_off"; + private string _scrubState = "scrub_on"; + private string _siphonState = "scrub_purge"; + private string _weldedState = "scrub_welded"; + private string _wideState = "scrub_wide"; + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) + return; + + if (!component.TryGetData(ScrubberVisuals.State, out ScrubberState state)) + return; + + switch (state) + { + case ScrubberState.Off: + sprite.LayerSetState(ScrubberVisualLayers.Scrubber, _offState); + break; + case ScrubberState.Scrub: + sprite.LayerSetState(ScrubberVisualLayers.Scrubber, _scrubState); + break; + case ScrubberState.Siphon: + sprite.LayerSetState(ScrubberVisualLayers.Scrubber, _siphonState); + break; + case ScrubberState.Welded: + sprite.LayerSetState(ScrubberVisualLayers.Scrubber, _weldedState); + break; + case ScrubberState.WideScrub: + sprite.LayerSetState(ScrubberVisualLayers.Scrubber, _wideState); + break; + } + } + } + + public enum ScrubberVisualLayers + { + Scrubber, + } +} diff --git a/Content.Client/Atmos/Piping/ThermoMachineVisualizer.cs b/Content.Client/Atmos/Piping/ThermoMachineVisualizer.cs new file mode 100644 index 0000000000..2a1136a951 --- /dev/null +++ b/Content.Client/Atmos/Piping/ThermoMachineVisualizer.cs @@ -0,0 +1,18 @@ +using System; +using Content.Shared.Atmos.Piping; +using JetBrains.Annotations; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class ThermoMachineVisualizer : EnabledAtmosDeviceVisualizer + { + protected override object LayerMap => Layers.Enabled; + protected override Enum DataKey => ThermoMachineVisuals.Enabled; + + enum Layers + { + Enabled, + } + } +} diff --git a/Content.Client/Atmos/Piping/VentPumpVisualizer.cs b/Content.Client/Atmos/Piping/VentPumpVisualizer.cs new file mode 100644 index 0000000000..d31dad27a8 --- /dev/null +++ b/Content.Client/Atmos/Piping/VentPumpVisualizer.cs @@ -0,0 +1,47 @@ +using Content.Shared.Atmos.Visuals; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Atmos.Piping +{ + [UsedImplicitly] + public class VentPumpVisualizer : AppearanceVisualizer + { + private string _offState = "vent_off"; + private string _inState = "vent_in"; + private string _outState = "vent_out"; + private string _weldedState = "vent_welded"; + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) + return; + + if (!component.TryGetData(VentPumpVisuals.State, out VentPumpState state)) + return; + + switch (state) + { + case VentPumpState.Off: + sprite.LayerSetState(VentVisualLayers.Vent, _offState); + break; + case VentPumpState.In: + sprite.LayerSetState(VentVisualLayers.Vent, _inState); + break; + case VentPumpState.Out: + sprite.LayerSetState(VentVisualLayers.Vent, _outState); + break; + case VentPumpState.Welded: + sprite.LayerSetState(VentVisualLayers.Vent, _weldedState); + break; + } + } + } + + public enum VentVisualLayers + { + Vent, + } +} diff --git a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerBoundUserInterface.cs b/Content.Client/Atmos/UI/GasAnalyzerBoundUserInterface.cs similarity index 88% rename from Content.Client/GameObjects/Components/Atmos/GasAnalyzerBoundUserInterface.cs rename to Content.Client/Atmos/UI/GasAnalyzerBoundUserInterface.cs index 98d07f1ef9..ad25648633 100644 --- a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerBoundUserInterface.cs +++ b/Content.Client/Atmos/UI/GasAnalyzerBoundUserInterface.cs @@ -1,8 +1,8 @@ using Robust.Client.GameObjects; using Robust.Shared.GameObjects; -using static Content.Shared.GameObjects.Components.SharedGasAnalyzerComponent; +using static Content.Shared.Atmos.Components.SharedGasAnalyzerComponent; -namespace Content.Client.GameObjects.Components.Atmos +namespace Content.Client.Atmos.UI { public class GasAnalyzerBoundUserInterface : BoundUserInterface { diff --git a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerMenu.cs b/Content.Client/Atmos/UI/GasAnalyzerMenu.cs similarity index 98% rename from Content.Client/GameObjects/Components/Atmos/GasAnalyzerMenu.cs rename to Content.Client/Atmos/UI/GasAnalyzerMenu.cs index 15adc5890a..d05c454e38 100644 --- a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerMenu.cs +++ b/Content.Client/Atmos/UI/GasAnalyzerMenu.cs @@ -9,9 +9,9 @@ using Robust.Client.UserInterface.CustomControls; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; -using static Content.Shared.GameObjects.Components.SharedGasAnalyzerComponent; +using static Content.Shared.Atmos.Components.SharedGasAnalyzerComponent; -namespace Content.Client.GameObjects.Components.Atmos +namespace Content.Client.Atmos.UI { public class GasAnalyzerWindow : BaseWindow { diff --git a/Content.Client/Atmos/UI/GasCanisterBoundUserInterface.cs b/Content.Client/Atmos/UI/GasCanisterBoundUserInterface.cs new file mode 100644 index 0000000000..0f21ef4b1d --- /dev/null +++ b/Content.Client/Atmos/UI/GasCanisterBoundUserInterface.cs @@ -0,0 +1,86 @@ +using Content.Shared.Atmos.Piping.Binary.Components; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; + +namespace Content.Client.Atmos.UI +{ + /// + /// Initializes a and updates it when new server messages are received. + /// + [UsedImplicitly] + public class GasCanisterBoundUserInterface : BoundUserInterface + { + + private GasCanisterWindow? _window; + + public GasCanisterBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _window = new GasCanisterWindow(); + + if(State != null) + UpdateState(State); + + _window.OpenCentered(); + + _window.OnClose += Close; + _window.ReleaseValveCloseButtonPressed += OnReleaseValveClosePressed; + _window.ReleaseValveOpenButtonPressed += OnReleaseValveOpenPressed; + _window.ReleasePressureSliderChanged += OnReleasePressurePressed; + _window.TankEjectButtonPressed += OnTankEjectPressed; + } + + private void OnTankEjectPressed() + { + SendMessage(new GasCanisterHoldingTankEjectMessage()); + } + + private void OnReleasePressurePressed(float value) + { + SendMessage(new GasCanisterChangeReleasePressureMessage(value)); + } + + private void OnReleaseValveOpenPressed() + { + SendMessage(new GasCanisterChangeReleaseValveMessage(true)); + } + + private void OnReleaseValveClosePressed() + { + SendMessage(new GasCanisterChangeReleaseValveMessage(false)); + } + + /// + /// Update the UI state based on server-sent info + /// + /// + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + if (_window == null || state is not GasCanisterBoundUserInterfaceState cast) + return; + + _window.SetCanisterLabel(cast.CanisterLabel); + _window.SetCanisterPressure(cast.CanisterPressure); + _window.SetPortStatus(cast.PortStatus); + _window.SetTankLabel(cast.TankLabel); + _window.SetTankPressure(cast.TankPressure); + _window.SetReleasePressureRange(cast.ReleasePressureMin, cast.ReleasePressureMax); + _window.SetReleasePressure(cast.ReleasePressure); + _window.SetReleaseValve(cast.ReleaseValve); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) return; + _window?.Dispose(); + } + } +} diff --git a/Content.Client/Atmos/UI/GasCanisterWindow.xaml b/Content.Client/Atmos/UI/GasCanisterWindow.xaml new file mode 100644 index 0000000000..6bddc2ced3 --- /dev/null +++ b/Content.Client/Atmos/UI/GasCanisterWindow.xaml @@ -0,0 +1,52 @@ + + + + + + +