Difference between revisions of "Dynamite Sapper"

From Team Fortress Wiki
Jump to: navigation, search
m (Better functionality snippet)
m
Line 12: Line 12:
 
}}
 
}}
  
The '''Dynamite Sapper''' is a scrapped Spy sapper, referenced in code in some places.
+
The '''Dynamite Sapper''' is a scrapped Spy sapper, referenced in code in some places. It would work similarly to other Sappers, only it would explode on detonation doing a large amount of damage to anyone unlucky enough to be in range.
  
 
  <!--Begin-->#ifdef STAGING_ONLY
 
  <!--Begin-->#ifdef STAGING_ONLY

Revision as of 03:48, 25 April 2020

The Dynamite Sapper is a scrapped Spy sapper, referenced in code in some places. It would work similarly to other Sappers, only it would explode on detonation doing a large amount of damage to anyone unlucky enough to be in range.

#ifdef STAGING_ONLY	
 PrecacheScriptSound( "WeaponDynamiteSapper.TickTock" );
 PrecacheScriptSound( "WeaponDynamiteSapper.BellRing" );
#endif
#ifdef STAGING_ONLY
 // // Attr on Det
 float flExplodeOnTimer = 0;
 CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( GetBuilder(), flExplodeOnTimer, sapper_explodes_on_det );
 if ( flExplodeOnTimer )
 {
     EmitSound( "Weapon_Sapper.Timer" );
     return "WeaponDynamiteSapper.TickTock";
 }
#endif
#ifdef STAGING_ONLY
 CTFPlayer *pBuilder = GetBuilder();
 if ( pBuilder && pParent->GetHealth() < 0 )
 {
     // Attr on Det
     float flExplodeOnTimer = 0;
     CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pBuilder, flExplodeOnTimer, sapper_explodes_on_det );

     if ( flExplodeOnTimer )
     {
         float flDamage = pParent->GetMaxHealth() * 1.5;
         Vector vecOrigin = GetAbsOrigin();

         // Use the building as the det position         
         CTakeDamageInfo detInfo;
         detInfo.SetDamage( flDamage );
         detInfo.SetAttacker( this );
         detInfo.SetInflictor( this );
         detInfo.SetDamageType( DMG_BLAST );

         // Generate Large Radius Damage
         float flRadius = 200.0f;
         CTFRadiusDamageInfo radiusinfo( &detInfo, vecOrigin, flRadius, NULL, flRadius );
         TFGameRules()->RadiusDamage( radiusinfo );

         DispatchParticleEffect( "explosionTrail_seeds_mvm", vecOrigin, GetAbsAngles() );
     }
 }
#endif