From 449a391dc508d75156027a84c93203d16915d893 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Sun, 1 Dec 2013 18:51:29 +0000 Subject: [PATCH] Reduces the amount of get_turf calls. Removes random noises. --- code/game/sound.dm | 12 ++++++------ code/modules/mob/living/carbon/human/life.dm | 6 ------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/code/game/sound.dm b/code/game/sound.dm index c2f9e9fca02..cf876319587 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -7,21 +7,22 @@ return var/frequency = get_rand_frequency() // Same frequency for everybody + var/turf/turf_source = get_turf(source) // Looping through the player list has the added bonus of working for mobs inside containers for (var/P in player_list) var/mob/M = P if(!M || !M.client) continue - var/turf/T = get_turf(M) - if(T && T.z == source.z) - if(get_dist(T, source) <= world.view + extrarange) - M.playsound_local(source, soundin, vol, vary, frequency, falloff) + if(get_dist(M, turf_source) <= world.view + extrarange) + var/turf/T = get_turf(M) + if(T && T.z == turf_source.z) + M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff) var/const/FALLOFF_SOUNDS = 1 var/const/SURROUND_CAP = 7 -/mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, frequency, falloff) +/mob/proc/playsound_local(var/turf/turf_source, soundin, vol as num, vary, frequency, falloff) if(!src.client || ear_deaf > 0) return soundin = get_sfx(soundin) @@ -36,7 +37,6 @@ var/const/SURROUND_CAP = 7 else S.frequency = get_rand_frequency() - var/turf/turf_source = get_turf(source) if(isturf(turf_source)) // 3D sounds, the technology is here! var/turf/T = get_turf(src) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 91f17a70704..94e0f6a5b81 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1209,12 +1209,6 @@ // make it so you can only puke so fast lastpuke = 0 - //0.1% chance of playing a scary sound to someone who's in complete darkness - if(isturf(loc) && rand(1,1000) == 1) - var/turf/currentTurf = loc - if(!currentTurf.lighting_lumcount) - playsound_local(src,pick(scarySounds),50, 1, -1) - proc/handle_stomach() spawn(0) for(var/mob/living/M in stomach_contents)