@@ -53,7 +53,42 @@ bool CClientExplosionManager::Hook_ExplosionCreation(CEntity* pGameExplodingEnti
5353 CClientEntity* const pResponsible = pPools->GetClientEntity (reinterpret_cast <DWORD*>(pResponsibleGameEntity->GetInterface ()));
5454
5555 if (!pResponsible)
56+ {
57+ if (pGameCreator)
58+ {
59+ CClientPlayer* pLocalPlayer = m_pManager->GetPlayerManager ()->GetLocalPlayer ();
60+ if (pLocalPlayer && pLocalPlayer->GetGameEntity () == pGameCreator)
61+ {
62+ eWeaponType explosionWeaponType = WEAPONTYPE_EXPLOSION;
63+ switch (explosionType)
64+ {
65+ case EXP_TYPE_GRENADE:
66+ explosionWeaponType = WEAPONTYPE_GRENADE;
67+ break ;
68+ case EXP_TYPE_MOLOTOV:
69+ explosionWeaponType = WEAPONTYPE_MOLOTOV;
70+ break ;
71+ case EXP_TYPE_ROCKET:
72+ case EXP_TYPE_ROCKET_WEAK:
73+ explosionWeaponType = WEAPONTYPE_ROCKET;
74+ break ;
75+ case EXP_TYPE_TANK_GRENADE:
76+ explosionWeaponType = WEAPONTYPE_TANK_GRENADE;
77+ break ;
78+ default :
79+ break ;
80+ }
81+
82+ CLuaArguments arguments;
83+ arguments.PushNumber (vecPosition.fX );
84+ arguments.PushNumber (vecPosition.fY );
85+ arguments.PushNumber (vecPosition.fZ );
86+ arguments.PushNumber (explosionWeaponType);
87+ return pLocalPlayer->CallEvent (" onClientExplosion" , arguments, true );
88+ }
89+ }
5690 return false ;
91+ }
5792
5893 // Determine the used weapon
5994 eWeaponType explosionWeaponType = WEAPONTYPE_EXPLOSION;
@@ -189,6 +224,23 @@ CExplosion* CClientExplosionManager::Create(eExplosionType explosionType, CVecto
189224 }
190225 }
191226
227+ if (pCreator && pCreator->IsLocalEntity ())
228+ {
229+ bool bAllowExplosion = Hook_ExplosionCreation (nullptr , pGameCreator, vecPosition, explosionType);
230+ if (!bAllowExplosion)
231+ return nullptr ;
232+ }
233+ else if (!pCreator)
234+ {
235+ CClientPlayer* pLocalPlayer = m_pManager->GetPlayerManager ()->GetLocalPlayer ();
236+ if (pLocalPlayer)
237+ {
238+ bool bAllowExplosion = Hook_ExplosionCreation (nullptr , pLocalPlayer->GetGameEntity (), vecPosition, explosionType);
239+ if (!bAllowExplosion)
240+ return nullptr ;
241+ }
242+ }
243+
192244 CExplosion* pExplosion = g_pGame->GetExplosionManager ()->AddExplosion (NULL , pGameCreator, explosionType, vecPosition, 0 , bMakeSound, fCamShake , bNoDamage);
193245 return pExplosion;
194246}
0 commit comments