Make Attack turn during its own tick
This commit is contained in:
@@ -209,10 +209,17 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (!attack.TargetInFiringArc(self, target, attack.Info.FacingTolerance))
|
if (!attack.TargetInFiringArc(self, target, attack.Info.FacingTolerance))
|
||||||
{
|
{
|
||||||
var desiredFacing = (attack.GetTargetPosition(pos, target) - pos).Yaw;
|
var desiredFacing = (attack.GetTargetPosition(pos, target) - pos).Yaw;
|
||||||
|
|
||||||
|
// Don't queue a turn activity: Executing a child takes an additional tick during which the target may have moved again
|
||||||
|
facing.Facing = Util.TickFacing(facing.Facing, desiredFacing, facing.TurnSpeed);
|
||||||
|
|
||||||
|
// Check again if we turned enough and directly continue attacking if we did
|
||||||
|
if (!attack.TargetInFiringArc(self, target, attack.Info.FacingTolerance))
|
||||||
|
{
|
||||||
attackStatus |= AttackStatus.NeedsToTurn;
|
attackStatus |= AttackStatus.NeedsToTurn;
|
||||||
QueueChild(new Turn(self, desiredFacing));
|
|
||||||
return AttackStatus.NeedsToTurn;
|
return AttackStatus.NeedsToTurn;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attackStatus |= AttackStatus.Attacking;
|
attackStatus |= AttackStatus.Attacking;
|
||||||
DoAttack(self, attack, armaments);
|
DoAttack(self, attack, armaments);
|
||||||
|
|||||||
Reference in New Issue
Block a user