Added a new CVar: "mp_item_staytime" - Time to remove item that have been dropped from the players. (#212)

This commit is contained in:
Shorohov Sergey 2017-11-13 01:20:08 +03:00 committed by Dmitry Novikov
parent 49198dc022
commit 411761c8d8
5 changed files with 27 additions and 5 deletions

View File

@ -46,6 +46,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 |
| mp_item_staytime | 300 | 0.1 | - | Time to remove item that have been dropped from the players. |
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

View File

@ -114,6 +114,7 @@ cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 0.0f,
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
void GameDLL_Version_f()
{
@ -265,6 +266,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&roundover);
CVAR_REGISTER(&forcerespawn);
CVAR_REGISTER(&show_radioicon);
CVAR_REGISTER(&item_staytime);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -150,6 +150,7 @@ extern cvar_t hostagehurtable;
extern cvar_t roundover;
extern cvar_t forcerespawn;
extern cvar_t show_radioicon;
extern cvar_t item_staytime;
#endif

View File

@ -43,6 +43,7 @@ const float WEAPON_RESPAWN_TIME = 20;
const float AMMO_RESPAWN_TIME = 20;
const float ROUND_RESPAWN_TIME = 20;
const float ROUND_BEGIN_DELAY = 5; // delay before beginning new round
const float ITEM_KILL_DELAY = 300;
const int MAX_INTERMISSION_TIME = 120; // longest the intermission can last, in seconds
@ -322,6 +323,7 @@ public:
// inline function's
inline bool IsGameOver() const { return m_bGameOver; }
inline void SetGameOver() { m_bGameOver = true; }
static float GetItemKillDelay();
public:
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
@ -865,6 +867,15 @@ inline bool HasRoundInfinite(int flags = 0)
return false;
}
inline float CGameRules::GetItemKillDelay()
{
#ifdef REGAMEDLL_ADD
return item_staytime.value;
#else
return ITEM_KILL_DELAY;
#endif
}
bool IsBotSpeaking();
void SV_Continue_f();
void SV_Tutor_Toggle_f();

View File

@ -1258,11 +1258,9 @@ void PackPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo)
// don't let weaponbox tilt.
pWeaponBox->pev->angles.x = 0;
pWeaponBox->pev->angles.z = 0;
pWeaponBox->pev->velocity = pPlayer->pev->velocity * 0.75f;
pWeaponBox->SetThink(&CWeaponBox::Kill);
pWeaponBox->pev->nextthink = gpGlobals->time + 300.0f;
pWeaponBox->pev->nextthink = gpGlobals->time + CGameRules::GetItemKillDelay();
pWeaponBox->PackWeapon(pItem); // now pack all of the items in the lists
// pack the ammo
@ -2117,7 +2115,16 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
{
m_bHasDefuser = false;
pev->body = 0;
#ifdef REGAMEDLL_FIXES
CItemThighPack *pDefuser = (CItemThighPack *)CBaseEntity::Create("item_thighpack", pev->origin, g_vecZero, ENT(pev));
pDefuser->SetThink(&CBaseEntity::SUB_Remove);
pDefuser->pev->nextthink = gpGlobals->time + CGameRules::GetItemKillDelay();
pDefuser->pev->spawnflags |= SF_NORESPAWN;
#else
GiveNamedItem("item_thighpack");
#endif
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev);
WRITE_BYTE(STATUSICON_HIDE);
@ -3043,7 +3050,7 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropShield)(bool bDeploy)
pShield->pev->angles.z = 0;
pShield->pev->velocity = gpGlobals->v_forward * 400;
pShield->SetThink(&CBaseEntity::SUB_Remove);
pShield->pev->nextthink = gpGlobals->time + 300;
pShield->pev->nextthink = gpGlobals->time + CGameRules::GetItemKillDelay();
pShield->SetCantBePickedUpByUser(this, 2.0);
return pShield;
@ -7409,7 +7416,7 @@ CBaseEntity *EXT_FUNC CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszIte
pWeaponBox->pev->angles.x = 0;
pWeaponBox->pev->angles.z = 0;
pWeaponBox->SetThink(&CWeaponBox::Kill);
pWeaponBox->pev->nextthink = gpGlobals->time + 300;
pWeaponBox->pev->nextthink = gpGlobals->time + CGameRules::GetItemKillDelay();
pWeaponBox->PackWeapon(pWeapon);
pWeaponBox->pev->velocity = gpGlobals->v_forward * 300 + gpGlobals->v_forward * 100;