Skip to content

Commit

Permalink
Added new cvar bot_join_delay
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jun 21, 2019
1 parent ad57e0a commit 555b08f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| sv_alltalk | 0 | 0 | 4 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot.<br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
| bot_quota_mode | normal | - | - | Determines the type of quota.<br/>`normal` default behaviour<br/>`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota<br/>`match` the server will maintain a `1:N` ratio of humans to bots, where `N` is bot_quota |
| bot_join_delay | 0 | - | - | Prevents bots from joining the server for this many seconds after a map change. |
| mp_item_staytime | 300 | - | - | Time to remove item that have been dropped from the players. |
| mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict. <br/>`0` New behavior<br/>`1` Legacy behavior|
| mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection |
Expand Down
5 changes: 5 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ bot_deathmatch 0
// Default value: "normal"
bot_quota_mode "normal"

// Prevents bots from joining the server for this many seconds after a map change.
//
// Default value: "0"
bot_join_delay 0

// Debug cvar shows triggers.
// 0 - disabled (default behaviour)
// 1 - enabled
Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/bot/cs_bot_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVA
#ifdef REGAMEDLL_ADD
cvar_t cv_bot_deathmatch = { "bot_deathmatch", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_quota_mode = { "bot_quota_mode", "normal", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_join_delay = { "bot_join_delay", "0", FCVAR_SERVER, 0.0f, nullptr };
#else
// Migrated to bot_quota_mode, use "match"
cvar_t cv_bot_quota_match = { "bot_quota_match", "0", FCVAR_SERVER, 0.0f, nullptr };
Expand Down Expand Up @@ -127,6 +128,7 @@ void Bot_RegisterCVars()
#ifdef REGAMEDLL_ADD
CVAR_REGISTER(&cv_bot_deathmatch);
CVAR_REGISTER(&cv_bot_quota_mode);
CVAR_REGISTER(&cv_bot_join_delay);
#endif

}
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/bot/cs_bot_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern cvar_t cv_bot_profile_db;
#ifdef REGAMEDLL_ADD
extern cvar_t cv_bot_deathmatch;
extern cvar_t cv_bot_quota_mode;
extern cvar_t cv_bot_join_delay;
#else
extern cvar_t cv_bot_quota_match;
#endif
9 changes: 9 additions & 0 deletions regamedll/dlls/bot/cs_bot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,15 @@ void CCSBotManager::MaintainBotQuota()
desiredBotCount = 0;
}

#ifdef REGAMEDLL_ADD
// wait until the map has been loaded for a bit, to allow players to transition across
// the transition without missing the pistol round
if (static_cast<int>(cv_bot_join_delay.value) > CSGameRules()->GetMapElapsedTime())
{
desiredBotCount = 0;
}
#endif

// if bots will auto-vacate, we need to keep one slot open to allow players to join
if (cv_bot_auto_vacate.value > 0.0)
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - (totalHumansInGame + 1));
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/gamerules.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ class CHalfLifeMultiplay: public CGameRules
float GetRoundRemainingTimeReal() const;
float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; }
float GetRoundElapsedTime() const { return gpGlobals->time - m_fRoundStartTime; }
float GetMapElapsedTime() const { return gpGlobals->time; }

BOOL TeamFull(int team_id);
BOOL TeamStacked(int newTeam_id, int curTeam_id);
Expand Down

0 comments on commit 555b08f

Please sign in to comment.