bot: some fixes to enemy predictions again

This commit is contained in:
jeefo 2024-11-15 20:15:05 +03:00
commit 2d088efabe
No known key found for this signature in database
GPG key ID: D696786B81B667C8
7 changed files with 37 additions and 14 deletions

View file

@ -1772,7 +1772,9 @@ void Bot::syncUpdatePredictedIndex () {
planner.find (destIndex, currentNodeIndex, [&] (int index) {
++pathLength;
if (vistab.visible (currentNodeIndex, index) && botOrigin.distanceSq (graph[index].origin) < cr::sqrf (2048.0f)) {
const float distToBotSq = botOrigin.distanceSq (graph[index].origin);
if (vistab.visible (currentNodeIndex, index) && distToBotSq > 128.0f && distToBotSq < cr::sqrf (768.0f)) {
bestIndex = index;
return false;
}
@ -3976,6 +3978,14 @@ void Bot::updateHearing () {
m_hearedEnemy = nullptr;
float nearestDistanceSq = kInfiniteDistance;
// do not hear to other enemies if just tracked old one
if (m_timeNextTracking < game.time () && util.isAlive (m_lastEnemy) && m_lastEnemy == m_trackingEdict) {
m_hearedEnemy = m_lastEnemy;
m_lastEnemyOrigin = m_lastEnemy->v.origin;
return;
}
// setup potential visibility set from engine
auto set = game.getVisibilitySet (this, false);