Fix attack behaviour of disabled units.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -200,8 +201,16 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
attackStatus |= AttackStatus.Attacking;
|
||||
attack.DoAttack(self, target, armaments);
|
||||
DoAttack(self, attack, armaments);
|
||||
|
||||
return AttackStatus.Attacking;
|
||||
}
|
||||
|
||||
protected virtual void DoAttack(Actor self, AttackFrontal attack, IEnumerable<Armament> armaments)
|
||||
{
|
||||
if (!attack.IsTraitPaused)
|
||||
foreach (var a in armaments)
|
||||
a.CheckFire(self, facing, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,12 +122,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
|
||||
public virtual void DoAttack(Actor self, Target target)
|
||||
{
|
||||
if (armaments == null && !CanAttack(self, target))
|
||||
if (!CanAttack(self, target))
|
||||
return;
|
||||
|
||||
foreach (var a in armaments ?? Armaments)
|
||||
foreach (var a in Armaments)
|
||||
a.CheckFire(self, facing, target);
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void AttackTarget(Target target, bool queued, bool allowMove, bool forceAttack = false)
|
||||
{
|
||||
if (IsTraitDisabled || IsTraitPaused)
|
||||
if (IsTraitDisabled)
|
||||
return;
|
||||
|
||||
if (!target.IsValidFor(self))
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
|
||||
}
|
||||
|
||||
public override void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
|
||||
public override void DoAttack(Actor self, Target target)
|
||||
{
|
||||
if (!CanAttack(self, target))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user