using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Database;
+using Content.Shared.FixedPoint;
using Content.Shared.Ghost;
using Content.Shared.Mind;
+using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
+using Content.Shared.Mobs.Systems;
using JetBrains.Annotations;
using Robust.Shared.Player;
{
public sealed partial class GameTicker
{
+ [Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
+
public const float PresetFailedCooldownIncrease = 30f;
/// <summary>
//todo: what if they dont breathe lol
//cry deeply
- DamageSpecifier damage = new(_prototypeManager.Index<DamageTypePrototype>("Asphyxiation"), 200);
+
+ FixedPoint2 dealtDamage = 200;
+ if (TryComp<DamageableComponent>(playerEntity, out var damageable)
+ && TryComp<MobThresholdsComponent>(playerEntity, out var thresholds))
+ {
+ var playerDeadThreshold = _mobThresholdSystem.GetThresholdForState(playerEntity.Value, MobState.Dead, thresholds);
+ dealtDamage = playerDeadThreshold - damageable.TotalDamage;
+ }
+
+ DamageSpecifier damage = new(_prototypeManager.Index<DamageTypePrototype>("Asphyxiation"), dealtDamage);
+
_damageable.TryChangeDamage(playerEntity, damage, true);
}
}