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;
}
if (m_bStartDefuse)
{
#ifdef REGAMEDLL_FIXES
if (m_pBombDefuser == pPlayer)
{
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
{
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
}
#else
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
#endif // #ifdef REGAMEDLL_FIXES
return;
}