99#include " asw_marine_resource.h"
1010#include " te_effect_dispatch.h"
1111#include " particle_parse.h"
12+ #include " EntityFlame.h"
1213#include " asw_player.h"
1314#include " asw_achievements.h"
1415#include " asw_boomer_blob.h"
@@ -51,6 +52,12 @@ BEGIN_DATADESC( CASW_Grenade_Vindicator )
5152 DEFINE_OUTPUT(m_OnDamaged, " OnDamaged" ),
5253END_DATADESC()
5354
55+ IMPLEMENT_NETWORKCLASS_ALIASED( ASW_Grenade_Vindicator, DT_ASW_Grenade_Vindicator )
56+
57+ BEGIN_NETWORK_TABLE( CASW_Grenade_Vindicator, DT_ASW_Grenade_Vindicator )
58+ SendPropVector( SENDINFO ( m_vecDetonateOrigin ) ),
59+ END_NETWORK_TABLE()
60+
5461extern int g_sModelIndexFireball; // (in combatweapon.cpp) holds the index for the smoke cloud
5562
5663CASW_Grenade_Vindicator::CASW_Grenade_Vindicator ()
@@ -76,10 +83,12 @@ void CASW_Grenade_Vindicator::Spawn( void )
7683 m_DmgRadius = 220 .0f ;
7784 m_bDamagedByExplosions = rd_vindicator_grenade_pushed_by_explosions.GetBool ();
7885
79- Ignite (3.0 , false , 0 , false );
86+ Ignite ( 3.0 , false , 0 , false );
8087
8188 m_takedamage = DAMAGE_YES ;
8289
90+ m_vecDetonateOrigin = Vector ( 0.0 , 0.0 , 0.0 );
91+
8392 SetSize ( -Vector (4 ,4 ,4 ), Vector (4 ,4 ,4 ) );
8493 SetSolid ( SOLID_BBOX );
8594 SetGravity ( asw_vindicator_grenade_gravity.GetFloat () );
@@ -232,6 +241,9 @@ void CASW_Grenade_Vindicator::Detonate()
232241 m_takedamage = DAMAGE_NO ;
233242
234243 StopSound ( " ASWGrenade.Alarm" );
244+
245+ m_vecDetonateOrigin = GetAbsOrigin ();
246+
235247 CPASFilter filter ( GetAbsOrigin () );
236248
237249 /*
@@ -245,15 +257,6 @@ void CASW_Grenade_Vindicator::Detonate()
245257 m_flDamage );
246258 */
247259
248- if ( !m_bSilent )
249- {
250- EmitSound ( " ASWGrenade.Incendiary" );
251- }
252- // throw out some flames
253- CEffectData data;
254- data.m_vOrigin = GetAbsOrigin ();
255- DispatchEffect ( " ASWFireBurst" , data );
256-
257260 Vector vecForward = GetAbsVelocity ();
258261 VectorNormalize (vecForward);
259262 trace_t tr;
@@ -345,7 +348,24 @@ void CASW_Grenade_Vindicator::Detonate()
345348 m_iClusters--;
346349 }
347350
348- UTIL_Remove ( this );
351+ // hack to remove the burning particles on the grenade itself
352+ // theres probably a better way but this has been bothering me for couple hours now
353+ CEntityFlame* pEntityFlame = dynamic_cast < CEntityFlame* >( GetEffectEntity () );
354+ if ( pEntityFlame )
355+ {
356+ pEntityFlame->AttachToEntity ( NULL );
357+ SetEffectEntity ( NULL );
358+ Extinguish ();
359+ }
360+
361+ SetModelIndex ( 0 );
362+ SetModelName ( NULL_STRING );
363+ SetTouch ( NULL );
364+ SetSolid ( SOLID_NONE );
365+
366+ // give time for m_vecDetonateOrigin to be sent to client so it can simulate the explosion effects
367+ SetThink ( &CASW_Grenade_Vindicator::SUB_Remove );
368+ SetNextThink ( gpGlobals->curtime + 2 .0f );
349369}
350370
351371void CASW_Grenade_Vindicator::Precache ()
@@ -360,6 +380,7 @@ void CASW_Grenade_Vindicator::Precache()
360380 PrecacheScriptSound (" ASWGrenade.Alarm" );
361381 PrecacheScriptSound (" Grenade.ImpactHard" );
362382 PrecacheParticleSystem ( " VindGrenade" );
383+ PrecacheParticleSystem ( " vindicator_grenade" );
363384 PrecacheParticleSystem ( " grenade_main_trail" );
364385}
365386
@@ -370,44 +391,10 @@ void CASW_Grenade_Vindicator::KillEffects()
370391
371392void CASW_Grenade_Vindicator::CreateEffects ()
372393{
373- // Start up the eye glow
374- /*
375- m_pMainGlow = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false );
376-
377- int nAttachment = LookupAttachment( "fuse" );
378-
379- if ( m_pMainGlow != NULL )
380- {
381- m_pMainGlow->FollowEntity( this );
382- m_pMainGlow->SetAttachment( this, nAttachment );
383- m_pMainGlow->SetTransparency( kRenderGlow, 255, 255, 255, 200, kRenderFxNoDissipation );
384- m_pMainGlow->SetScale( 0.2f );
385- m_pMainGlow->SetGlowProxySize( 4.0f );
386- }
387-
388- // Start up the eye trail
389- m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false );
390-
391- if ( m_pGlowTrail != NULL )
392- {
393- m_pGlowTrail->FollowEntity( this );
394- m_pGlowTrail->SetAttachment( this, nAttachment );
395- m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 0, 0, 255, kRenderFxNone );
396- m_pGlowTrail->SetStartWidth( 8.0f );
397- m_pGlowTrail->SetEndWidth( 1.0f );
398- m_pGlowTrail->SetLifeTime( 0.5f );
399- }
400- */
401-
402- CEffectData data;
403- data.m_vOrigin = GetAbsOrigin ();
404- // data.m_vNormal = dir;
405- // data.m_flScale = (float)amount;
406- CPASFilter filter ( data.m_vOrigin );
407- filter.SetIgnorePredictionCull (true );
408- DispatchParticleEffect ( " rocket_trail_small" , PATTACH_ABSORIGIN_FOLLOW , this , " fuse" , false , -1 , &filter );
394+
409395}
410396
397+
411398int CASW_Grenade_Vindicator::OnTakeDamage_Dying ( const CTakeDamageInfo &info )
412399{
413400 return BaseClass::OnTakeDamage_Dying (info);
0 commit comments