diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index d1d03797..021b41e4 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -829,14 +829,37 @@ void CCSBotManager::MaintainBotQuota() int desiredBotCount = int(cv_bot_quota.value); int occupiedBotSlots = UTIL_BotsInGame(); + // isRoundInProgress is true if the round has progressed far enough that new players will join as dead. + bool isRoundInProgress = CSGameRules()->IsGameStarted() && + !TheCSBots()->IsRoundOver() && + (CSGameRules()->GetRoundElapsedTime() >= CSGameRules()->GetRoundRespawnTime()); + #ifdef REGAMEDLL_ADD if (FStrEq(cv_bot_quota_mode.string, "fill")) { - desiredBotCount = Q_max(0, desiredBotCount - humanPlayersInGame); + // If bot_quota_mode is 'fill', we want the number of bots and humans together to equal bot_quota + // unless the round is already in progress, in which case we play with what we've been dealt + if (!isRoundInProgress) + { + desiredBotCount = Q_max(0, desiredBotCount - humanPlayersInGame); + } + else + { + desiredBotCount = occupiedBotSlots; + } } else if (FStrEq(cv_bot_quota_mode.string, "match")) { - desiredBotCount = Q_max(0, cv_bot_quota.value * humanPlayersInGame); + // If bot_quota_mode is 'match', we want the number of bots to be bot_quota * total humans + // unless the round is already in progress, in which case we play with what we've been dealt + if (!isRoundInProgress) + { + desiredBotCount = Q_max(0, cv_bot_quota.value * humanPlayersInGame); + } + else + { + desiredBotCount = occupiedBotSlots; + } } #else // #ifdef REGAMEDLL_ADD if (cv_bot_quota_match.value > 0.0) diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index d3a7cb3b..ad0812ee 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -634,6 +634,7 @@ public: float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; } float GetRoundRemainingTimeReal() const; float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; } + float GetRoundElapsedTime() const { return gpGlobals->time - m_fRoundStartTime; } BOOL TeamFull(int team_id); BOOL TeamStacked(int newTeam_id, int curTeam_id); @@ -668,6 +669,8 @@ public: float GetRoundRespawnTime() const; float GetRoundRestartDelay() const; + bool IsGameStarted() const { return m_bGameStarted; } + // has a style of gameplay when aren't any teams bool IsFreeForAll() const; bool CanPlayerBuy(CBasePlayer *pPlayer) const;