Fixed: defuse can be started in air (#199)

* Fixed: defuse can be started in air
This commit is contained in:
In-line 2017-11-06 13:43:39 +04:00 committed by Dmitry Novikov
parent bfad492265
commit dd40f7db54

View File

@ -951,6 +951,14 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
return; return;
} }
#ifdef REGAMEDLL_FIXES
if((player->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground
{
ClientPrint(player->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground");
return;
}
#endif
if (m_bStartDefuse) if (m_bStartDefuse)
{ {
m_fNextDefuse = gpGlobals->time + 0.5f; m_fNextDefuse = gpGlobals->time + 0.5f;
@ -965,12 +973,9 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator); TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
} }
if (CSGameRules()->IsCareer()) if (CSGameRules()->IsCareer() && TheCareerTasks)
{ {
if (TheCareerTasks) TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
}
} }
if (player->m_bHasDefuser) if (player->m_bHasDefuser)
@ -982,15 +987,8 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
// TODO show messages on clients on event // TODO show messages on clients on event
ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit"); ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit");
#ifndef REGAMEDLL_FIXES
EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
#endif
player->m_bIsDefusing = true;
m_pBombDefuser = static_cast<CBasePlayer *>(pActivator);
m_bStartDefuse = true;
m_flDefuseCountDown = gpGlobals->time + 5.0f; m_flDefuseCountDown = gpGlobals->time + 5.0f;
m_fNextDefuse = gpGlobals->time + 0.5f;
// start the progress bar // start the progress bar
player->SetProgressBarTime(5); player->SetProgressBarTime(5);
@ -1004,22 +1002,22 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
// TODO: show messages on clients on event // TODO: show messages on clients on event
ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit"); ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit");
#ifndef REGAMEDLL_FIXES
EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
#endif
player->m_bIsDefusing = true;
m_pBombDefuser = static_cast<CBasePlayer *>(pActivator);
m_bStartDefuse = true;
m_flDefuseCountDown = gpGlobals->time + 10.0f; m_flDefuseCountDown = gpGlobals->time + 10.0f;
m_fNextDefuse = gpGlobals->time + 0.5f;
// start the progress bar // start the progress bar
player->SetProgressBarTime(10); player->SetProgressBarTime(10);
} }
player->m_bIsDefusing = true;
m_pBombDefuser = static_cast<CBasePlayer *>(pActivator);
m_bStartDefuse = true;
m_fNextDefuse = gpGlobals->time + 0.5f;
#ifdef REGAMEDLL_FIXES #ifdef REGAMEDLL_FIXES
EMIT_SOUND(edict(), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM); // Emit sound using bomb. EMIT_SOUND(edict(), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM); // Emit sound using bomb.
#else
EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
#endif #endif
} }