Only consider non-paused armaments (if any exist) when determining min/max range.
This commit is contained in:
@@ -191,9 +191,19 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (armaments.Count == 0)
|
if (armaments.Count == 0)
|
||||||
return AttackStatus.UnableToAttack;
|
return AttackStatus.UnableToAttack;
|
||||||
|
|
||||||
// Update ranges
|
// Update ranges. Exclude paused armaments except when ALL weapons are paused
|
||||||
minRange = armaments.Max(a => a.Weapon.MinRange);
|
// (e.g. out of ammo), in which case use the paused, valid weapon with highest range.
|
||||||
maxRange = armaments.Min(a => a.MaxRange());
|
var activeArmaments = armaments.Where(x => !x.IsTraitPaused);
|
||||||
|
if (activeArmaments.Any())
|
||||||
|
{
|
||||||
|
minRange = activeArmaments.Max(a => a.Weapon.MinRange);
|
||||||
|
maxRange = activeArmaments.Min(a => a.MaxRange());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minRange = WDist.Zero;
|
||||||
|
maxRange = armaments.Max(a => a.MaxRange());
|
||||||
|
}
|
||||||
|
|
||||||
var pos = self.CenterPosition;
|
var pos = self.CenterPosition;
|
||||||
if (!target.IsInRange(pos, maxRange)
|
if (!target.IsInRange(pos, maxRange)
|
||||||
|
|||||||
Reference in New Issue
Block a user