Add maximum to barotrauma damage (#4989)
This commit is contained in:
@@ -16,5 +16,9 @@ namespace Content.Server.Atmos.Components
|
|||||||
[DataField("damage", required: true)]
|
[DataField("damage", required: true)]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public DamageSpecifier Damage = default!;
|
public DamageSpecifier Damage = default!;
|
||||||
|
|
||||||
|
[DataField("maxDamage")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int MaxDamage = 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Data;
|
||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
@@ -68,8 +69,16 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
_timer -= UpdateTimer;
|
_timer -= UpdateTimer;
|
||||||
|
|
||||||
foreach (var (barotrauma, transform) in EntityManager.EntityQuery<BarotraumaComponent, ITransformComponent>())
|
foreach (var (barotrauma, damageable, transform) in EntityManager.EntityQuery<BarotraumaComponent, DamageableComponent, ITransformComponent>())
|
||||||
{
|
{
|
||||||
|
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 uid = barotrauma.Owner.Uid;
|
||||||
|
|
||||||
var status = barotrauma.Owner.GetComponentOrNull<ServerAlertsComponent>();
|
var status = barotrauma.Owner.GetComponentOrNull<ServerAlertsComponent>();
|
||||||
|
|||||||
Reference in New Issue
Block a user