diff --git a/code/game/sound.dm b/code/game/sound.dm index 0fe756eca5..84abfeeae4 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -25,10 +25,23 @@ var/list/page_sound = list('sound/effects/pageturn1.ogg', 'sound/effects/pagetur var/mob/M = P if(!M || !M.client) continue - if(get_dist(M, turf_source) <= (world.view + extrarange) * 3) + + var/distance = get_dist(M, turf_source) + if(distance <= (world.view + extrarange) * 3) var/turf/T = get_turf(M) + if(T && T.z == turf_source.z) - M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff) + //check that the air can transmit sound + var/datum/gas_mixture/environment = T.return_air() + if (!environment || environment.return_pressure() < SOUND_MINIMUM_PRESSURE) + if (distance > 1) + continue + + var/new_frequency = 32000 + (frequency - 32000)*0.75 //lower the frequency a bit. very rudimentary + var/new_volume = vol*0.5 //muffle the sound, like we're hearing through contact + M.playsound_local(turf_source, soundin, new_volume, vary, new_frequency, falloff) + else + M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff) var/const/FALLOFF_SOUNDS = 2 var/const/SURROUND_CAP = 255 diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 4fd99b4293..3344a9e210 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -1,4 +1,3 @@ -#define SAY_MINIMUM_PRESSURE 10 var/list/department_radio_keys = list( ":r" = "right ear", "#r" = "right ear", ".r" = "right ear", ":l" = "left ear", "#l" = "left ear", ".l" = "left ear", @@ -112,7 +111,7 @@ var/list/department_radio_keys = list( var/datum/gas_mixture/environment = T.return_air() if(environment) var/pressure = environment.return_pressure() - if(pressure < SAY_MINIMUM_PRESSURE) + if(pressure < SOUND_MINIMUM_PRESSURE) italics = 1 message_range = 1 diff --git a/code/setup.dm b/code/setup.dm index 55c1510234..e337d651f2 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -27,6 +27,8 @@ #define HUMAN_NEEDED_OXYGEN MOLES_CELLSTANDARD*BREATH_PERCENTAGE*0.16 //Amount of air needed before pass out/suffocation commences +#define SOUND_MINIMUM_PRESSURE 10 + // Pressure limits. #define HAZARD_HIGH_PRESSURE 550 //This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant) #define WARNING_HIGH_PRESSURE 325 //This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)