Fix puncturase cauterizing bleeding (#38289)

fix puncturase cauterizing bleeding
This commit is contained in:
slarticodefast
2025-06-13 18:11:15 +02:00
committed by GitHub
parent 4f9e7fbc4d
commit ae8fdbfa51
3 changed files with 52 additions and 14 deletions

View File

@@ -205,10 +205,13 @@ public sealed class BloodstreamSystem : EntitySystem
}
// TODO probably cache this or something. humans get hurt a lot
if (!_prototypeManager.TryIndex<DamageModifierSetPrototype>(ent.Comp.DamageBleedModifiers, out var modifiers))
if (!_prototypeManager.TryIndex(ent.Comp.DamageBleedModifiers, out var modifiers))
return;
var bloodloss = DamageSpecifier.ApplyModifierSet(args.DamageDelta, modifiers);
// some reagents may deal and heal different damage types in the same tick, which means DamageIncreased will be true
// but we only want to consider the dealt damage when causing bleeding
var damage = DamageSpecifier.GetPositive(args.DamageDelta);
var bloodloss = DamageSpecifier.ApplyModifierSet(damage, modifiers);
if (bloodloss.Empty)
return;
@@ -227,7 +230,7 @@ public sealed class BloodstreamSystem : EntitySystem
var prob = Math.Clamp(totalFloat / 25, 0, 1);
if (totalFloat > 0 && _robustRandom.Prob(prob))
{
TryModifyBloodLevel(ent, (-total) / 5, ent);
TryModifyBloodLevel(ent, -total / 5, ent);
_audio.PlayPvs(ent.Comp.InstantBloodSound, ent);
}