mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
play only one weapon no ammo sound per second. #993
This commit is contained in:
parent
2948d2392b
commit
7eddbe0dc9
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue