Added check enemy invincibility
This commit is contained in:
parent
d5107daad4
commit
bcf727968d
3 changed files with 31 additions and 1 deletions
|
|
@ -151,6 +151,13 @@ yb_ignore_enemies "0"
|
||||||
//
|
//
|
||||||
yb_check_enemy_rendering "0"
|
yb_check_enemy_rendering "0"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enables or disables checking enemy invincibility. Useful for some mods.
|
||||||
|
// ---
|
||||||
|
// Default: "0", Min: "0", Max: "1"
|
||||||
|
//
|
||||||
|
yb_check_enemy_invincibility "0"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enables or disables bot ability to stab the enemy with knife if bot is in good condition.
|
// Enables or disables bot ability to stab the enemy with knife if bot is in good condition.
|
||||||
// ---
|
// ---
|
||||||
|
|
|
||||||
|
|
@ -801,6 +801,7 @@ private:
|
||||||
bool needToPauseFiring (float distance);
|
bool needToPauseFiring (float distance);
|
||||||
bool lookupEnemies ();
|
bool lookupEnemies ();
|
||||||
bool isEnemyHidden (edict_t *enemy);
|
bool isEnemyHidden (edict_t *enemy);
|
||||||
|
bool isEnemyInvincible (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);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
ConVar cv_shoots_thru_walls ("yb_shoots_thru_walls", "2", "Specifies whether bots able to fire at enemies behind the wall, if they hearing or suspecting them.", true, 0.0f, 2.0f);
|
ConVar cv_shoots_thru_walls ("yb_shoots_thru_walls", "2", "Specifies whether bots able to fire at enemies behind the wall, if they hearing or suspecting them.", true, 0.0f, 2.0f);
|
||||||
ConVar cv_ignore_enemies ("yb_ignore_enemies", "0", "Enables or disables searching world for enemies.");
|
ConVar cv_ignore_enemies ("yb_ignore_enemies", "0", "Enables or disables searching world for enemies.");
|
||||||
ConVar cv_check_enemy_rendering ("yb_check_enemy_rendering", "0", "Enables or disables checking enemy rendering flags. Useful for some mods.");
|
ConVar cv_check_enemy_rendering ("yb_check_enemy_rendering", "0", "Enables or disables checking enemy rendering flags. Useful for some mods.");
|
||||||
|
ConVar cv_check_enemy_invincibility ("yb_check_enemy_invincibility", "0", "Enables or disables checking enemy invincibility. Useful for some mods.");
|
||||||
ConVar cv_stab_close_enemies ("yb_stab_close_enemies", "1", "Enables or disables bot ability to stab the enemy with knife if bot is in good condition.");
|
ConVar cv_stab_close_enemies ("yb_stab_close_enemies", "1", "Enables or disables bot ability to stab the enemy with knife if bot is in good condition.");
|
||||||
|
|
||||||
ConVar mp_friendlyfire ("mp_friendlyfire", nullptr, Var::GameRef);
|
ConVar mp_friendlyfire ("mp_friendlyfire", nullptr, Var::GameRef);
|
||||||
|
|
@ -86,10 +87,31 @@ bool Bot::isEnemyHidden (edict_t *enemy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Bot::isEnemyInvincible (edict_t *enemy) {
|
||||||
|
if (!cv_check_enemy_invincibility.bool_ () || game.isNullEntity (enemy)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
entvars_t &v = enemy->v;
|
||||||
|
|
||||||
|
if (v.solid < SOLID_BBOX) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v.flags & FL_GODMODE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cr::fequal (v.takedamage, DAMAGE_NO)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
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)) {
|
if (isEnemyHidden (target) || isEnemyInvincible (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