Limits hearing sounds in a vacuum

This commit is contained in:
mwerezak
2014-07-15 15:30:10 -04:00
parent 5cf3162f53
commit 005c6589c2
3 changed files with 18 additions and 4 deletions
+15 -2
View File
@@ -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
+1 -2
View File
@@ -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
+2
View File
@@ -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)