mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-05 18:20:33 +03:00
Remove respawn dependency on forcerespawn cvar (#537)
* Remove respawn dependency on forcerespawn cvar Able to set custom respawn time for m_flRespawnPending without mp_forcerespawn enabled * workaround when disabling forcerespawn must stop works immediately * just block respawn then cvar disabled without reset for correct cvar logic
This commit is contained in:
parent
c6875e5b12
commit
a20362389e
@ -538,10 +538,12 @@ void CCSPlayer::Reset()
|
|||||||
m_iWeaponInfiniteAmmo = 0;
|
m_iWeaponInfiniteAmmo = 0;
|
||||||
m_iWeaponInfiniteIds = 0;
|
m_iWeaponInfiniteIds = 0;
|
||||||
m_bCanShootOverride = false;
|
m_bCanShootOverride = false;
|
||||||
|
m_bGameForcingRespawn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCSPlayer::OnSpawn()
|
void CCSPlayer::OnSpawn()
|
||||||
{
|
{
|
||||||
|
m_bGameForcingRespawn = false;
|
||||||
m_flRespawnPending = 0.0f;
|
m_flRespawnPending = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +552,7 @@ void CCSPlayer::OnKilled()
|
|||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
if (forcerespawn.value > 0)
|
if (forcerespawn.value > 0)
|
||||||
{
|
{
|
||||||
|
m_bGameForcingRespawn = true;
|
||||||
m_flRespawnPending = gpGlobals->time + forcerespawn.value;
|
m_flRespawnPending = gpGlobals->time + forcerespawn.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9935,10 +9935,13 @@ void CBasePlayer::PlayerRespawnThink()
|
|||||||
if (pev->deadflag < DEAD_DYING)
|
if (pev->deadflag < DEAD_DYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (forcerespawn.value > 0 &&
|
if (CSPlayer()->m_flRespawnPending > 0 &&
|
||||||
CSPlayer()->m_flRespawnPending > 0 &&
|
|
||||||
CSPlayer()->m_flRespawnPending <= gpGlobals->time)
|
CSPlayer()->m_flRespawnPending <= gpGlobals->time)
|
||||||
{
|
{
|
||||||
|
// Pending respawn caused by game doesn't respawn with disabled CVar
|
||||||
|
if (CSPlayer()->m_bGameForcingRespawn && !forcerespawn.value)
|
||||||
|
return;
|
||||||
|
|
||||||
Spawn();
|
Spawn();
|
||||||
pev->button = 0;
|
pev->button = 0;
|
||||||
pev->nextthink = -1;
|
pev->nextthink = -1;
|
||||||
|
@ -45,7 +45,8 @@ public:
|
|||||||
m_flSpawnProtectionEndTime(0),
|
m_flSpawnProtectionEndTime(0),
|
||||||
m_iWeaponInfiniteAmmo(0),
|
m_iWeaponInfiniteAmmo(0),
|
||||||
m_iWeaponInfiniteIds(0),
|
m_iWeaponInfiniteIds(0),
|
||||||
m_bCanShootOverride(false)
|
m_bCanShootOverride(false),
|
||||||
|
m_bGameForcingRespawn(false)
|
||||||
{
|
{
|
||||||
m_szModel[0] = '\0';
|
m_szModel[0] = '\0';
|
||||||
}
|
}
|
||||||
@ -123,6 +124,7 @@ public:
|
|||||||
int m_iWeaponInfiniteAmmo;
|
int m_iWeaponInfiniteAmmo;
|
||||||
int m_iWeaponInfiniteIds;
|
int m_iWeaponInfiniteIds;
|
||||||
bool m_bCanShootOverride;
|
bool m_bCanShootOverride;
|
||||||
|
bool m_bGameForcingRespawn;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inlines
|
// Inlines
|
||||||
|
Loading…
x
Reference in New Issue
Block a user