Skip to content

Commit

Permalink
Fix BarotraumaSystem (#694)
Browse files Browse the repository at this point in the history
# Description

This PR fixes an issue with the BarotraumaSystem which would constantly
report high pressure damage, even when no such damage was applied.

---

- [x] Tested High pressure damage correctly reported
- [x] Tested Low pressure damage correctly reported
- [x] Tested No pressure damage correctly reported

---

# Changelog

:cl:
- fix: Barotrauma admin log spam
  • Loading branch information
Fansana authored Aug 7, 2024
1 parent cf310f3 commit 69946f8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ public override void Update(float frameTime)
var damageScale = MathF.Min(((pressure / Atmospherics.HazardHighPressure) - 1) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);

_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");
}
_alertsSystem.ShowAlert(uid, AlertType.HighPressure, 2);
}
else
Expand All @@ -258,11 +262,6 @@ public override void Update(float frameTime)
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)
{
Expand Down

0 comments on commit 69946f8

Please sign in to comment.