Difference between revisions of "Dynamite Sapper"

From Team Fortress Wiki
Jump to: navigation, search
m (Auto: EnforceCapitalization(Sapper) (Review RC#2723647))
(how was it not noticed that this article still had source code snippets?)
Line 12: Line 12:
 
}}
 
}}
  
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.
+
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. The internal name for the attribute related to this weapon is <tt>sapper_explodes_on_det</tt>.
 
 
<!--Begin-->#ifdef STAGING_ONLY
 
  PrecacheScriptSound( "WeaponDynamiteSapper.TickTock" );
 
  PrecacheScriptSound( "WeaponDynamiteSapper.BellRing" );
 
#endif<!--End-->
 
 
 
<!--Begin-->#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<!--End-->
 
 
 
<!--Begin-->#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<!--End-->
 
  
 
{{Unused Content Nav}}
 
{{Unused Content Nav}}

Revision as of 12:48, 22 July 2021

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. The internal name for the attribute related to this weapon is sapper_explodes_on_det.