From 7eddbe0dc9297e795ffdac65914f70ffcd43325a Mon Sep 17 00:00:00 2001 From: oy Date: Sat, 6 Oct 2012 13:47:37 +0200 Subject: play only one weapon no ammo sound per second. #993 --- src/game/server/entities/character.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/game/server/entities/character.cpp') diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 1c76f655..6794429d 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -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; } -- cgit 1.4.1