nav: do not switch back to primary weapon, if escaping from bomb
revert: some of thread-workers stuff done previous commits due to stability issues
This commit is contained in:
parent
93d9187f6d
commit
bb6117feb0
6 changed files with 36 additions and 46 deletions
|
|
@ -1623,12 +1623,17 @@ void Bot::overrideConditions () {
|
|||
}
|
||||
}
|
||||
|
||||
void Bot::updatePredictedIndex () {
|
||||
void Bot::syncUpdatePredictedIndex () {
|
||||
auto wipePredict = [this] () {
|
||||
m_lastPredictIndex = kInvalidNodeIndex;
|
||||
m_lastPredictLength = kInfiniteDistanceLong;
|
||||
};
|
||||
|
||||
if (!m_predictLock.tryLock ()) {
|
||||
return; // allow only single instance of search per-bot
|
||||
}
|
||||
ScopedUnlock <Mutex> unlock (m_predictLock);
|
||||
|
||||
const auto lastEnemyOrigin = m_lastEnemyOrigin;
|
||||
const auto currentNodeIndex = m_currentNodeIndex;
|
||||
const auto &botOrigin = pev->origin;
|
||||
|
|
@ -1666,6 +1671,16 @@ void Bot::updatePredictedIndex () {
|
|||
wipePredict ();
|
||||
}
|
||||
|
||||
void Bot::updatePredictedIndex () {
|
||||
if (m_lastEnemyOrigin.empty ()) {
|
||||
return; // do not run task if no last enemy
|
||||
}
|
||||
|
||||
worker.enqueue ([this] () {
|
||||
syncUpdatePredictedIndex ();
|
||||
});
|
||||
}
|
||||
|
||||
void Bot::refreshEnemyPredict () {
|
||||
if (game.isNullEntity (m_enemy) && !game.isNullEntity (m_lastEnemy) && !m_lastEnemyOrigin.empty ()) {
|
||||
const auto distanceToLastEnemySq = m_lastEnemyOrigin.distanceSq (pev->origin);
|
||||
|
|
@ -1679,6 +1694,10 @@ void Bot::refreshEnemyPredict () {
|
|||
m_aimFlags |= AimFlags::LastEnemy;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_aimFlags & AimFlags::PredictPath) {
|
||||
updatePredictedIndex ();
|
||||
}
|
||||
}
|
||||
|
||||
void Bot::setConditions () {
|
||||
|
|
@ -3222,7 +3241,10 @@ void Bot::takeDamage (edict_t *inflictor, int damage, int armor, int bits) {
|
|||
// other player.
|
||||
|
||||
m_lastDamageType = bits;
|
||||
updatePracticeValue (damage);
|
||||
|
||||
if (!game.is (GameFlags::CSDM)) {
|
||||
updatePracticeValue (damage);
|
||||
}
|
||||
|
||||
if (util.isPlayer (inflictor) || (cv_attack_monsters.bool_ () && util.isMonster (inflictor))) {
|
||||
if (!util.isMonster (inflictor) && cv_tkpunish.bool_ () && game.getTeam (inflictor) == m_team && !util.isFakeClient (inflictor)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue