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