From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Thu, 7 Sep 2023 05:37:23 +0000 (+0200) Subject: Add pressure limit to gas tanks (#19879) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=63c7bca04eb8bcfb4ce4aa4edafc9ded8c80d6a1;p=space-station-14.git Add pressure limit to gas tanks (#19879) --- diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index 82e6483ae4..5815fba489 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -47,6 +47,12 @@ namespace Content.Server.Atmos.Components [DataField("outputPressure"), ViewVariables(VVAccess.ReadWrite)] public float OutputPressure = DefaultOutputPressure; + /// + /// The maximum allowed output pressure. + /// + [DataField("maxOutputPressure"), ViewVariables(VVAccess.ReadWrite)] + public float MaxOutputPressure = 3 * DefaultOutputPressure; + /// /// Tank is connected to internals. /// diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index eea5e6cf53..cdd174ce18 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -69,7 +69,11 @@ namespace Content.Server.Atmos.EntitySystems private void OnGasTankSetPressure(EntityUid uid, GasTankComponent component, GasTankSetPressureMessage args) { - component.OutputPressure = args.Pressure; + var pressure = Math.Min(args.Pressure, component.MaxOutputPressure); + + component.OutputPressure = pressure; + + UpdateUserInterface(component, true); } public void UpdateUserInterface(GasTankComponent component, bool initialUpdate = false)