Revert Hunt to move within 2 cells of the target

Otherwise infantry get stuck within weapon range but outside of vision range
This commit is contained in:
Gustas
2023-07-27 23:15:34 +03:00
committed by Matthias Mailänder
parent 8376b09129
commit 723ffdf33d
2 changed files with 3 additions and 9 deletions

View File

@@ -40,14 +40,8 @@ namespace OpenRA.Mods.Common.Activities
if (targetActor == null)
return false;
var target = Target.FromActor(targetActor);
var range = self.TraitsImplementing<AttackBase>().Max(ab => ab.GetMaximumRangeVersusTarget(target));
// We want to keep at least 2 cells of distance from the target to prevent the pathfinder from thinking the target position is blocked.
if (range.Length < 2048)
range = WDist.FromCells(2);
QueueChild(new AttackMoveActivity(self, () => move.MoveWithinRange(Target.FromCell(self.World, targetActor.Location), range)));
// We want to keep 2 cells of distance from the target to prevent the pathfinder from thinking the target position is blocked.
QueueChild(new AttackMoveActivity(self, () => move.MoveWithinRange(Target.FromCell(self.World, targetActor.Location), WDist.FromCells(2))));
QueueChild(new Wait(25));
return false;
}

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
}
[ScriptActorPropertyActivity]
[Desc("Seek out and attack nearby targets.")]
[Desc("Ignoring visibility, find the closest hostile target and attack move to within 2 cells of it.")]
public void Hunt()
{
Self.QueueActivity(new Hunt(Self));