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.2 KiB

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