From 40e5dfbedb4d4248ad3200ee45146c233e5bc6d7 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 17 Jun 2016 13:16:34 +0200 Subject: [PATCH] Fix helicopters not returning when all valid weapons are out of ammo They now return if all weapons are invalid (which includes those that are otherwise valid, but out of ammo) and at least one AmmoPool needs reloading at RearmBuilding. --- OpenRA.Mods.Common/Activities/Air/HeliAttack.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Air/HeliAttack.cs b/OpenRA.Mods.Common/Activities/Air/HeliAttack.cs index 9f245000bf..c8dd30e49a 100644 --- a/OpenRA.Mods.Common/Activities/Air/HeliAttack.cs +++ b/OpenRA.Mods.Common/Activities/Air/HeliAttack.cs @@ -65,9 +65,8 @@ namespace OpenRA.Mods.Common.Activities return ActivityUtils.SequenceActivities(new HeliFly(self, newTarget)); } - // If all ammo pools are depleted and none reload automatically, return to helipad to reload and then move to next activity - // TODO: This should check whether there is ammo left that is actually suitable for the target - if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo())) + // If any AmmoPool is depleted and no weapon is valid against target, return to helipad to reload and then move to next activity + if (ammoPools.Any(x => !x.Info.SelfReloads && !x.HasAmmo()) && !attackHeli.HasAnyValidWeapons(target)) return ActivityUtils.SequenceActivities(new HeliReturnToBase(self), NextActivity); var dist = target.CenterPosition - self.CenterPosition;