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) if (targetActor == null)
return false; return false;
var target = Target.FromActor(targetActor); // We want to keep 2 cells of distance from the target to prevent the pathfinder from thinking the target position is blocked.
var range = self.TraitsImplementing<AttackBase>().Max(ab => ab.GetMaximumRangeVersusTarget(target)); QueueChild(new AttackMoveActivity(self, () => move.MoveWithinRange(Target.FromCell(self.World, targetActor.Location), WDist.FromCells(2))));
// 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)));
QueueChild(new Wait(25)); QueueChild(new Wait(25));
return false; return false;
} }

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
} }
[ScriptActorPropertyActivity] [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() public void Hunt()
{ {
Self.QueueActivity(new Hunt(Self)); Self.QueueActivity(new Hunt(Self));