Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Ethan Harris - 2019
- #include "cbase.h"
- #ifdef CLIENT_DLL
- #include "particles_new.h"
- #endif
- #include "in_buttons.h"
- #include "tier0\memdbgon.h"
- #ifdef CLIENT_DLL
- #define CWeaponLavaGun C_WeaponLavaGun
- #endif
- class CWeaponLavaGun : public CBaseCombatWeapon
- {
- DECLARE_CLASS(CWeaponLavaGun, CBaseCombatWeapon);
- DECLARE_NETWORKCLASS();
- DECLARE_PREDICTABLE();
- CWeaponLavaGun(void);
- public:
- void PrimaryAttack(void);
- void ItemPostFrame(void);
- void Precache(void);
- private:
- #ifdef CLIENT_DLL
- CNewParticleEffect *pParticle;
- #endif
- CWeaponLavaGun(const CWeaponLavaGun&);
- };
- IMPLEMENT_NETWORKCLASS_ALIASED(WeaponLavaGun, DT_WeaponLavaGun)
- BEGIN_NETWORK_TABLE(CWeaponLavaGun, DT_WeaponLavaGun)
- END_NETWORK_TABLE()
- BEGIN_PREDICTION_DATA(CWeaponLavaGun)
- END_PREDICTION_DATA()
- LINK_ENTITY_TO_CLASS(weapon_lavagun, CWeaponLavaGun)
- PRECACHE_REGISTER(CWeaponLavaGun)
- CWeaponLavaGun::CWeaponLavaGun(void)
- {
- m_bFiresUnderwater = false;
- #ifdef CLIENT_DLL
- // pParticle = ParticleProp()->Create("lava_spray", PATTACH_ABSORIGIN_FOLLOW, 0);
- #endif
- }
- void CWeaponLavaGun::PrimaryAttack(void)
- {
- #ifdef CLIENT_DLL
- static bool bInit = false;
- if (!bInit)
- {
- pParticle = ParticleProp()->Create("lava_spray", PATTACH_ABSORIGIN_FOLLOW, 0);
- bInit = true;
- }
- if (m_iClip1 > 0)
- {
- pParticle->StartEmission();
- }
- #endif
- }
- void CWeaponLavaGun::ItemPostFrame(void)
- {
- CBasePlayer *pPlayer = ToBasePlayer(GetOwner());
- if (!pPlayer)
- return;
- #ifndef CLIENT_DLL
- if (pPlayer->m_nButtons & IN_ATTACK)
- {
- if (m_iClip1 <= 0)
- pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
- else
- {
- m_iClip1--;
- DevMsg("Spraying!\n");
- }
- }
- #else
- if (pParticle)
- {
- if (m_iClip1 <= 0)
- pParticle->StopEmission();
- if (!(pPlayer->m_nButtons & IN_ATTACK))
- {
- pParticle->StopEmission();
- }
- }
- #endif
- BaseClass::ItemPostFrame();
- }
- void CWeaponLavaGun::Precache(void)
- {
- #ifdef CLIENT_DLL
- PrecacheParticleSystem("lava_spray");
- #endif
- BaseClass::Precache();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement