DamageableSystem cleanup & performance improvements (#20820)

This commit is contained in:
Leon Friedrich
2023-10-09 03:27:41 +11:00
committed by GitHub
parent 70246ae10e
commit 364c9b7f0a
12 changed files with 135 additions and 77 deletions

View File

@@ -62,7 +62,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
var damageSpec = GetDamage(uid, args.User, component);
if (damageSpec.Total == FixedPoint2.Zero)
if (damageSpec.Empty)
return;
_damageExamine.AddDamageExamine(args.Message, damageSpec, Loc.GetString("damage-melee"));

View File

@@ -85,7 +85,7 @@ public sealed partial class GunSystem
{
var p = (ProjectileComponent) projectile.Component;
if (p.Damage.Total > FixedPoint2.Zero)
if (!p.Damage.Empty)
{
return p.Damage;
}

View File

@@ -37,7 +37,7 @@ public sealed partial class GunSystem
{
var p = (ProjectileComponent) projectile.Component;
if (p.Damage.Total > FixedPoint2.Zero)
if (!p.Damage.Empty)
{
return p.Damage;
}

View File

@@ -239,7 +239,7 @@ public sealed partial class GunSystem : SharedGunSystem
{
if (!Deleted(hitEntity))
{
if (dmg.Total > FixedPoint2.Zero)
if (dmg.Any())
{
_color.RaiseEffect(Color.Red, new List<EntityUid>() { hitEntity }, Filter.Pvs(hitEntity, entityManager: EntityManager));
}