From d3974ee77bdd205d5b670298dfae323dc2323af2 Mon Sep 17 00:00:00 2001 From: Charlie Nolan Date: Thu, 30 May 2024 08:15:14 -0700 Subject: [PATCH] Don't try to calculate sound falloff at or below the minimum distance. (#25628) --- code/game/sound.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/sound.dm b/code/game/sound.dm index 23bf98cae01..f80daa18ac2 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -106,7 +106,7 @@ falloff_distance - Distance at which falloff begins. Sound is at peak volume (in distance *= distance_multiplier - if(max_distance) //If theres no max_distance we're not a 3D sound, so no falloff. + if(max_distance && distance > falloff_distance) //If theres no max_distance we're not a 3D sound, so no falloff. S.volume -= (max(distance - falloff_distance, 0) ** (1 / falloff_exponent)) / ((max(max_distance, distance) - falloff_distance) ** (1 / falloff_exponent)) * S.volume //https://www.desmos.com/calculator/sqdfl8ipgf