Skip to content

Commit

Permalink
Fix c4 defuse glitch (rehlds#383)
Browse files Browse the repository at this point in the history
* [WIP] Fix c4 defuse glitch
While you are defusing you can unpress E and a friend can continue to defuse for you
  • Loading branch information
justgo97 authored and s1lentq committed Aug 13, 2019
1 parent 2defb8a commit 411a028
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions regamedll/dlls/ggrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 411a028

Please sign in to comment.