Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "weapon_csbase.h"
  8. #include "gamerules.h"
  9. #include "npcevent.h"
  10. #include "engine/IEngineSound.h"
  11. #include "weapon_hegrenade.h"
  12. #ifdef CLIENT_DLL
  13. #else
  14. #include "cs_player.h"
  15. #include "items.h"
  16. #include "hegrenade_projectile.h"
  17. #endif
  18. #define GRENADE_TIMER 3.0f //Seconds
  19. IMPLEMENT_NETWORKCLASS_ALIASED( HEGrenade, DT_HEGrenade )
  20. BEGIN_NETWORK_TABLE(CHEGrenade, DT_HEGrenade)
  21. END_NETWORK_TABLE()
  22. BEGIN_PREDICTION_DATA( CHEGrenade )
  23. END_PREDICTION_DATA()
  24. LINK_ENTITY_TO_CLASS( weapon_hegrenade, CHEGrenade );
  25. PRECACHE_WEAPON_REGISTER( weapon_hegrenade );
  26. #ifndef CLIENT_DLL
  27. BEGIN_DATADESC( CHEGrenade )
  28. END_DATADESC()
  29. void CHEGrenade::EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer )
  30. {
  31. //=============================================================================
  32. // HPE_BEGIN:
  33. // [Forrest] Start a new bullet group so that damage dealt by the grenade will be counted as a separate hit from damage previously dealt.
  34. //=============================================================================
  35. #ifdef GAME_DLL
  36. CCSPlayer *pCSPlayer = ToCSPlayer( pPlayer );
  37. if ( pCSPlayer )
  38. {
  39. pCSPlayer->StartNewBulletGroup();
  40. }
  41. #endif
  42. //=============================================================================
  43. // HPE_END
  44. //=============================================================================
  45. CHEGrenadeProjectile::Create( vecSrc, vecAngles, vecVel, angImpulse, pPlayer, GRENADE_TIMER );
  46. }
  47. #endif