Integrate owned Intel rerolls, discovery feedback and fair HQ reports
This commit is contained in:
@@ -197,3 +197,39 @@ modded class SCR_AIGroupUtilityComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Owned AI adaptation: report distinct visible contacts fairly instead of
|
||||
// repeatedly choosing the first native perception entry. This is scheduling
|
||||
// history only; no positions, equipment or delivered HQ knowledge are retained.
|
||||
class ERR_HQReportSelection
|
||||
{
|
||||
protected ref array<IEntity> m_Recent = {};
|
||||
|
||||
ERR_HQVisualContact Select(array<ref ERR_HQVisualContact> samples)
|
||||
{
|
||||
ERR_HQVisualContact selected;
|
||||
int oldest = 64;
|
||||
foreach (ERR_HQVisualContact sample : samples)
|
||||
{
|
||||
if (!sample || !sample.Entity) continue;
|
||||
int index = m_Recent.Find(sample.Entity);
|
||||
if (!selected || index < oldest)
|
||||
{
|
||||
selected = sample;
|
||||
oldest = index;
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
// Call only once an uplink is actually queued. Failed delivery still counts
|
||||
// as an attempt, so an interrupted caller cannot starve other sightings.
|
||||
void Queued(IEntity target)
|
||||
{
|
||||
if (!target) return;
|
||||
for (int i = m_Recent.Count() - 1; i >= 0; i--)
|
||||
if (!m_Recent[i] || m_Recent[i] == target) m_Recent.Remove(i);
|
||||
if (m_Recent.Count() >= 64) m_Recent.Remove(0);
|
||||
m_Recent.Insert(target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user