/* ================== BotVisibleEnemies ================== */ int BotVisibleEnemies(bot_state_t *bs) { float vis; int i; aas_entityinfo_t entinfo; for (i = 0; i < MAX_CLIENTS; i++) { if (i == bs->client) continue; // BotEntityInfo(i, &entinfo); // if (!entinfo.valid) continue; //if the enemy isn't dead and the enemy isn't the bot self if (EntityIsDead(&entinfo) || entinfo.number == bs->entitynum) continue; //if the enemy is invisible and not shooting if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) { continue; } //if on the same team if (BotSameTeam(bs, i)) continue; //check if the enemy is visible vis = BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, i); if (vis > 0) return qtrue; } return qfalse; }
/* ======================================================================================================================================= BotVisibleEnemies ======================================================================================================================================= */ int BotVisibleEnemies(bot_state_t *bs) { int i; aas_entityinfo_t entinfo; for (i = 0; i < level.maxclients; i++) { if (i == bs->client) { continue; } // if on the same team if (BotSameTeam(bs, i)) { continue; } // get the entity information BotEntityInfo(i, &entinfo); // if this player is active if (!entinfo.valid) { continue; } // if the entity isn't the bot self if (entinfo.number == bs->entitynum) { continue; } // if the entity isn't dead if (EntityIsDead(&entinfo)) { continue; } // if the enemy is invisible if (EntityIsInvisible(&entinfo)) { continue; } // check if the enemy is visible if (BotEntityVisible(&bs->cur_ps, 360, i)) { return qtrue; } } return qfalse; }