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.

56 lines
1.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "items.h"
  10. #include "cs_player.h"
  11. class CItemAssaultSuit : public CItem
  12. {
  13. void Spawn( void )
  14. {
  15. Precache( );
  16. CItem::Spawn( );
  17. }
  18. void Precache( void )
  19. {
  20. PrecacheScriptSound( "BaseCombatCharacter.ItemPickup2" );
  21. }
  22. bool MyTouch( CBasePlayer *pBasePlayer )
  23. {
  24. CCSPlayer *pPlayer = dynamic_cast< CCSPlayer* >( pBasePlayer );
  25. if ( !pPlayer )
  26. {
  27. Assert( false );
  28. return false;
  29. }
  30. pPlayer->m_bHasHelmet = true;
  31. pPlayer->SetArmorValue( 100 );
  32. if ( pPlayer->IsDead() == false )
  33. {
  34. CPASAttenuationFilter filter( pBasePlayer );
  35. EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
  36. CSingleUserRecipientFilter user( pPlayer );
  37. UserMessageBegin( user, "ItemPickup" );
  38. WRITE_STRING( "item_assaultsuit" );
  39. MessageEnd();
  40. }
  41. return true;
  42. }
  43. };
  44. LINK_ENTITY_TO_CLASS( item_assaultsuit, CItemAssaultSuit );