Skip to content

Commit

Permalink
[HL25] Hornetgun reloads every 0.3s in multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
sabianroberts committed Sep 23, 2024
1 parent e4f279e commit 3906949
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions binary/dlls/hornetgun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
#include "hornet.h"
#include "gamerules.h"

static float GetRechargeTime()
{
if (gpGlobals->maxClients > 1)
{
return 0.3f;
}
return 0.5f;
}


enum hgun_e {
HGUN_IDLE1 = 0,
Expand Down Expand Up @@ -144,7 +153,7 @@ void CHgun::PrimaryAttack()
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pHornet->pev->velocity = gpGlobals->v_forward * 300;

m_flRechargeTime = gpGlobals->time + 0.5;
m_flRechargeTime = gpGlobals->time + GetRechargeTime();
#endif

m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
Expand Down Expand Up @@ -173,6 +182,10 @@ void CHgun::PrimaryAttack()
{
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
}
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == 0)
{
m_flNextPrimaryAttack += GetRechargeTime();
}

m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
Expand Down Expand Up @@ -237,7 +250,7 @@ void CHgun::SecondaryAttack( void )

pHornet->SetThink( &CHornet::StartDart );

m_flRechargeTime = gpGlobals->time + 0.5;
m_flRechargeTime = gpGlobals->time + GetRechargeTime();
#endif

int flags;
Expand All @@ -258,6 +271,12 @@ void CHgun::SecondaryAttack( void )
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );

m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == 0)
{
m_flRechargeTime = gpGlobals->time + 0.5;
m_flNextSecondaryAttack += 0.5;
m_flNextPrimaryAttack += 0.5;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}

Expand All @@ -270,7 +289,7 @@ void CHgun::Reload( void )
while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time)
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
m_flRechargeTime += 0.5;
m_flRechargeTime += GetRechargeTime();
}
}

Expand Down

0 comments on commit 3906949

Please sign in to comment.