Integrate finite infantry resupply with delivered low-ammunition reports

This commit is contained in:
2026-09-20 07:32:24 +02:00
parent 915476f709
commit 782c163c68
44 changed files with 5690 additions and 31 deletions
@@ -113,6 +113,8 @@ class ERR_ConvoyVehicle
bool Released;
bool Registered;
ref ERR_ConvoyCombatState Combat = new ERR_ConvoyCombatState();
int SupplyToken;
bool SupplyHeld;
bool Arrived;
float LegDeadline;
float NextReadinessNote;
@@ -127,7 +129,7 @@ class ERR_ConvoyVehicle
{
if (Released) return;
Released = true;
Combat.Held = false;
Combat.Held = false; SupplyToken = 0; SupplyHeld = false;
ClearOrder();
if (mode && mode.Forces())
{
@@ -153,7 +155,7 @@ class ERR_ConvoyVehicle
}
bool Order(ERR_ForceRoute route, float now)
{
if (Released || Arrived || Combat.Held || !Group || !Entity || !route || RouteIndex >= route.Count()) return false;
if (Released || Arrived || Combat.Held || SupplyHeld || !Group || !Entity || !route || RouteIndex >= route.Count()) return false;
if (Waypoint) return true;
Waypoint = AIWaypoint.Cast(ERR_Actors.Spawn(ERR_Resources.MoveWaypoint(), route.At(RouteIndex)));
if (!Waypoint) return false;
@@ -166,7 +168,7 @@ class ERR_ConvoyVehicle
{
if (Released || Arrived) return;
if (!CrewValid(mode)) { Release(mode); return; }
if (Combat.Held) return;
if (Combat.Held || SupplyHeld) return;
// Native completion measures the seated group, not the vehicle origin.
// Keep the same predicate after native removal of the completed waypoint.
if (Waypoint && Waypoint.IsWithinCompletionRadius(Group))
@@ -419,7 +421,7 @@ class ERR_ConvoyService
else
{
unit.Combat.Held = false;
if (!unit.Order(task.Route, now)) { unit.Release(m_Mode); return false; }
if (!unit.SupplyHeld && !unit.Order(task.Route, now)) { unit.Release(m_Mode); return false; }
}
ERR_HQ.Event("CONVOY COVER", string.Format("command M%1 report M%2 vehicle=%3 held=%4 routeIndex=%5", order.CommandId, order.ReportId, unit.Index, unit.Combat.Held, unit.RouteIndex));
return true;