Fix attack behaviour of disabled units.
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
@@ -200,8 +201,16 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
attackStatus |= AttackStatus.Attacking;
|
attackStatus |= AttackStatus.Attacking;
|
||||||
attack.DoAttack(self, target, armaments);
|
DoAttack(self, attack, armaments);
|
||||||
|
|
||||||
return AttackStatus.Attacking;
|
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;
|
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;
|
return;
|
||||||
|
|
||||||
foreach (var a in armaments ?? Armaments)
|
foreach (var a in Armaments)
|
||||||
a.CheckFire(self, facing, target);
|
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)
|
public void AttackTarget(Target target, bool queued, bool allowMove, bool forceAttack = false)
|
||||||
{
|
{
|
||||||
if (IsTraitDisabled || IsTraitPaused)
|
if (IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.IsValidFor(self))
|
if (!target.IsValidFor(self))
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
|
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))
|
if (!CanAttack(self, target))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
Info = info;
|
Info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
|
public override void DoAttack(Actor self, Target target)
|
||||||
{
|
{
|
||||||
// This is so that the worm does not launch an attack against a target that has reached solid rock
|
// This is so that the worm does not launch an attack against a target that has reached solid rock
|
||||||
if (target.Type != TargetType.Actor || !CanAttack(self, target))
|
if (target.Type != TargetType.Actor || !CanAttack(self, target))
|
||||||
@@ -86,6 +86,11 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
targetIsHiddenActor = false;
|
targetIsHiddenActor = false;
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void DoAttack(Actor self, AttackFrontal attack, IEnumerable<Armament> armaments)
|
||||||
|
{
|
||||||
|
attack.DoAttack(self, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user