From d22ff2466e88d8b1dd500ca97e53eace7ef5d84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D0=B2?= <22411953+Vladislav4KZ@users.noreply.github.com> Date: Mon, 13 Mar 2023 18:39:45 +0600 Subject: [PATCH] add: yb_kick_after_player_connect cvar (#416) --- src/manager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manager.cpp b/src/manager.cpp index 6314f1b..e5ca67d 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -8,6 +8,7 @@ #include ConVar cv_autovacate ("yb_autovacate", "1", "Kick bots to automatically make room for human players."); +ConVar cv_kick_after_player_connect ("yb_kick_after_player_connect", "1", "Kick the bot immediately when a human player joins the server (yb_autovacate must be enabled)."); ConVar cv_quota ("yb_quota", "9", "Specifies the number bots to be added to the game.", true, 0.0f, static_cast (kGameMaxPlayers)); ConVar cv_quota_mode ("yb_quota_mode", "normal", "Specifies the type of quota.\nAllowed values: 'normal', 'fill', and 'match'.\nIf 'fill', the server will adjust bots to keep N players in the game, where N is yb_quota.\nIf 'match', the server will maintain a 1:N ratio of humans to bots, where N is yb_quota_match.", false); @@ -394,7 +395,12 @@ void BotManager::maintainQuota () { int maxClients = game.maxClients (); if (cv_autovacate.bool_ ()) { - desiredBotCount = cr::min (desiredBotCount, maxClients - (humanPlayersInGame + 1)); + if (cv_kick_after_player_connect.bool_ ()) { + desiredBotCount = cr::min (desiredBotCount, maxClients - (totalHumansInGame + 1)); + } + else { + desiredBotCount = cr::min (desiredBotCount, maxClients - (humanPlayersInGame + 1)); + } } else { desiredBotCount = cr::min (desiredBotCount, maxClients - humanPlayersInGame);