Move some checks in *AttackNotifier to improve performance
This commit is contained in:
@@ -47,10 +47,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
// only track last hit against our base
|
||||
if (!self.Info.HasTraitInfo<BuildingInfo>())
|
||||
return;
|
||||
|
||||
if (e.Attacker == null)
|
||||
return;
|
||||
|
||||
@@ -60,6 +56,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (e.Attacker == self.World.WorldActor)
|
||||
return;
|
||||
|
||||
// Only track last hit against our base
|
||||
if (!self.Info.HasTraitInfo<BuildingInfo>())
|
||||
return;
|
||||
|
||||
if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
// only track last hit against our harvesters
|
||||
if (!self.Info.HasTraitInfo<HarvesterInfo>())
|
||||
// Don't track self-damage
|
||||
if (e.Attacker != null && e.Attacker.Owner == self.Owner)
|
||||
return;
|
||||
|
||||
// don't track self-damage
|
||||
if (e.Attacker != null && e.Attacker.Owner == self.Owner)
|
||||
// Only track last hit against our harvesters
|
||||
if (!self.Info.HasTraitInfo<HarvesterInfo>())
|
||||
return;
|
||||
|
||||
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
|
||||
|
||||
Reference in New Issue
Block a user