DamageableSystem cleanup & performance improvements (#20820)
This commit is contained in:
@@ -495,7 +495,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
var modifiedDamage = DamageSpecifier.ApplyModifierSets(damage + hitEvent.BonusDamage + attackedEvent.BonusDamage, hitEvent.ModifiersList);
|
||||
var damageResult = Damageable.TryChangeDamage(target, modifiedDamage, origin:user);
|
||||
|
||||
if (damageResult != null && damageResult.Total > FixedPoint2.Zero)
|
||||
if (damageResult != null && damageResult.Any())
|
||||
{
|
||||
// If the target has stamina and is taking blunt damage, they should also take stamina damage based on their blunt to stamina factor
|
||||
if (damageResult.DamageDict.TryGetValue("Blunt", out var bluntDamage))
|
||||
@@ -522,7 +522,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
{
|
||||
Audio.PlayPredicted(hitEvent.HitSoundOverride, meleeUid, user);
|
||||
}
|
||||
else if (GetDamage(meleeUid, user, component).Total.Equals(FixedPoint2.Zero) && component.HitSound != null)
|
||||
else if (!GetDamage(meleeUid, user, component).Any() && component.HitSound != null)
|
||||
{
|
||||
Audio.PlayPredicted(component.HitSound, meleeUid, user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user