fix: breakable headache (ref #660)

fix: bots firing rates on short distances (ref #658)
This commit is contained in:
jeefo 2025-01-14 14:17:53 +03:00
commit c07d02c14e
No known key found for this signature in database
GPG key ID: D696786B81B667C8
9 changed files with 157 additions and 53 deletions

View file

@ -242,21 +242,19 @@ bool BotSupport::isHostageEntity (edict_t *ent) {
return classHash == kHostageEntity || classHash == kMonsterScientist;
}
bool BotSupport::isShootableBreakable (edict_t *ent) {
if (game.isNullEntity (ent) || ent == game.getStartEntity ()) {
return false;
bool BotSupport::isBreakableEntity (edict_t *ent, bool initialSeed) {
if (!initialSeed) {
if (!game.hasBreakables ()) {
return false;
}
}
// todo: move the breakables list into own array, and refresh them every round, since next thing is very expensive
#if 0
StringRef material = engfuncs.pfnInfoKeyValue (engfuncs.pfnGetInfoKeyBuffer (ent), "material");
if (material == "7") {
if (game.isNullEntity (ent) || ent == game.getStartEntity () || (!initialSeed && !game.isBreakableValid (ent))) {
return false;
}
#endif
const auto limit = cv_breakable_health_limit.as <float> ();
// not shootable
// not shoot-able
if (ent->v.health >= limit) {
return false;
}
@ -271,14 +269,12 @@ bool BotSupport::isShootableBreakable (edict_t *ent) {
return ent->v.movetype == MOVETYPE_PUSH || ent->v.movetype == MOVETYPE_PUSHSTEP;
}
}
return false;
}
bool BotSupport::isFakeClient (edict_t *ent) {
if (bots[ent] != nullptr || (!game.isNullEntity (ent) && (ent->v.flags & FL_FAKECLIENT))) {
return true;
}
return false;
return bots[ent] != nullptr || (!game.isNullEntity (ent) && (ent->v.flags & FL_FAKECLIENT));
}
void BotSupport::checkWelcome () {