From ecc969d8f444b2a513d7324074c430e7fd59b02c Mon Sep 17 00:00:00 2001 From: Bright0 <55061890+Bright0@users.noreply.github.com> Date: Wed, 9 Nov 2022 19:02:14 -0600 Subject: [PATCH] Internals alert fix and adjustment (#12517) * add low pressure data field * resolve CheckSeverity bug, replace logic * add configurable low pressure threshhold --- Content.Server/Atmos/Components/GasTankComponent.cs | 9 +++++++++ Content.Server/Body/Systems/InternalsSystem.cs | 6 +++--- .../Prototypes/Entities/Objects/Tools/gas_tanks.yml | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index 3b58794fd7..ddfa274357 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -8,9 +8,11 @@ namespace Content.Server.Atmos.Components public sealed class GasTankComponent : Component, IGasMixtureHolder { public const float MaxExplosionRange = 14f; + private const float DefaultLowPressure = 0f; private const float DefaultOutputPressure = Atmospherics.OneAtmosphere; public int Integrity = 3; + public bool IsLowPressure => (Air?.Pressure ?? 0F) <= TankLowPressure; [ViewVariables(VVAccess.ReadWrite), DataField("ruptureSound")] public SoundSpecifier RuptureSound = new SoundPathSpecifier("/Audio/Effects/spray.ogg"); @@ -32,6 +34,13 @@ namespace Content.Server.Atmos.Components [DataField("air")] [ViewVariables] public GasMixture Air { get; set; } = new(); + /// + /// Pressure at which tank should be considered 'low' such as for internals. + /// + [DataField("tankLowPressure")] + [ViewVariables] + public float TankLowPressure { get; set; } = DefaultLowPressure; + /// /// Distributed pressure. /// diff --git a/Content.Server/Body/Systems/InternalsSystem.cs b/Content.Server/Body/Systems/InternalsSystem.cs index 17d88dd179..c7072717c1 100644 --- a/Content.Server/Body/Systems/InternalsSystem.cs +++ b/Content.Server/Body/Systems/InternalsSystem.cs @@ -208,10 +208,10 @@ public sealed class InternalsSystem : EntitySystem { if (component.BreathToolEntity == null || !AreInternalsWorking(component)) return 2; - // What we are checking here is if there is more moles in tank than we need. + // If pressure in the tank is below low pressure threshhold, flash warning on internals UI if (TryComp(component.GasTankEntity, out var gasTank) - && (gasTank.OutputPressure * Atmospherics.BreathVolume / Atmospherics.R * gasTank.Air.Temperature) >= gasTank.Air.TotalMoles) - return 0; + && gasTank.IsLowPressure) + return 0; return 1; } diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index f52e3b8434..6f30dc4748 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity abstract: true parent: BaseItem id: GasTankBase @@ -44,6 +44,7 @@ air: volume: 70 temperature: 293.15 + tankLowPressure: 30.0 - type: Clothing sprite: Objects/Tanks/oxygen.rsi slots: