Make Attack turn during its own tick
This commit is contained in:
@@ -209,9 +209,16 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (!attack.TargetInFiringArc(self, target, attack.Info.FacingTolerance))
|
||||
{
|
||||
var desiredFacing = (attack.GetTargetPosition(pos, target) - pos).Yaw;
|
||||
attackStatus |= AttackStatus.NeedsToTurn;
|
||||
QueueChild(new Turn(self, desiredFacing));
|
||||
return AttackStatus.NeedsToTurn;
|
||||
|
||||
// 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;
|
||||
return AttackStatus.NeedsToTurn;
|
||||
}
|
||||
}
|
||||
|
||||
attackStatus |= AttackStatus.Attacking;
|
||||
|
||||
Reference in New Issue
Block a user