Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
37 lines
1.8 KiB
Diff
37 lines
1.8 KiB
Diff
--- a/addons/core/Scripts/Game/ERR/10_AI/ERR_InfantryResupply.c
|
|
+++ b/addons/core/Scripts/Game/ERR/10_AI/ERR_InfantryResupply.c
|
|
@@ -287,7 +287,7 @@
|
|
if (ERR_InfantryMineTransfer.ReadyMine(mine) && !m_Spent.Contains(mine) && Contains(m_Truck.Entity, mine)) { available = true; break; }
|
|
}
|
|
else if (launcherTrip) available = LauncherStock(recipient);
|
|
- else foreach (IEntity magazine : m_Stock) if (magazine && !m_Spent.Contains(magazine) && Contains(m_Truck.Entity, magazine)) { available = true; break; }
|
|
+ else available = CompatibleStock(recipient, false);
|
|
if (m_Spent.Count() >= 96) return false;
|
|
if (!available) return false;
|
|
m_Members.Clear();
|
|
@@ -334,7 +334,7 @@
|
|
}
|
|
// Compatibility-only preflight of original own carriers; HQ still uses the
|
|
// delivered report for demand and positions. No item is reserved or moved here.
|
|
- protected bool LauncherStock(ERR_HQUnit recipient)
|
|
+ protected bool CompatibleStock(ERR_HQUnit recipient, bool launcherMagazine)
|
|
{
|
|
if (!recipient || !recipient.StatusSampler || m_Stock.Count() > 96) return false;
|
|
int strength = recipient.StatusSampler.InitialStrength();
|
|
@@ -348,10 +348,14 @@
|
|
if (++checks > 96 * 32) return false;
|
|
IEntity actor = recipient.StatusSampler.InitialMember(slot);
|
|
if (!actor || !recipient.StatusSampler.CanAttribute(slot, actor) || !ERR_Actors.CanFight(actor)) continue;
|
|
- if (ERR_InfantryAmmoTransfer.Compatible(actor, magazine, true)) return true;
|
|
+ if (ERR_InfantryAmmoTransfer.Compatible(actor, magazine, launcherMagazine)) return true;
|
|
}
|
|
}
|
|
return false;
|
|
+ }
|
|
+ protected bool LauncherStock(ERR_HQUnit recipient)
|
|
+ {
|
|
+ return CompatibleStock(recipient, true);
|
|
}
|
|
bool TryPlanLauncher(ERR_HQUnit recipient, ERR_HQUnit donor, ERR_HQWatchEntry demand, ERR_HQWatchEntry donorStatus, float now)
|
|
{
|