//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
float CWeaponCombatBurstRifle::GetFireRate( void )
{	
	if ( !inv_demo.GetFloat() )
	{
		float flFireRate = ( SequenceDuration() * 0.6f ) + SHARED_RANDOMFLOAT( 0.0, 0.035f );

		CBaseTFPlayer *pPlayer = static_cast<CBaseTFPlayer*>( GetOwner() );
		if ( pPlayer )
		{
			// Ducking players should fire more rapidly.
			if ( pPlayer->GetFlags() & FL_DUCKING )
			{
				flFireRate *= weapon_combat_burstrifle_ducking_mod.GetFloat();
			}
		}
		
		return flFireRate;
	}

	// Get the player and check to see if we are powered up.
	CBaseTFPlayer *pPlayer = ( CBaseTFPlayer* )GetOwner();
	if ( pPlayer && pPlayer->HasPowerup( POWERUP_BOOST ) )
	{
		return BURSTRIFLE_BOOSTED_FIRERATE;
	}

	return SHARED_RANDOMFLOAT( 0.075f, 0.15f );
}
Ejemplo n.º 2
0
void CWeaponG3SG1::G3SG1Fire( float flSpread, float flCycleTime, bool fUseAutoAim )
{
	CCSPlayer *pPlayer = GetPlayerOwner();

	if ( pPlayer->GetFOV() == 90 )
		flSpread += 0.025;

	// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
	if (m_flLastFire == 0)
	{
		m_flLastFire = gpGlobals->curtime;
	}
	else 
	{
		m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);	

		if (m_flAccuracy > 0.98)
			m_flAccuracy = 0.98;

		m_flLastFire = gpGlobals->curtime;
	}

	if ( !CSBaseGunFire( flSpread, flCycleTime ) )
		return;

	// Adjust the punch angle.
	QAngle angle = pPlayer->GetPunchAngle();
	angle.x -= SHARED_RANDOMFLOAT( 2.75, 3.25) + ( angle.x / 4 );
	angle.y += SHARED_RANDOMFLOAT( -1.25, 1.5);
	pPlayer->SetPunchAngle( angle );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
float CWeaponCombatLaserRifle::GetFireRate( void )
{	
	float flFireRate = ( SequenceDuration() * 0.4 ) + SHARED_RANDOMFLOAT( 0.0, 0.035f );

	CBaseTFPlayer *pPlayer = static_cast<CBaseTFPlayer*>( GetOwner() );
	if ( pPlayer )
	{
		// Ducking players should fire more rapidly.
		if ( pPlayer->GetFlags() & FL_DUCKING )
		{
			flFireRate *= weapon_combat_laserrifle_ducking_mod.GetFloat();
		}
	}
	
	return flFireRate;
}