From 14929571d0d4706199fe18599cc1cd7ef8816b19 Mon Sep 17 00:00:00 2001 From: qwerltaz <69696513+qwerltaz@users.noreply.github.com> Date: Tue, 5 Dec 2023 00:06:10 +0100 Subject: [PATCH] fix ghost command damage when in crit (#22134) * adjust kill damage on ghost command * tweaks * tweaks 2 argh * refactor, tweak --- .../GameTicking/GameTicker.GamePreset.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Content.Server/GameTicking/GameTicker.GamePreset.cs b/Content.Server/GameTicking/GameTicker.GamePreset.cs index 4ede91babc..5668625d37 100644 --- a/Content.Server/GameTicking/GameTicker.GamePreset.cs +++ b/Content.Server/GameTicking/GameTicker.GamePreset.cs @@ -7,9 +7,12 @@ using Content.Shared.CCVar; 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; @@ -17,6 +20,8 @@ namespace Content.Server.GameTicking { public sealed partial class GameTicker { + [Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!; + public const float PresetFailedCooldownIncrease = 30f; /// @@ -254,7 +259,17 @@ namespace Content.Server.GameTicking //todo: what if they dont breathe lol //cry deeply - DamageSpecifier damage = new(_prototypeManager.Index("Asphyxiation"), 200); + + FixedPoint2 dealtDamage = 200; + if (TryComp(playerEntity, out var damageable) + && TryComp(playerEntity, out var thresholds)) + { + var playerDeadThreshold = _mobThresholdSystem.GetThresholdForState(playerEntity.Value, MobState.Dead, thresholds); + dealtDamage = playerDeadThreshold - damageable.TotalDamage; + } + + DamageSpecifier damage = new(_prototypeManager.Index("Asphyxiation"), dealtDamage); + _damageable.TryChangeDamage(playerEntity, damage, true); } } -- 2.51.2