diff --git a/cfg/addons/yapb/conf/custom.cfg b/cfg/addons/yapb/conf/custom.cfg index 89fc9ef..a4459dc 100644 --- a/cfg/addons/yapb/conf/custom.cfg +++ b/cfg/addons/yapb/conf/custom.cfg @@ -50,3 +50,11 @@ ZMDelayCvar = zp_delay ; Valid values: T, CT. ; ZMInfectedTeam = T + +; +; This decides if fake features (like a fake time, fake SID (avatar), fakeping +; should be enabled whitin bot code. By default it's off. To enable it you're +; should provide variable with: "i'm confident for what i'm doing" value. +; +EnableFakeBotFeatures = no + diff --git a/cfg/addons/yapb/conf/yapb.cfg b/cfg/addons/yapb/conf/yapb.cfg index 082424d..7e929aa 100644 --- a/cfg/addons/yapb/conf/yapb.cfg +++ b/cfg/addons/yapb/conf/yapb.cfg @@ -259,9 +259,9 @@ yb_chat_percent "30" // // Specifies whether bots able to fire at enemies behind the wall, if they hearing or suspecting them. // --- -// Default: "1", Min: "0", Max: "3" +// Default: "2", Min: "0", Max: "3" // -yb_shoots_thru_walls "1" +yb_shoots_thru_walls "2" // // Enables or disables searching world for enemies. @@ -333,6 +333,13 @@ yb_password "" // yb_password_key "_ybpw" +// +// Allows to use classic bot kill on issuing end-round command in menus, instead of gamedll endround. +// --- +// Default: "0" +// +yb_bots_kill_on_endround "0" + // // Enables or disables CSDM / FFA mode for bots. // Allowed values: '0', '1', '2', '3'. @@ -369,10 +376,38 @@ yb_grenadier_mode "0" // // Make bots ignore enemies for a specified here time in seconds on new round. Useful for Zombie Plague mods. // --- -// Default: "0", Min: "0", Max: "540" +// Default: "0" // yb_ignore_enemies_after_spawn_time "0" +// +// Lower bound for base bot ping shown in scoreboard upon creation. +// --- +// Default: "5", Min: "0", Max: "100" +// +yb_ping_base_min "5" + +// +// Upper bound for base bot ping shown in scoreboard upon creation. +// --- +// Default: "20", Min: "0", Max: "100" +// +yb_ping_base_max "20" + +// +// Count player pings when calculating average ping for bots. If no, some random ping chosen for bots. +// --- +// Default: "1", Min: "0", Max: "1" +// +yb_ping_count_real_players "1" + +// +// Interval in which fakeping get updated in scoreboard. +// --- +// Default: "1.2", Min: "0.1", Max: "10.0" +// +yb_ping_updater_interval "1.2" + // // Specifies whether bot should not 'fix' camp directions of camp waypoints when loading old PWF format. // --- @@ -540,9 +575,9 @@ yb_difficulty_auto_balance_interval "30" // // Enables or disables displaying bot avatars in front of their names in scoreboard. Note, that is currently you can see only avatars of your steam friends. // --- -// Default: "1", Min: "0", Max: "1" +// Default: "0", Min: "0", Max: "1" // -yb_show_avatars "1" +yb_show_avatars "0" // // Enables latency display in scoreboard. @@ -551,9 +586,9 @@ yb_show_avatars "1" // If '1', there is a 'BOT' is displayed. // If '2' fake ping is displayed. // --- -// Default: "2", Min: "0", Max: "2" +// Default: "0", Min: "0", Max: "2" // -yb_show_latency "2" +yb_show_latency "0" // // Allows to save bot names upon changelevel, so bot names will be the same after a map change. @@ -585,20 +620,6 @@ yb_botskin_ct "0" // yb_preferred_personality "none" -// -// Lower bound for base bot ping shown in scoreboard upon creation. -// --- -// Default: "7", Min: "0", Max: "100" -// -yb_ping_base_min "7" - -// -// Upper bound for base bot ping shown in scoreboard upon creation. -// --- -// Default: "34", Min: "0", Max: "100" -// -yb_ping_base_max "34" - // // Interval in which bots are added to the game. // --- @@ -711,13 +732,6 @@ yb_breakable_health_limit "500.0" // yb_enable_fake_steamids "0" -// -// Count player pings when calculating average ping for bots. If no, some random ping chosen for bots. -// --- -// Default: "1", Min: "0", Max: "1" -// -yb_count_players_for_fakeping "1" - // // Specifies whether bots able to use 'shift' if they thinks that enemy is near. // --- diff --git a/inc/engine.h b/inc/engine.h index 1398541..f7a97da 100644 --- a/inc/engine.h +++ b/inc/engine.h @@ -227,6 +227,9 @@ public: // print the version to server console on startup void printBotVersion (); + // ensure prosperous gaming environment as per: https://github.com/yapb/yapb/issues/575 + void ensureHealthyGameEnvironment (); + // public inlines public: // get the current time on server diff --git a/inc/yapb.h b/inc/yapb.h index 0d6ab89..499713c 100644 --- a/inc/yapb.h +++ b/inc/yapb.h @@ -887,6 +887,7 @@ extern ConVar cv_ignore_objectives; extern ConVar cv_chat; extern ConVar cv_language; extern ConVar cv_show_latency; +extern ConVar cv_show_avatars; extern ConVar cv_enable_query_hook; extern ConVar cv_chatter_path; extern ConVar cv_quota; diff --git a/src/config.cpp b/src/config.cpp index 4af04b8..334a771 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -670,6 +670,7 @@ void BotConfig::loadCustomConfig () { m_custom["ZMDetectCvar"] = "zp_delay"; m_custom["ZMDelayCvar"] = "zp_delay"; m_custom["ZMInfectedTeam"] = "T"; + m_custom["EnableFakeBotFeatures"] = "no"; }; setDefaults (); diff --git a/src/engine.cpp b/src/engine.cpp index c95e46b..87dffa8 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -72,6 +72,9 @@ void Game::levelInitialize (edict_t *entities, int max) { // execute main config conf.loadMainConfig (); + // ensure the server admin is confident about features he's using + game.ensureHealthyGameEnvironment (); + // load map-specific config conf.loadMapSpecificConfig (); @@ -1010,6 +1013,9 @@ void Game::slowFrame () { // refresh bomb origin in case some plugin moved it out graph.setBombOrigin (); + // ensure the server admin is confident about features he's using + game.ensureHealthyGameEnvironment (); + // update next update time m_halfSecondFrame = nextUpdate * 0.25f + time (); } @@ -1150,6 +1156,44 @@ void Game::printBotVersion () { ctrl.msg ("\n%s v%s successfully loaded for game: Counter-Strike %s.\n\tFlags: %s.\n", product.name, product.version, gameVersionStr, botRuntimeFlags.empty () ? "None" : String::join (botRuntimeFlags, ", ")); } +void Game::ensureHealthyGameEnvironment () { + if (!isDedicated ()) { + return; // listen servers doesn't care about it at all + } + + // magic string that's enable's the features + constexpr auto kAllowHash = StringRef::fnv1a32 ("i'm confident for what i'm doing"); + + // fetch custom variable, so fake features are explicitly enabled + static auto enableFakeFeatures = StringRef::fnv1a32 (conf.fetchCustom ("EnableFakeBotFeatures").chars ()); + + // if string matches, do not affect the cvars + if (enableFakeFeatures == kAllowHash) { + return; + } + + // disable fake latency + if (cv_show_latency.as () > 1) { + cv_show_latency.set (0); + + game.print ("Cvar \"%s_show_latency\" reverted to peaceful value.", product.cmdPri); + } + + // disable fake avatars + if (cv_show_avatars) { + cv_show_avatars.set (0); + + game.print ("Cvar \"%s_show_avatars\" reverted to peaceful value.", product.cmdPri); + } + + // disable fake queries + if (cv_enable_query_hook) { + cv_enable_query_hook.set (0); + + game.print ("Cvar \"%s_enable_query_hook\" reverted to peaceful value.", product.cmdPri); + } +} + void LightMeasure::initializeLightstyles () { // this function initializes lighting information... diff --git a/src/linkage.cpp b/src/linkage.cpp index db61fe2..cba1506 100644 --- a/src/linkage.cpp +++ b/src/linkage.cpp @@ -704,7 +704,7 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) { // using pfnMessageBegin (), it will know what message ID number to send, and the engine will // know what to do, only for non-metamod version - return msgs.add (name, engfuncs.pfnRegUserMsg (name, size)); // return privously registered message + return msgs.add (name, engfuncs.pfnRegUserMsg (name, size)); // return previously registered message }; } diff --git a/src/manager.cpp b/src/manager.cpp index 3e3447d..25cea3a 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -31,8 +31,9 @@ ConVar cv_difficulty_max ("difficulty_max", "-1", "Upper bound of random difficu ConVar cv_difficulty_auto ("difficulty_auto", "0", "Allows each bot to balance their own difficulty based kd-ratio of team.", true, 0.0f, 1.0f); ConVar cv_difficulty_auto_balance_interval ("difficulty_auto_balance_interval", "30", "Interval in which bots will balance their difficulty.", true, 30.0f, 240.0f); -ConVar cv_show_avatars ("show_avatars", "1", "Enables or disables displaying bot avatars in front of their names in scoreboard. Note, that is currently you can see only avatars of your steam friends."); -ConVar cv_show_latency ("show_latency", "2", "Enables latency display in scoreboard.\nAllowed values: '0', '1', '2'.\nIf '0', there is nothing displayed.\nIf '1', there is a 'BOT' is displayed.\nIf '2' fake ping is displayed.", true, 0.0f, 2.0f); +ConVar cv_show_avatars ("show_avatars", "0", "Enables or disables displaying bot avatars in front of their names in scoreboard. Note, that is currently you can see only avatars of your steam friends."); +ConVar cv_show_latency ("show_latency", "0", "Enables latency display in scoreboard.\nAllowed values: '0', '1', '2'.\nIf '0', there is nothing displayed.\nIf '1', there is a 'BOT' is displayed.\nIf '2' fake ping is displayed.", true, 0.0f, 2.0f); + ConVar cv_save_bots_names ("save_bots_names", "1", "Allows to save bot names upon changelevel, so bot names will be the same after a map change.", true, 0.0f, 1.0f); ConVar cv_botskin_t ("botskin_t", "0", "Specifies the bots wanted skin for Terrorist team.", true, 0.0f, 5.0f); diff --git a/src/support.cpp b/src/support.cpp index 2bd4f7d..0bc0faf 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -286,7 +286,7 @@ void BotSupport::checkWelcome () { " http://www.botepidemic.com/podbot for Updates\n"; // it's should be send in very rare cases - const bool sendLegacyWelcome = rg.chance (2); + const bool sendLegacyWelcome = rg.chance (game.is (GameFlags::Legacy) ? 25 : 2); if (!graphAuthor.startsWith (product.name)) { authorStr.assignf ("Navigation Graph by: %s", graphAuthor);