diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
index fc77a1c8d94..d55ef355f02 100644
--- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
@@ -153,9 +153,6 @@ public float GetFeltLowPressure(EntityUid uid, BarotraumaComponent barotrauma, f
return Math.Min(modified, Atmospherics.OneAtmosphere);
}
- ///
- /// Returns adjusted pressure after having applied resistances from equipment and innate (if any), to check against a high pressure hazard threshold
- ///
public float GetFeltHighPressure(EntityUid uid, BarotraumaComponent barotrauma, float environmentPressure)
{
if (barotrauma.HasImmunity)
@@ -226,69 +223,59 @@ public override void Update(float frameTime)
pressure = MathF.Max(mixture.Pressure, 1f);
}
- switch (pressure)
+ pressure = pressure switch
{
- // Low pressure.
- case <= Atmospherics.WarningLowPressure:
- pressure = GetFeltLowPressure(uid, barotrauma, pressure);
-
- if (pressure > Atmospherics.WarningLowPressure)
- goto default;
+ // Adjust pressure based on equipment. Works differently depending on if it's "high" or "low".
+ <= Atmospherics.WarningLowPressure => GetFeltLowPressure(uid, barotrauma, pressure),
+ >= Atmospherics.WarningHighPressure => GetFeltHighPressure(uid, barotrauma, pressure),
+ _ => pressure
+ };
+ if (pressure <= Atmospherics.HazardLowPressure)
+ {
+ // Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
+ _damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false);
+ if (!barotrauma.TakingDamage)
+ {
+ barotrauma.TakingDamage = true;
+ _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} started taking low pressure damage");
+ }
- // Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
- _damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false);
+ _alertsSystem.ShowAlert(uid, AlertType.LowPressure, 2);
+ }
+ else if (pressure >= Atmospherics.HazardHighPressure)
+ {
+ var damageScale = MathF.Min(((pressure / Atmospherics.HazardHighPressure) - 1) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
- if (!barotrauma.TakingDamage)
- {
- barotrauma.TakingDamage = true;
- _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} started taking low pressure damage");
- }
+ _damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false);
- if (pressure <= Atmospherics.HazardLowPressure)
- {
- _alertsSystem.ShowAlert(uid, AlertType.LowPressure, 2);
+ _alertsSystem.ShowAlert(uid, AlertType.HighPressure, 2);
+ }
+ else
+ {
+ // Within safe pressure limits
+ if (barotrauma.TakingDamage)
+ {
+ barotrauma.TakingDamage = false;
+ _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} stopped taking pressure damage");
+ }
+ if (!barotrauma.TakingDamage)
+ {
+ barotrauma.TakingDamage = true;
+ _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} started taking high pressure damage");
+ }
+ // Set correct alert.
+ switch (pressure)
+ {
+ case <= Atmospherics.WarningLowPressure:
+ _alertsSystem.ShowAlert(uid, AlertType.LowPressure, 1);
break;
- }
-
- _alertsSystem.ShowAlert(uid, AlertType.LowPressure, 1);
- break;
-
- // High pressure.
- case >= Atmospherics.WarningHighPressure:
- pressure = GetFeltHighPressure(uid, barotrauma, pressure);
-
- if (pressure < Atmospherics.WarningHighPressure)
- goto default;
-
- var damageScale = MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
-
- // Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
- _damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false);
-
- if (!barotrauma.TakingDamage)
- {
- barotrauma.TakingDamage = true;
- _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} started taking high pressure damage");
- }
-
- if (pressure >= Atmospherics.HazardHighPressure)
- {
- _alertsSystem.ShowAlert(uid, AlertType.HighPressure, 2);
+ case >= Atmospherics.WarningHighPressure:
+ _alertsSystem.ShowAlert(uid, AlertType.HighPressure, 1);
break;
- }
-
- _alertsSystem.ShowAlert(uid, AlertType.HighPressure, 1);
- break;
-
- // Normal pressure.
- default:
- if (barotrauma.TakingDamage)
- {
- barotrauma.TakingDamage = false;
- _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(uid):entity} stopped taking pressure damage");
- }
- _alertsSystem.ClearAlertCategory(uid, AlertCategory.Pressure);
- break;
+ default:
+ _alertsSystem.ClearAlertCategory(uid, AlertCategory.Pressure);
+ break;
+ }
}
}
}
diff --git a/Content.Shared/Atmos/Atmospherics.cs b/Content.Shared/Atmos/Atmospherics.cs
index 6a8587ca239..78b692d52de 100644
--- a/Content.Shared/Atmos/Atmospherics.cs
+++ b/Content.Shared/Atmos/Atmospherics.cs
@@ -271,7 +271,7 @@ public static class Atmospherics
public const float HazardLowPressure = 20f;
///
- /// The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT,
+ /// /// The amount of pressure damage someone takes is equal to ((pressure / HAZARD_HIGH_PRESSURE) - 1)*PRESSURE_DAMAGE_COEFFICIENT
/// with the maximum of MaxHighPressureDamage.
///
public const float PressureDamageCoefficient = 4;
diff --git a/Resources/Prototypes/Atmospherics/thresholds.yml b/Resources/Prototypes/Atmospherics/thresholds.yml
index 9b09d64a10c..22ca42869ed 100644
--- a/Resources/Prototypes/Atmospherics/thresholds.yml
+++ b/Resources/Prototypes/Atmospherics/thresholds.yml
@@ -12,13 +12,14 @@
- type: alarmThreshold
id: stationPressure
upperBound: !type:AlarmThresholdSetting
- threshold: 550 # as defined in Atmospherics.cs
+ threshold: 550 # HazardHighPressure from Atmospherics.cs
lowerBound: !type:AlarmThresholdSetting
- threshold: 20 # as defined in Atmospherics.cs
+ # Actual low pressure damage threshold is at 20 kPa, but below ~85 kPa you can't breathe due to lack of oxygen.
+ threshold: 20
upperWarnAround: !type:AlarmThresholdSetting
- threshold: 0.7
+ threshold: 0.7 # 385 kPa, WarningHighPressure from Atmospherics.cs
lowerWarnAround: !type:AlarmThresholdSetting
- threshold: 2.5
+ threshold: 1.05 # ~90 kPa
# a reminder that all of these are percentages (where 1 is 100%),
# so 0.01 is 1%,