Fix Vaccinator charge sounds playing 2+ times/tick

Due to prediction, the PrimaryAttack() function runs multiple times every tick.
Every time the function runs on a tick where the player gains another charge, it will stack a copy of the sound that plays, which quickly becomes extremely loud. Commonly this will play 2 or 3, but in testing I've seen upwards of 7 or 8 playing at the same time.
This commit is contained in:
treacherousfiend
2025-02-24 01:58:44 -07:00
committed by EricS-Valve
parent f4536119bb
commit 70e325908b
+1 -1
View File
@@ -1357,7 +1357,7 @@ bool CWeaponMedigun::FindAndHealTargets( void )
}
#ifdef CLIENT_DLL
if ( GetMedigunType() == MEDIGUN_RESIST )
if ( GetMedigunType() == MEDIGUN_RESIST && prediction->IsFirstTimePredicted() )
{
// Play a sound when we tick over to a new charge level
int nChargeLevel = int(floor(flNewLevel/flMinChargeAmount));