diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index 28b9830d5..408862b74 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -418,6 +418,8 @@ bool CRpg::GetItemInfo(ItemInfo* p) bool CRpg::Deploy() { + m_fLaserSwitchReady = true; + if (m_iClip == 0) { return DefaultDeploy("models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW_UL, "rpg"); @@ -506,6 +508,12 @@ void CRpg::PrimaryAttack() void CRpg::SecondaryAttack() { + // switch the laser only once per a key press (not while holding). + if (!m_fLaserSwitchReady) + return; + + m_fLaserSwitchReady = false; + m_fSpotActive = !m_fSpotActive; #ifndef CLIENT_DLL @@ -520,6 +528,14 @@ void CRpg::SecondaryAttack() } +void CRpg::ItemPostFrame() +{ + m_fLaserSwitchReady |= (m_pPlayer->pev->button & IN_ATTACK2) == 0; + + CBasePlayerWeapon::ItemPostFrame(); +} + + void CRpg::WeaponIdle() { UpdateSpot(); diff --git a/dlls/weapons.h b/dlls/weapons.h index bdb18b7fe..6f1b95696 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -796,12 +796,14 @@ class CRpg : public CBasePlayerWeapon void PrimaryAttack() override; void SecondaryAttack() override; void WeaponIdle() override; + void ItemPostFrame() override; void UpdateSpot(); bool ShouldWeaponIdle() override { return true; } CLaserSpot* m_pSpot; bool m_fSpotActive; + bool m_fLaserSwitchReady; int m_cActiveRockets; // how many missiles in flight from this launcher right now? bool UseDecrement() override