diff --git a/Content.Server/Atmos/Components/BarotraumaComponent.cs b/Content.Server/Atmos/Components/BarotraumaComponent.cs index 9452ccd29f..15226fc5eb 100644 --- a/Content.Server/Atmos/Components/BarotraumaComponent.cs +++ b/Content.Server/Atmos/Components/BarotraumaComponent.cs @@ -16,5 +16,9 @@ namespace Content.Server.Atmos.Components [DataField("damage", required: true)] [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier Damage = default!; + + [DataField("maxDamage")] + [ViewVariables(VVAccess.ReadWrite)] + public int MaxDamage = 200; } } diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs index f72be55441..6259abdf7c 100644 --- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs @@ -1,4 +1,5 @@ using System; +using System.Data; using Content.Server.Alert; using Content.Server.Atmos.Components; using Content.Shared.Alert; @@ -68,8 +69,16 @@ namespace Content.Server.Atmos.EntitySystems _timer -= UpdateTimer; - foreach (var (barotrauma, transform) in EntityManager.EntityQuery()) + foreach (var (barotrauma, damageable, transform) in EntityManager.EntityQuery()) { + var totalDamage = 0; + foreach (var (barotraumaDamageType, _) in barotrauma.Damage.DamageDict) + { + totalDamage += damageable.Damage.DamageDict[barotraumaDamageType]; + } + if (totalDamage > barotrauma.MaxDamage) + continue; + var uid = barotrauma.Owner.Uid; var status = barotrauma.Owner.GetComponentOrNull();