Grenade::Use: Move #C4_Defuse_Must_Be_On_Ground to beginning of defusing.

This commit is contained in:
s1lent 2019-09-18 15:06:11 +07:00
parent bed4180d03
commit 22f5fe3831

View File

@ -1136,28 +1136,34 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
// TODO: We must be sure that the activator is a player.
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pActivator->pev);
#ifdef REGAMEDLL_FIXES
if (!pPlayer->IsPlayer())
return;
#endif
// For CTs to defuse the c4
if (pPlayer->m_iTeam != CT)
{
return;
}
#ifdef REGAMEDLL_FIXES
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;
}
#endif
if (m_bStartDefuse)
{
#ifdef REGAMEDLL_FIXES
if (m_pBombDefuser == pPlayer)
#endif
{
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;
}
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
}
#else
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
#endif // #ifdef REGAMEDLL_FIXES
return;
}
@ -1384,7 +1390,7 @@ void CGrenade::C4Think()
// If the timer has expired ! blow this bomb up!
#ifdef REGAMEDLL_FIXES
if(gpGlobals->time >= m_flC4Blow && (!(m_bStartDefuse && m_pBombDefuser) || gpGlobals->time < m_flDefuseCountDown)) // Prevent exploding after defusing.
if (gpGlobals->time >= m_flC4Blow && (!(m_bStartDefuse && m_pBombDefuser) || gpGlobals->time < m_flDefuseCountDown)) // Prevent exploding after defusing.
#else
if (gpGlobals->time >= m_flC4Blow)
#endif