add: utility cvars on user requests
yb_quota_adding_interval yb_quota_maintain_interval yb_breakable_health_limit yb_object_destroy_radius
This commit is contained in:
parent
d22ff2466e
commit
9d6f823f1e
3 changed files with 12 additions and 4 deletions
|
|
@ -27,7 +27,9 @@ ConVar cv_freeze_bots ("yb_freeze_bots", "0", "If enabled, the bots think functi
|
|||
ConVar cv_spraypaints ("yb_spraypaints", "1", "Allows or disallows the use of spray paints.");
|
||||
ConVar cv_botbuy ("yb_botbuy", "1", "Allows or disallows bots weapon buying routines.");
|
||||
ConVar cv_destroy_breakables_around ("yb_destroy_breakables_around", "1", "Allows bots to destroy breakables around him, even without touching with them.");
|
||||
|
||||
ConVar cv_object_pickup_radius ("yb_object_pickup_radius", "450.0", "The radius on which bot searches world for new objects, items, and weapons.", true, 64.0f, 1024.0f);
|
||||
ConVar cv_object_destroy_radius ("yb_object_destroy_radius", "400.0", "The radius on which bot destroy breakables around him, when not touching with them.", true, 64.0f, 1024.0f);
|
||||
|
||||
ConVar cv_chatter_path ("yb_chatter_path", "sound/radio/bot", "Specifies the paths for the bot chatter sound files.", false);
|
||||
ConVar cv_restricted_weapons ("yb_restricted_weapons", "", "Specifies semicolon separated list of weapons that are not allowed to buy / pickup.", false);
|
||||
|
|
@ -403,6 +405,7 @@ void Bot::checkBreakablesAround () {
|
|||
if (!m_buyingFinished || !cv_destroy_breakables_around.bool_ () || usesKnife () || rg.chance (25) || !game.hasBreakables () || m_seeEnemyTime + 4.0f > game.time () || !game.isNullEntity (m_enemy) || !hasPrimaryWeapon ()) {
|
||||
return;
|
||||
}
|
||||
auto radius = cv_object_destroy_radius.float_ ();
|
||||
|
||||
// check if we're have some breakbles in 400 units range
|
||||
for (const auto &breakable : game.getBreakables ()) {
|
||||
|
|
@ -429,7 +432,7 @@ void Bot::checkBreakablesAround () {
|
|||
const auto lengthToObstacle = origin.distanceSq (pev->origin);
|
||||
|
||||
// too far, skip it
|
||||
if (lengthToObstacle > cr::square (400.0f)) {
|
||||
if (lengthToObstacle > cr::square (radius)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <yapb.h>
|
||||
|
||||
ConVar cv_csdm_mode ("yb_csdm_mode", "0", "Enables or disables CSDM / FFA mode for bots.\nAllowed values: '0', '1', '2', '3'.\nIf '0', CSDM / FFA mode is auto-detected.\nIf '1', CSDM mode is enabled, but FFA is disabled.\nIf '2', CSDM and FFA mode is enabled.\nIf '3', CSDM and FFA mode is disabled.", true, 0.0f, 3.0f);
|
||||
ConVar cv_breakable_health_limit ("yb_breakable_health_limit", "500.0", "Specifies the maximum health of breakable object, that bot will consider to destroy.", true, 1.0f, 3000.0);
|
||||
|
||||
ConVar sv_skycolor_r ("sv_skycolor_r", nullptr, Var::GameRef);
|
||||
ConVar sv_skycolor_g ("sv_skycolor_g", nullptr, Var::GameRef);
|
||||
|
|
@ -1031,8 +1032,9 @@ bool Game::isShootableBreakable (edict_t *ent) {
|
|||
if (isNullEntity (ent)) {
|
||||
return false;
|
||||
}
|
||||
auto limit = cv_breakable_health_limit.float_ ();
|
||||
|
||||
if (strcmp (ent->v.classname.chars (), "func_breakable") == 0 || (strcmp (ent->v.classname.chars (), "func_pushable") == 0 && (ent->v.spawnflags & SF_PUSH_BREAKABLE)) || (strcmp (ent->v.classname.chars (), "func_wall") == 0 && ent->v.health < 500.0f)) {
|
||||
if ((strcmp (ent->v.classname.chars (), "func_breakable") == 0 && ent->v.health < limit) || (strcmp (ent->v.classname.chars (), "func_pushable") == 0 && (ent->v.spawnflags & SF_PUSH_BREAKABLE) && ent->v.health < limit) || (strcmp (ent->v.classname.chars (), "func_wall") == 0 && ent->v.health < limit)) {
|
||||
if (ent->v.takedamage != DAMAGE_NO && ent->v.impulse <= 0 && !(ent->v.flags & FL_WORLDBRUSH) && !(ent->v.spawnflags & SF_BREAK_TRIGGER_ONLY)) {
|
||||
return (ent->v.movetype == MOVETYPE_PUSH || ent->v.movetype == MOVETYPE_PUSHSTEP);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ ConVar cv_botskin_ct ("yb_botskin_ct", "0", "Specifies the bots wanted skin for
|
|||
ConVar cv_ping_base_min ("yb_ping_base_min", "7", "Lower bound for base bot ping shown in scoreboard upon creation.", true, 0.0f, 100.0f);
|
||||
ConVar cv_ping_base_max ("yb_ping_base_max", "34", "Upper bound for base bot ping shown in scoreboard upon creation.", true, 0.0f, 100.0f);
|
||||
|
||||
ConVar cv_quota_adding_interval ("yb_quota_adding_interval", "0.10", "Interval in which bots are added to the game.", true, 0.10f, 1.0f);
|
||||
ConVar cv_quota_maintain_interval ("yb_quota_maintain_interval", "0.40", "Interval on which overall bot quota are checked.", true, 0.40f, 2.0f);
|
||||
|
||||
ConVar cv_language ("yb_language", "en", "Specifies the language for bot messages and menus.", false);
|
||||
|
||||
ConVar mp_limitteams ("mp_limitteams", nullptr, Var::GameRef);
|
||||
|
|
@ -361,7 +364,7 @@ void BotManager::maintainQuota () {
|
|||
m_addRequests.clear ();
|
||||
cv_quota.set (getBotCount ());
|
||||
}
|
||||
m_maintainTime = game.time () + 0.10f;
|
||||
m_maintainTime = game.time () + cv_quota_adding_interval.float_ ();
|
||||
}
|
||||
|
||||
// now keep bot number up to date
|
||||
|
|
@ -439,7 +442,7 @@ void BotManager::maintainQuota () {
|
|||
m_saveBotNames.clear ();
|
||||
}
|
||||
}
|
||||
m_quotaMaintainTime = game.time () + 0.40f;
|
||||
m_quotaMaintainTime = game.time () + cv_quota_maintain_interval.float_ ();
|
||||
}
|
||||
|
||||
void BotManager::maintainLeaders () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue