From 8adbe1eaaa9c3f4230c082e6ba4731ded1dd89d4 Mon Sep 17 00:00:00 2001 From: treacherousfiend Date: Mon, 24 Feb 2025 01:58:44 -0700 Subject: [PATCH] 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. --- src/game/shared/tf/tf_weapon_medigun.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/tf/tf_weapon_medigun.cpp b/src/game/shared/tf/tf_weapon_medigun.cpp index ed55d29ef31..d681d09101c 100644 --- a/src/game/shared/tf/tf_weapon_medigun.cpp +++ b/src/game/shared/tf/tf_weapon_medigun.cpp @@ -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));