fix: crash with lift handling

fix: some random crashes with some maps
fix: do not look at breakable until totally sure we're can break it
fix: wrong distance calculation in last enemy position randomizer
fix: problems with cs 1.5 won when built with ``nosmid`` switch (still crashes from time to time)
ctrl: add  bots death count to``yb list`` command
graph: disable buckets for small number of nodes graphs
graph: verify graph consistency and select appropriate pathfinding algorithm
misc: added mor vox sentences to welcome a player
This commit is contained in:
jeefo 2024-12-20 01:04:59 +03:00
commit 3a014e471b
No known key found for this signature in database
GPG key ID: D696786B81B667C8
13 changed files with 172 additions and 71 deletions

View file

@ -180,8 +180,9 @@ void Bot::checkBreakablesAround () {
|| !game.hasBreakables ()
|| m_seeEnemyTime + 4.0f > game.time ()
|| !game.isNullEntity (m_enemy)
|| !hasPrimaryWeapon ()) {
|| !hasPrimaryWeapon ()
|| (m_aimFlags & (AimFlags::Danger | AimFlags::PredictPath | AimFlags::Enemy))
|| getCurrentTaskId () != Task::Normal) {
return;
}
const auto radius = cv_object_destroy_radius.as <float> ();
@ -1751,9 +1752,9 @@ void Bot::syncUpdatePredictedIndex () {
}
ScopedUnlock <Mutex> unlock (m_predictLock);
const auto &botOrigin = pev->origin;
const auto &lastEnemyOrigin = m_lastEnemyOrigin;
const auto currentNodeIndex = m_currentNodeIndex;
const auto &botOrigin = pev->origin;
if (lastEnemyOrigin.empty () || !vistab.isReady () || !util.isAlive (m_lastEnemy)) {
wipePredict ();
@ -1763,7 +1764,7 @@ void Bot::syncUpdatePredictedIndex () {
const int destIndex = graph.getNearest (lastEnemyOrigin);
int bestIndex = m_currentNodeIndex;
if (destIndex == kInvalidNodeIndex) {
if (!isNodeValidForPredict (destIndex)) {
wipePredict ();
return;
}
@ -1781,16 +1782,17 @@ void Bot::syncUpdatePredictedIndex () {
return true;
});
if (bestIndex != currentNodeIndex) {
if (isNodeValidForPredict (bestIndex)) {
m_lastPredictIndex = bestIndex;
m_lastPredictLength = pathLength;
return;
}
wipePredict ();
}
void Bot::updatePredictedIndex () {
if (m_lastEnemyOrigin.empty () || !vistab.isReady () || !util.isAlive (m_lastEnemy)) {
if (!m_isAlive || m_lastEnemyOrigin.empty () || !vistab.isReady () || !util.isAlive (m_lastEnemy)) {
return; // do not run task if no last enemy
}
@ -4039,6 +4041,9 @@ void Bot::updateHearing () {
}
auto getHeardOriginWithError = [&] () -> Vector {
if (nearestDistanceSq > cr::sqrf (384.0f)) {
return m_hearedEnemy->v.origin;
}
auto error = kSprayDistance * cr::powf (nearestDistanceSq, 0.5f) / 2048.0f;
auto origin = m_hearedEnemy->v.origin;