Add maximum and minimum range vs. target checks
This adresses the issue that actors would ignore the validity of weapons when deciding the attack distance versus a target. This could result in actors staying out of range of a weapon valid versus target if they carried a weapon with higher range but invalid versus target.
This commit is contained in:
@@ -82,12 +82,12 @@ namespace OpenRA.Mods.Common.Activities
|
||||
// Fly towards the target
|
||||
// TODO: Fix that the helicopter won't do anything if it has multiple weapons with different ranges
|
||||
// and the weapon with the longest range is out of ammo
|
||||
if (!target.IsInRange(self.CenterPosition, attackHeli.GetMaximumRange()))
|
||||
if (!target.IsInRange(self.CenterPosition, attackHeli.GetMaximumRangeVersusTarget(target)))
|
||||
helicopter.SetPosition(self, helicopter.CenterPosition + helicopter.FlyStep(desiredFacing));
|
||||
|
||||
// Fly backwards from the target
|
||||
// TODO: Same problem as with MaximumRange
|
||||
if (target.IsInRange(self.CenterPosition, attackHeli.GetMinimumRange()))
|
||||
if (target.IsInRange(self.CenterPosition, attackHeli.GetMinimumRangeVersusTarget(target)))
|
||||
{
|
||||
// Facing 0 doesn't work with the following position change
|
||||
var facing = 1;
|
||||
|
||||
Reference in New Issue
Block a user