From ad8c8d69aafb01927542d75344fc567b21529163 Mon Sep 17 00:00:00 2001 From: Vonsant Date: Tue, 24 Dec 2024 02:14:54 +0300 Subject: [PATCH 1/3] AutoPipes --- .../Components/GasPressurePumpComponent.cs | 5 ++++ .../Components/GasVolumePumpComponent.cs | 5 ++++ .../EntitySystems/GasPressurePumpSystem.cs | 18 +++++++++++- .../EntitySystems/GasVolumePumpSystem.cs | 16 ++++++++++ .../Trinary/Components/GasMixerComponent.cs | 5 ++++ .../Trinary/EntitySystems/GasMixerSystem.cs | 16 ++++++++++ .../structures/piping/atmospherics/binary.ftl | 9 ++++++ .../piping/atmospherics/trinary.ftl | 6 ++++ .../Structures/Piping/Atmospherics/binary.yml | 29 +++++++++++++++++++ .../Piping/Atmospherics/trinary.yml | 16 ++++++++++ 10 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/binary.ftl create mode 100644 Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/trinary.ftl create mode 100644 Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/binary.yml create mode 100644 Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/trinary.yml diff --git a/Content.Server/Atmos/Piping/Binary/Components/GasPressurePumpComponent.cs b/Content.Server/Atmos/Piping/Binary/Components/GasPressurePumpComponent.cs index 8816e1af220..27df32b3ec1 100644 --- a/Content.Server/Atmos/Piping/Binary/Components/GasPressurePumpComponent.cs +++ b/Content.Server/Atmos/Piping/Binary/Components/GasPressurePumpComponent.cs @@ -27,5 +27,10 @@ public sealed partial class GasPressurePumpComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField("maxTargetPressure")] public float MaxTargetPressure = Atmospherics.MaxOutputPressure; + + /// Corvax-Next-AutoPipes-Start + [DataField] + public bool StartOnMapInit { get; set; } = false; + /// Corvax-Next-AutoPipes-End } } diff --git a/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs b/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs index 36ced3887d2..99cb9b5cf22 100644 --- a/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs +++ b/Content.Server/Atmos/Piping/Binary/Components/GasVolumePumpComponent.cs @@ -46,5 +46,10 @@ public sealed partial class GasVolumePumpComponent : Component [DataField("lastMolesTransferred")] public float LastMolesTransferred; + + /// Corvax-Next-AutoPipes-Start + [DataField] + public bool StartOnMapInit { get; set; } = false; + /// Corvax-Next-AutoPipes-End } } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index abd34396a0c..b9989006527 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -44,6 +44,8 @@ public override void Initialize() // Bound UI subscriptions SubscribeLocalEvent(OnOutputPressureChangeMessage); SubscribeLocalEvent(OnToggleStatusMessage); + + SubscribeLocalEvent(OnMapInit); // Corvax-Next-AutoPipes } private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args) @@ -165,5 +167,19 @@ private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = nu bool pumpOn = pump.Enabled && (TryComp(uid, out var power) && power.Powered); _appearance.SetData(uid, PumpVisuals.Enabled, pumpOn, appearance); } + + /// Corvax-Next-AutoPipes-Start + private void OnMapInit(EntityUid uid, GasPressurePumpComponent pump, MapInitEvent args) + { + if (pump.StartOnMapInit) + { + pump.Enabled = true; + UpdateAppearance(uid, pump); + + DirtyUI(uid, pump); + _userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key); + } + } + /// Corvax-Next-AutoPipes-End } -} +} \ No newline at end of file diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index 9ddd7dce67d..52dac12e65e 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -52,6 +52,8 @@ public override void Initialize() SubscribeLocalEvent(OnToggleStatusMessage); SubscribeLocalEvent(OnPacketRecv); + + SubscribeLocalEvent(OnMapInit); // Corvax-Next-AutoPipe } private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args) @@ -218,5 +220,19 @@ private void OnPacketRecv(EntityUid uid, GasVolumePumpComponent component, Devic return; } } + + /// Corvax-Next-AutoPipes-Start + private void OnMapInit(EntityUid uid, GasVolumePumpComponent pump, MapInitEvent args) + { + if (pump.StartOnMapInit) + { + pump.Enabled = true; + UpdateAppearance(uid, pump); + + DirtyUI(uid, pump); + _userInterfaceSystem.CloseUi(uid, GasVolumePumpUiKey.Key); + } + } + /// Corvax-Next-AutoPipes-End } } diff --git a/Content.Server/Atmos/Piping/Trinary/Components/GasMixerComponent.cs b/Content.Server/Atmos/Piping/Trinary/Components/GasMixerComponent.cs index fc219923c10..512f92ff69b 100644 --- a/Content.Server/Atmos/Piping/Trinary/Components/GasMixerComponent.cs +++ b/Content.Server/Atmos/Piping/Trinary/Components/GasMixerComponent.cs @@ -38,5 +38,10 @@ public sealed partial class GasMixerComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField("inletTwoConcentration")] public float InletTwoConcentration = 0.5f; + + /// Corvax-Next-AutoPipes-Start + [DataField] + public bool StartOnMapInit { get; set; } = false; + /// Corvax-Next-AutoPipes-Start } } diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 178caeaa4a9..cefa5d278ec 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -43,6 +43,8 @@ public override void Initialize() SubscribeLocalEvent(OnToggleStatusMessage); SubscribeLocalEvent(OnMixerLeaveAtmosphere); + + SubscribeLocalEvent(OnMapInit); // Corvax-Next-AutoPipes } private void OnInit(EntityUid uid, GasMixerComponent mixer, ComponentInit args) @@ -235,5 +237,19 @@ private void OnMixerAnalyzed(EntityUid uid, GasMixerComponent component, GasAnal args.DeviceFlipped = inletOne != null && inletTwo != null && inletOne.CurrentPipeDirection.ToDirection() == inletTwo.CurrentPipeDirection.ToDirection().GetClockwise90Degrees(); } + + // Corvax-Next-AutoPipes-Start + private void OnMapInit(EntityUid uid, GasMixerComponent mixer, MapInitEvent args) // Frontier - Init on map + { + if (mixer.StartOnMapInit) + { + mixer.Enabled = true; + DirtyUI(uid, mixer); + + UpdateAppearance(uid, mixer); + _userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key); + } + } + // Corvax-Next-AutoPipes-End } } diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/binary.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/binary.ftl new file mode 100644 index 00000000000..6e2534f2b99 --- /dev/null +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/binary.ftl @@ -0,0 +1,9 @@ +ent-GasPressurePumpOn = { ent-GasPressurePump } + .desc = { ent-GasPressurePump.desc } + .suffix = ВКЛ +ent-GasPressurePumpOnMax = { ent-GasPressurePump } + .desc = { ent-GasPressurePump.desc } + .suffix = ВКЛ, 4500 +ent-GasVolumePumpOn = { ent-GasVolumePump } + .desc = { ent-GasVolumePump.desc } + .suffix = ВКЛ diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/trinary.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/trinary.ftl new file mode 100644 index 00000000000..3d25e8f497e --- /dev/null +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/structures/piping/atmospherics/trinary.ftl @@ -0,0 +1,6 @@ +ent-GasMixerOn = { ent-GasMixer } + .desc = { ent-GasMixer.desc } + .suffix = ВКЛ +ent-GasMixerOnFlipped = { ent-GasMixerFlipped } + .desc = { ent-GasMixerFlipped.desc } + .suffix = ВКЛ, Перевёрнутый diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/binary.yml new file mode 100644 index 00000000000..290445acb87 --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/binary.yml @@ -0,0 +1,29 @@ +- type: entity + parent: GasPressurePump + id: GasPressurePumpOn + suffix: On + placement: + mode: SnapgridCenter + components: + - type: GasPressurePump + startOnMapInit: true + +- type: entity + parent: GasPressurePumpOn + id: GasPressurePumpOnMax + suffix: On, Max + placement: + mode: SnapgridCenter + components: + - type: GasPressurePump + targetPressure: 4500 + +- type: entity + parent: GasVolumePump + id: GasVolumePumpOn + suffix: On + placement: + mode: SnapgridCenter + components: + - type: GasVolumePump + startOnMapInit: true diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/trinary.yml b/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/trinary.yml new file mode 100644 index 00000000000..e38e070b1fc --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Entities/Structures/Piping/Atmospherics/trinary.yml @@ -0,0 +1,16 @@ +- type: entity + parent: GasMixer + id: GasMixerOn + suffix: On + placement: + mode: SnapgridCenter + components: + - type: GasMixer + startOnMapInit: true + +- type: entity + parent: [GasMixerFlipped, GasMixerOn] + id: GasMixerOnFlipped + suffix: On, Flipped + placement: + mode: SnapgridCenter From 9d1885c396a538a67e93a23600ee3c8069fd71f5 Mon Sep 17 00:00:00 2001 From: Vonsant Date: Tue, 24 Dec 2024 02:16:23 +0300 Subject: [PATCH 2/3] AutoPipesFix --- .../Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index b9989006527..2f0226ee4e3 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -182,4 +182,4 @@ private void OnMapInit(EntityUid uid, GasPressurePumpComponent pump, MapInitEven } /// Corvax-Next-AutoPipes-End } -} \ No newline at end of file +} From ebd648411583de74939b9e6716d7f07b56514564 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Tue, 24 Dec 2024 02:42:58 +0300 Subject: [PATCH 3/3] Update Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs Co-authored-by: FN <37689533+FireNameFN@users.noreply.github.com> --- .../Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index 52dac12e65e..596c9500bd0 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -53,7 +53,7 @@ public override void Initialize() SubscribeLocalEvent(OnPacketRecv); - SubscribeLocalEvent(OnMapInit); // Corvax-Next-AutoPipe + SubscribeLocalEvent(OnMapInit); // Corvax-Next-AutoPipes } private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args)