aim: do not pick enemies wearing FL_NOTARGET flag
This commit is contained in:
parent
085c4aab85
commit
6aabe20e95
2 changed files with 10 additions and 2 deletions
|
|
@ -813,6 +813,7 @@ private:
|
||||||
bool lookupEnemies ();
|
bool lookupEnemies ();
|
||||||
bool isEnemyHidden (edict_t *enemy);
|
bool isEnemyHidden (edict_t *enemy);
|
||||||
bool isEnemyInvincible (edict_t *enemy);
|
bool isEnemyInvincible (edict_t *enemy);
|
||||||
|
bool isEnemyNoTarget (edict_t *enemy);
|
||||||
bool isFriendInLineOfFire (float distance);
|
bool isFriendInLineOfFire (float distance);
|
||||||
bool isGroupOfEnemies (const Vector &location, int numEnemies = 1, float radius = 256.0f);
|
bool isGroupOfEnemies (const Vector &location, int numEnemies = 1, float radius = 256.0f);
|
||||||
bool isPenetrableObstacle (const Vector &dest);
|
bool isPenetrableObstacle (const Vector &dest);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ bool Bot::isEnemyInvincible (edict_t *enemy) {
|
||||||
if (!cv_check_enemy_invincibility.bool_ () || game.isNullEntity (enemy)) {
|
if (!cv_check_enemy_invincibility.bool_ () || game.isNullEntity (enemy)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
entvars_t &v = enemy->v;
|
const entvars_t &v = enemy->v;
|
||||||
|
|
||||||
if (v.solid < SOLID_BBOX) {
|
if (v.solid < SOLID_BBOX) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -109,10 +109,17 @@ bool Bot::isEnemyInvincible (edict_t *enemy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Bot::isEnemyNoTarget (edict_t *enemy) {
|
||||||
|
if (game.isNullEntity (enemy)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !!(enemy->v.flags & FL_NOTARGET);
|
||||||
|
}
|
||||||
|
|
||||||
bool Bot::checkBodyParts (edict_t *target) {
|
bool Bot::checkBodyParts (edict_t *target) {
|
||||||
// this function checks visibility of a bot target.
|
// this function checks visibility of a bot target.
|
||||||
|
|
||||||
if (isEnemyHidden (target) || isEnemyInvincible (target)) {
|
if (isEnemyHidden (target) || isEnemyInvincible (target) || isEnemyNoTarget (target)) {
|
||||||
m_enemyParts = Visibility::None;
|
m_enemyParts = Visibility::None;
|
||||||
m_enemyOrigin = nullptr;
|
m_enemyOrigin = nullptr;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue