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;
}
#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)
{
m_fNextDefuse = gpGlobals->time + 0.5f;
@ -965,13 +973,10 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator);
}
if (CSGameRules()->IsCareer())
{
if (TheCareerTasks)
if (CSGameRules()->IsCareer() && TheCareerTasks)
{
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
}
}
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
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_fNextDefuse = gpGlobals->time + 0.5f;
// start the progress bar
player->SetProgressBarTime(5);
@ -1004,22 +1002,22 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
// TODO: show messages on clients on event
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_fNextDefuse = gpGlobals->time + 0.5f;
// start the progress bar
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
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
}