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.

58 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. /*
  9. ===== item_suit.cpp ========================================================
  10. handling for the player's suit.
  11. */
  12. #include "cbase.h"
  13. #include "player.h"
  14. #include "gamerules.h"
  15. #include "items.h"
  16. // memdbgon must be the last include file in a .cpp file!!!
  17. #include "tier0/memdbgon.h"
  18. #define SF_SUIT_SHORTLOGON 0x0001
  19. class CItemSuit : public CItem
  20. {
  21. public:
  22. DECLARE_CLASS( CItemSuit, CItem );
  23. void Spawn( void )
  24. {
  25. Precache( );
  26. SetModel( "models/items/hevsuit.mdl" );
  27. BaseClass::Spawn( );
  28. CollisionProp()->UseTriggerBounds( false, 0 );
  29. }
  30. void Precache( void )
  31. {
  32. PrecacheModel ("models/items/hevsuit.mdl");
  33. }
  34. bool MyTouch( CBasePlayer *pPlayer )
  35. {
  36. if ( pPlayer->IsSuitEquipped() )
  37. return FALSE;
  38. if ( m_spawnflags & SF_SUIT_SHORTLOGON )
  39. UTIL_EmitSoundSuit(pPlayer->edict(), "!HEV_A0"); // short version of suit logon,
  40. else
  41. UTIL_EmitSoundSuit(pPlayer->edict(), "!HEV_AAx"); // long version of suit logon
  42. pPlayer->EquipSuit();
  43. return true;
  44. }
  45. };
  46. LINK_ENTITY_TO_CLASS(item_suit, CItemSuit);