Counter Strike : Global Offensive Source Code
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.

117 lines
2.2 KiB

  1. //========= Copyright � 1996-2005, 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. pPlayer->RecalculateCurrentEquipmentValue();
  33. if ( pPlayer->IsAlive() )
  34. {
  35. CBroadcastRecipientFilter filter;
  36. if (pPlayer->GetTeamNumber() == TEAM_CT)
  37. {
  38. // Play the CT Suit sound
  39. EmitSound(filter, entindex(), "Player.EquipArmor_CT");
  40. }
  41. else
  42. {
  43. // Play the T Suit sound
  44. EmitSound(filter, entindex(), "Player.EquipArmor_T");
  45. }
  46. //EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
  47. }
  48. return true;
  49. }
  50. };
  51. LINK_ENTITY_TO_CLASS( item_assaultsuit, CItemAssaultSuit );
  52. class CItemHeavyAssaultSuit : public CItemAssaultSuit
  53. {
  54. // void Spawn( void )
  55. // {
  56. // Precache();
  57. // CItem::Spawn();
  58. // }
  59. // void Precache( void )
  60. // {
  61. // PrecacheScriptSound( "BaseCombatCharacter.ItemPickup2" );
  62. // }
  63. bool MyTouch( CBasePlayer *pBasePlayer )
  64. {
  65. CCSPlayer *pPlayer = dynamic_cast< CCSPlayer* >( pBasePlayer );
  66. if ( !pPlayer )
  67. {
  68. Assert( false );
  69. return false;
  70. }
  71. pPlayer->m_bHasHelmet = true;
  72. pPlayer->SetArmorValue( 200 );
  73. pPlayer->RecalculateCurrentEquipmentValue();
  74. pPlayer->m_bHasHeavyArmor = true;
  75. if ( pPlayer->IsAlive() )
  76. {
  77. CBroadcastRecipientFilter filter;
  78. if (pPlayer->GetTeamNumber() == TEAM_CT)
  79. {
  80. // Play the CT Suit sound
  81. pPlayer->EmitSound("Player.EquipArmor_CT");
  82. }
  83. else
  84. {
  85. // Play the T Suit sound
  86. pPlayer->EmitSound("Player.EquipArmor_T");
  87. }
  88. //EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
  89. }
  90. return true;
  91. }
  92. };
  93. LINK_ENTITY_TO_CLASS( item_heavyassaultsuit, CItemHeavyAssaultSuit );