From 723ffdf33d27cb95ab71f85ce8400f9a63034202 Mon Sep 17 00:00:00 2001 From: Gustas Date: Thu, 27 Jul 2023 23:15:34 +0300 Subject: [PATCH] Revert Hunt to move within 2 cells of the target Otherwise infantry get stuck within weapon range but outside of vision range --- OpenRA.Mods.Common/Activities/Hunt.cs | 10 ++-------- .../Scripting/Properties/CombatProperties.cs | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Hunt.cs b/OpenRA.Mods.Common/Activities/Hunt.cs index 7875ec0c10..e4d02b8370 100644 --- a/OpenRA.Mods.Common/Activities/Hunt.cs +++ b/OpenRA.Mods.Common/Activities/Hunt.cs @@ -40,14 +40,8 @@ namespace OpenRA.Mods.Common.Activities if (targetActor == null) return false; - var target = Target.FromActor(targetActor); - var range = self.TraitsImplementing().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; } diff --git a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs index 397290c49f..bee9368ed4 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs @@ -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));