diff --git a/README.md b/README.md
index 040d3ecd..35b17dff 100644
--- a/README.md
+++ b/README.md
@@ -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)).
`0` dead don't hear alive
`1` no restrictions
`2` teammates hear each other
`3` Same as 2, but spectators hear everybody
`4` alive hear alive, dead hear dead and alive.
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot.
`0` disabled
`1` enable mode Deathmatch and not allow to do the scenario |
| bot_quota_mode | normal | - | - | Determines the type of quota.
`normal` default behaviour
`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)
diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp
index c5ba7358..28e24b25 100644
--- a/regamedll/dlls/game.cpp
+++ b/regamedll/dlls/game.cpp
@@ -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");
diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h
index b361f36e..e67daf87 100644
--- a/regamedll/dlls/game.h
+++ b/regamedll/dlls/game.h
@@ -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
diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h
index b1b46ff5..e86291fe 100644
--- a/regamedll/dlls/gamerules.h
+++ b/regamedll/dlls/gamerules.h
@@ -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();
diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp
index 82eeff37..ddcd9553 100644
--- a/regamedll/dlls/player.cpp
+++ b/regamedll/dlls/player.cpp
@@ -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;