Fix play_ambience in Life() causing premature loops

This commit is contained in:
ShadowLarkens
2020-08-10 03:00:57 -07:00
parent 93d0d31d62
commit 9213f2cc81
3 changed files with 7 additions and 5 deletions

View File

@@ -371,20 +371,22 @@ var/list/mob/living/forced_ambiance_list = new
L.lastarea = newarea
L.lastareachange = world.time
play_ambience(L)
play_ambience(L, initial = TRUE)
if(no_spoilers)
L.disable_spoiler_vision()
/area/proc/play_ambience(var/mob/living/L)
/area/proc/play_ambience(var/mob/living/L, initial = TRUE)
// 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
// If we previously were in an area with force-played ambiance, stop it.
if(L in forced_ambiance_list)
if((L in forced_ambiance_list) && initial)
L << sound(null, channel = CHANNEL_AMBIENCE_FORCED)
forced_ambiance_list -= L
if(forced_ambience)
if(L in forced_ambiance_list)
return
if(forced_ambience.len)
forced_ambiance_list |= L
var/sound/chosen_ambiance = pick(forced_ambience)