diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index bd7022c895..29dc1b1b89 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -50,6 +50,7 @@ var/turf/base_turf //The base turf type of the area, which can be used to override the z-level's base turf var/forbid_events = FALSE // If true, random events will not start inside this area. var/no_spoilers = FALSE // If true, makes it much more difficult to see what is inside an area with things like mesons. + var/soundproofed = FALSE // If true, blocks sounds from other areas and prevents hearers on other areas from hearing the sounds within. /area/Initialize() . = ..() @@ -367,9 +368,9 @@ var/list/mob/living/forced_ambiance_list = new // Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch if(!(L && L.is_preference_enabled(/datum/client_preference/play_ambiance))) return - + var/volume_mod = L.get_preference_volume_channel(VOLUME_CHANNEL_AMBIENCE) - + // If we previously were in an area with force-played ambiance, stop it. if((L in forced_ambiance_list) && initial) L << sound(null, channel = CHANNEL_AMBIENCE_FORCED) diff --git a/code/game/sound.dm b/code/game/sound.dm index a5a03e7181..15165a99e0 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -4,6 +4,9 @@ return var/turf/turf_source = get_turf(source) + if(!turf_source) + return + var/area/area_source = turf_source.loc //allocate a channel if necessary now so its the same for everyone channel = channel || open_sound_channel() @@ -19,6 +22,11 @@ if(!M || !M.client) continue var/turf/T = get_turf(M) + if(!T) + continue + var/area/A = T.loc + if((A.soundproofed || area_source.soundproofed) && (A != area_source)) + continue var/distance = get_dist(T, turf_source) if(distance <= maxdistance)