play only one weapon no ammo sound per second. #993

This commit is contained in:
oy 2012-10-06 13:47:37 +02:00
parent 2948d2392b
commit 7eddbe0dc9
2 changed files with 7 additions and 1 deletions

View file

@ -56,6 +56,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
{
m_EmoteStop = -1;
m_LastAction = -1;
m_LastNoAmmoSound = -1;
m_ActiveWeapon = WEAPON_GUN;
m_LastWeapon = WEAPON_HAMMER;
m_QueuedWeapon = -1;
@ -270,7 +271,11 @@ void CCharacter::FireWeapon()
{
// 125ms is a magical limit of how fast a human can click
m_ReloadTimer = 125 * Server()->TickSpeed() / 1000;
GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);
if(m_LastNoAmmoSound+Server()->TickSpeed() <= Server()->Tick())
{
GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);
m_LastNoAmmoSound = Server()->Tick();
}
return;
}

View file

@ -97,6 +97,7 @@ private:
// last tick that the player took any action ie some input
int m_LastAction;
int m_LastNoAmmoSound;
// these are non-heldback inputs
CNetObj_PlayerInput m_LatestPrevInput;