Sounds in space/places with low pressure are quieter. You cannot hear people in low pressure environments unless you are next to them (or are them)

This commit is contained in:
Remie Richards
2014-11-19 17:03:12 +00:00
parent 1208c48af3
commit 99fe1c9d04
3 changed files with 43 additions and 4 deletions
+7 -1
View File
@@ -50,4 +50,10 @@
#define STAGE_TWO 3
#define STAGE_THREE 5
#define STAGE_FOUR 7
#define STAGE_FIVE 9
#define STAGE_FIVE 9
//SOUND:
#define SOUND_MINIMUM_PRESSURE 10
#define FALLOFF_SOUNDS 1
#define SURROUND_CAP 7
+24 -3
View File
@@ -19,8 +19,6 @@
if(T && T.z == turf_source.z)
M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, surround)
var/const/FALLOFF_SOUNDS = 1
var/const/SURROUND_CAP = 7
/mob/proc/playsound_local(var/turf/turf_source, soundin, vol as num, vary, frequency, falloff, surround = 1)
if(!src.client || ear_deaf > 0) return
@@ -38,8 +36,31 @@ var/const/SURROUND_CAP = 7
S.frequency = get_rand_frequency()
if(isturf(turf_source))
// 3D sounds, the technology is here!
var/turf/T = get_turf(src)
//Atmosphere affects sound
var/pressure_factor = 1
var/datum/gas_mixture/hearer_env = T.return_air()
var/datum/gas_mixture/source_env = turf_source.return_air()
if(hearer_env && source_env)
var/pressure = min(hearer_env.return_pressure(), source_env.return_pressure())
if(pressure < ONE_ATMOSPHERE)
pressure_factor = max((pressure - SOUND_MINIMUM_PRESSURE)/(ONE_ATMOSPHERE - SOUND_MINIMUM_PRESSURE), 0)
else //space
pressure_factor = 0
var/distance = get_dist(T, turf_source)
if(distance <= 1)
pressure_factor = max(pressure_factor, 0.15) //touching the source of the sound
S.volume *= pressure_factor
//End Atmosphere affecting sound
if(S.volume <= 0)
return //No sound
// 3D sounds, the technology is here!
if (surround)
var/dx = turf_source.x - T.x // Hearing from the right/left
S.x = round(max(-SURROUND_CAP, min(SURROUND_CAP, dx)), 1)
+12
View File
@@ -121,6 +121,18 @@ var/list/department_radio_keys = list(
if(radio_return & REDUCE_RANGE)
message_range = 1
if(message_range != 1)
//No screams in space, unless you're next to someone.
var/turf/T = get_turf(src)
var/datum/gas_mixture/environment = T.return_air()
var/pressure = (environment)? environment.return_pressure() : 0
if(pressure < SOUND_MINIMUM_PRESSURE)
message_range = 1
if(pressure < ONE_ATMOSPHERE*0.4) //Thin air, let's italicise the message
if(!findtextEx(message,"<i>"))
message = "<i>[message]</i>"
send_speech(message, message_range, src, bubble_type)
log_say("[name]/[key] : [message]")