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.

61 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. /*
  9. ===== item_longjump.cpp ========================================================
  10. handling for the longjump module
  11. */
  12. #include "cbase.h"
  13. #include "player.h"
  14. //#include "weapons.h"
  15. #include "gamerules.h"
  16. #include "items.h"
  17. class CItemLongJump : public CItem
  18. {
  19. public:
  20. DECLARE_CLASS( CItemLongJump, CItem );
  21. void Spawn( void )
  22. {
  23. Precache( );
  24. SetModel( "models/w_longjump.mdl" );
  25. BaseClass::Spawn( );
  26. }
  27. void Precache( void )
  28. {
  29. PrecacheModel ("models/w_longjump.mdl");
  30. }
  31. bool MyTouch( CBasePlayer *pPlayer )
  32. {
  33. if ( pPlayer->m_fLongJump )
  34. {
  35. return FALSE;
  36. }
  37. if ( pPlayer->IsSuitEquipped() )
  38. {
  39. pPlayer->m_fLongJump = TRUE;// player now has longjump module
  40. CSingleUserRecipientFilter user( pPlayer );
  41. user.MakeReliable();
  42. UserMessageBegin( user, "ItemPickup" );
  43. WRITE_STRING( STRING(pev->classname) );
  44. MessageEnd();
  45. UTIL_EmitSoundSuit( pPlayer->edict(), "!HEV_A1" ); // Play the longjump sound UNDONE: Kelly? correct sound?
  46. return true;
  47. }
  48. return false;
  49. }
  50. };
  51. LINK_ENTITY_TO_CLASS( item_longjump, CItemLongJump );