Route delivered HQ tracks to temporary road interception and refresh playtest packages
This commit is contained in:
@@ -693,11 +693,14 @@ class ERR_HQ : ERR_CommandService
|
||||
if (!belief || belief.BeliefRevision != task.BeliefRevision
|
||||
|| !ERR_HQPursuitRules.Actionable(belief.Confidence, (now - belief.ObservedAt) / 1000, belief.Radius))
|
||||
{ LostOrder(unit, now); return; }
|
||||
if (task.RoadIntercept && !ERR_HQRoadIntercept.Eligible(belief, now)) { LostOrder(unit, now); return; }
|
||||
}
|
||||
if (Fighting(unit)) { LostOrder(unit, now); return; }
|
||||
int deliveryId;
|
||||
if (unit.Downlink) deliveryId = unit.Downlink.MessageId;
|
||||
AIWaypoint waypoint = AIWaypoint.Cast(ERR_Actors.Spawn(ERR_Resources.SearchWaypoint(), ERR_Actors.Ground(task.Destination)));
|
||||
ResourceName waypointResource = ERR_Resources.SearchWaypoint();
|
||||
if (task.RoadIntercept) waypointResource = ERR_Resources.DefendWaypoint();
|
||||
AIWaypoint waypoint = AIWaypoint.Cast(ERR_Actors.Spawn(waypointResource, ERR_Actors.Ground(task.Destination)));
|
||||
if (!waypoint) { LostOrder(unit, now); m_Journal.Write("ORDER FAILED", "waypoint spawn failed", order.MessageId); return; }
|
||||
unit.Release();
|
||||
unit.Task = task;
|
||||
@@ -715,7 +718,7 @@ class ERR_HQ : ERR_CommandService
|
||||
protected void Sweep(ERR_HQUnit unit, float now)
|
||||
{
|
||||
ERR_HQTask task = unit.Task;
|
||||
if (!task || !unit.Assignment || task.SweepQueued || !unit.Waypoint || !unit.Eligible(m_Mode)) return;
|
||||
if (!task || task.RoadIntercept || !unit.Assignment || task.SweepQueued || !unit.Waypoint || !unit.Eligible(m_Mode)) return;
|
||||
if (Fighting(unit) || vector.DistanceXZ(unit.Group.GetOrigin(), task.Destination) > 40)
|
||||
{ task.ArrivedAt = -1; return; }
|
||||
// Quiet combat state alone does not establish a negative search. Use this
|
||||
@@ -923,6 +926,7 @@ class ERR_HQ : ERR_CommandService
|
||||
int limit = ERR_HQPursuitRules.Limit(globalLimit);
|
||||
int radius = m_Mode.Settings().Get("responseRadiusMetres");
|
||||
int assigned = Assigned();
|
||||
int roadQueries;
|
||||
// Snapshot bounded own-force eligibility once per five-second planning pass.
|
||||
m_PlanBeliefs.Clear();
|
||||
for (int index = 0; index < m_Memory.Count(); index++) m_PlanBeliefs.Insert(m_Memory.At(index));
|
||||
@@ -987,6 +991,12 @@ class ERR_HQ : ERR_CommandService
|
||||
float age = (now - belief.ObservedAt) / 1000;
|
||||
ERR_HQPursuitRole role = ERR_HQPursuitRules.Role(belief.Confidence, age, belief.Radius, belief.HasVelocity, slot);
|
||||
vector destination = ERR_HQPursuitRules.Objective(belief.PredictedPosition, belief.Velocity, belief.HasVelocity, belief.Confidence, age, belief.Radius, role, slot);
|
||||
bool roadIntercept;
|
||||
if (role == ERR_HQPursuitRole.INTERCEPT)
|
||||
{
|
||||
if (roadQueries < 2) { roadQueries++; roadIntercept = ERR_HQRoadIntercept.Select(belief, now, reserved, destination); }
|
||||
if (!roadIntercept) role = ERR_HQPursuitRole.SEARCH;
|
||||
}
|
||||
if (role == ERR_HQPursuitRole.CONTAIN) destination = Containment(belief, destination);
|
||||
if (role == ERR_HQPursuitRole.SEARCH && !m_Coverage.Select(belief.PredictedPosition, belief.Radius, belief.Position, now, destination, reserved)) continue;
|
||||
ERR_HQUnit best;
|
||||
@@ -1011,7 +1021,7 @@ class ERR_HQ : ERR_CommandService
|
||||
}
|
||||
if (!best) continue;
|
||||
ERR_HQTask task = new ERR_HQTask();
|
||||
task.BeliefId = belief.BeliefId; task.BeliefRevision = belief.BeliefRevision; task.Role = role;
|
||||
task.BeliefId = belief.BeliefId; task.BeliefRevision = belief.BeliefRevision; task.Role = role; task.RoadIntercept = roadIntercept;
|
||||
task.Destination = destination; task.QueuedAt = now;
|
||||
task.ExpiresAt = now + ERR_HQPursuitRules.TaskLifetimeSeconds(role, vector.DistanceXZ(best.PlanPosition, destination)) * 1000;
|
||||
task.ApproachBearing = bestBearing;
|
||||
|
||||
Reference in New Issue
Block a user