Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. // Ethan Harris - 2019
  2. #include "cbase.h"
  3. #ifdef CLIENT_DLL
  4. #include "particles_new.h"
  5. #endif
  6. #include "in_buttons.h"
  7. #include "tier0\memdbgon.h"
  8.  
  9. #ifdef CLIENT_DLL
  10. #define CWeaponLavaGun C_WeaponLavaGun
  11. #endif
  12.  
  13. class CWeaponLavaGun : public CBaseCombatWeapon
  14. {
  15. DECLARE_CLASS(CWeaponLavaGun, CBaseCombatWeapon);
  16. DECLARE_NETWORKCLASS();
  17. DECLARE_PREDICTABLE();
  18.  
  19. CWeaponLavaGun(void);
  20. public:
  21.  
  22. void PrimaryAttack(void);
  23. void ItemPostFrame(void);
  24.  
  25. void Precache(void);
  26. private:
  27. #ifdef CLIENT_DLL
  28. CNewParticleEffect *pParticle;
  29. #endif
  30. CWeaponLavaGun(const CWeaponLavaGun&);
  31. };
  32.  
  33. IMPLEMENT_NETWORKCLASS_ALIASED(WeaponLavaGun, DT_WeaponLavaGun)
  34.  
  35. BEGIN_NETWORK_TABLE(CWeaponLavaGun, DT_WeaponLavaGun)
  36. END_NETWORK_TABLE()
  37.  
  38. BEGIN_PREDICTION_DATA(CWeaponLavaGun)
  39. END_PREDICTION_DATA()
  40.  
  41. LINK_ENTITY_TO_CLASS(weapon_lavagun, CWeaponLavaGun)
  42. PRECACHE_REGISTER(CWeaponLavaGun)
  43.  
  44. CWeaponLavaGun::CWeaponLavaGun(void)
  45. {
  46. m_bFiresUnderwater = false;
  47. #ifdef CLIENT_DLL
  48. // pParticle = ParticleProp()->Create("lava_spray", PATTACH_ABSORIGIN_FOLLOW, 0);
  49. #endif
  50. }
  51.  
  52. void CWeaponLavaGun::PrimaryAttack(void)
  53. {
  54. #ifdef CLIENT_DLL
  55. static bool bInit = false;
  56. if (!bInit)
  57. {
  58. pParticle = ParticleProp()->Create("lava_spray", PATTACH_ABSORIGIN_FOLLOW, 0);
  59. bInit = true;
  60. }
  61.  
  62. if (m_iClip1 > 0)
  63. {
  64. pParticle->StartEmission();
  65. }
  66. #endif
  67. }
  68.  
  69. void CWeaponLavaGun::ItemPostFrame(void)
  70. {
  71. CBasePlayer *pPlayer = ToBasePlayer(GetOwner());
  72. if (!pPlayer)
  73. return;
  74. #ifndef CLIENT_DLL
  75. if (pPlayer->m_nButtons & IN_ATTACK)
  76. {
  77. if (m_iClip1 <= 0)
  78. pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
  79. else
  80. {
  81. m_iClip1--;
  82. DevMsg("Spraying!\n");
  83. }
  84. }
  85. #else
  86. if (pParticle)
  87. {
  88. if (m_iClip1 <= 0)
  89. pParticle->StopEmission();
  90.  
  91. if (!(pPlayer->m_nButtons & IN_ATTACK))
  92. {
  93. pParticle->StopEmission();
  94. }
  95. }
  96. #endif
  97. BaseClass::ItemPostFrame();
  98. }
  99.  
  100. void CWeaponLavaGun::Precache(void)
  101. {
  102. #ifdef CLIENT_DLL
  103. PrecacheParticleSystem("lava_spray");
  104. #endif
  105. BaseClass::Precache();
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement