ZBot: Implemented cvar bot_freeze

This commit is contained in:
s1lent 2020-01-15 20:05:13 +07:00
parent 315d0d06f5
commit 80069a1f1e
5 changed files with 28 additions and 2 deletions

View File

@ -62,9 +62,10 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| 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_deathmatch | 0 | 0 | 1 | Sets 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. |
| bot_freeze | 0 | 0 | 1 | Prevents bots on your server from moving.<br/>`0` disabled<br/>`1` enabled |
| 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 |

9
dist/game.cfg vendored
View File

@ -172,7 +172,7 @@ mp_show_scenarioicon 0
// Default value: "1"
mp_old_bomb_defused_sound 1
// Set's the mode for the zBot
// Sets the mode for the zBot
// 0 - disabled
// 1 - enable mode Deathmatch and not allow to do the scenario
//
@ -192,6 +192,13 @@ bot_quota_mode "normal"
// Default value: "0"
bot_join_delay 0
// Prevents bots on your server from moving.
// 0 - disabled (default behavior)
// 1 - enabled
//
// Default value: "0"
bot_freeze 0
// Debug cvar shows triggers.
// 0 - disabled (default behaviour)
// 1 - enabled

View File

@ -61,6 +61,7 @@ cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVA
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 };
cvar_t cv_bot_freeze = { "bot_freeze", "0", 0, 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 };
@ -129,6 +130,7 @@ void Bot_RegisterCVars()
CVAR_REGISTER(&cv_bot_deathmatch);
CVAR_REGISTER(&cv_bot_quota_mode);
CVAR_REGISTER(&cv_bot_join_delay);
CVAR_REGISTER(&cv_bot_freeze);
#endif
}

View File

@ -61,6 +61,7 @@ extern cvar_t cv_bot_profile_db;
extern cvar_t cv_bot_deathmatch;
extern cvar_t cv_bot_quota_mode;
extern cvar_t cv_bot_join_delay;
extern cvar_t cv_bot_freeze;
#else
extern cvar_t cv_bot_quota_match;
#endif

View File

@ -31,6 +31,11 @@
// This method is the ONLY legal way to change a bot's current state
void CCSBot::SetState(BotState *state)
{
#ifdef REGAMEDLL_ADD
if (cv_bot_freeze.value && state != &m_idleState)
return;
#endif
PrintIfWatched("SetState: %s -> %s\n", m_state ? m_state->GetName() : "NULL", state->GetName());
// if we changed state from within the special Attack state, we are no longer attacking
@ -63,6 +68,11 @@ void CCSBot::Follow(CBasePlayer *pPlayer)
if (!pPlayer)
return;
#ifdef REGAMEDLL_ADD
if (cv_bot_freeze.value)
return;
#endif
// note when we began following
if (!m_isFollowing || m_leader != pPlayer)
m_followTimestamp = gpGlobals->time;
@ -270,6 +280,11 @@ bool CCSBot::TryToRetreat()
void CCSBot::Hunt()
{
#ifdef REGAMEDLL_ADD
if (cv_bot_freeze.value)
return;
#endif
SetState(&m_huntState);
}