Fix c4 defuse glitch (#383)

* [WIP] Fix c4 defuse glitch
While you are defusing you can unpress E and a friend can continue to defuse for you
This commit is contained in:
justgo97 2019-08-13 23:25:38 +02:00 committed by Dmitry Novikov
parent 2defb8ad8e
commit 411a02843e

View File

@ -1021,9 +1021,9 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused)
// if the defuse process has ended, kill the c4
if (m_pBombDefuser->pev->deadflag == DEAD_NO)
{
#ifdef REGAMEDLL_ADD
#ifdef REGAMEDLL_ADD
if (!old_bomb_defused_sound.value)
#endif
#endif
{
Broadcast("BOMBDEF");
}
@ -1091,9 +1091,9 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused)
m_bStartDefuse = false;
m_pBombDefuser = nullptr;
#ifdef REGAMEDLL_FIXES
#ifdef REGAMEDLL_FIXES
pPlayer->SetProgressBarTime(0);
#endif
#endif
// tell the bots someone has aborted defusing
if (TheBots)
@ -1143,7 +1143,7 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
}
#ifdef REGAMEDLL_FIXES
if((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground
if ((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground
{
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground");
return;
@ -1152,7 +1152,12 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
if (m_bStartDefuse)
{
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
#ifdef REGAMEDLL_FIXES
if (m_pBombDefuser == pPlayer)
#endif
{
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
}
return;
}