about summary refs log tree commit diff
path: root/src/game/server/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/server/entities')
-rw-r--r--src/game/server/entities/character.cpp7
-rw-r--r--src/game/server/entities/character.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index dc70641a..d7da2498 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -79,6 +79,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
 	}
     /* end zCatch */
 	
+	m_LastNoAmmoSound = -1;
 	m_QueuedWeapon = -1;
 
 	m_pPlayer = pPlayer;
@@ -293,7 +294,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;
 	}
 
diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h
index dae01bd4..8bd1d3da 100644
--- a/src/game/server/entities/character.h
+++ b/src/game/server/entities/character.h
@@ -100,6 +100,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;