From 9213f2cc8126189f6cd0c6df3f012338863b759c Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Mon, 10 Aug 2020 03:00:57 -0700 Subject: [PATCH] Fix play_ambience in Life() causing premature loops --- code/game/area/areas.dm | 8 +++++--- code/modules/holodeck/HolodeckControl.dm | 2 +- code/modules/mob/living/life.dm | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index f6f2ddfce8..b76d5412b9 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -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) diff --git a/code/modules/holodeck/HolodeckControl.dm b/code/modules/holodeck/HolodeckControl.dm index e30a6f049c..5ba939fd8d 100644 --- a/code/modules/holodeck/HolodeckControl.dm +++ b/code/modules/holodeck/HolodeckControl.dm @@ -325,7 +325,7 @@ for(var/mob/living/M in mobs_in_area(linkedholodeck)) if(M.mind) - linkedholodeck.play_ambience(M) + linkedholodeck.play_ambience(M, initial = TRUE) linkedholodeck.sound_env = A.sound_env diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index bf3d898b6c..857075fee3 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -96,7 +96,7 @@ if(world.time >= (lastareachange + 30 SECONDS)) // Every 30 seconds, we're going to run a 35% chance to play ambience. var/area/A = get_area(src) if(A) - A.play_ambience(src) + A.play_ambience(src, initial = FALSE) /mob/living/proc/update_pulling() if(pulling)