diff --git a/code/__DEFINES/sound.dm b/code/__DEFINES/sound.dm index a6ee1c3f4f69..55d0afdcd524 100644 --- a/code/__DEFINES/sound.dm +++ b/code/__DEFINES/sound.dm @@ -9,11 +9,12 @@ #define CHANNEL_BUZZ 1017 #define CHANNEL_BICYCLE 1016 #define CHANNEL_VOICE_ANNOUNCE 1015 +#define CHANNEL_MEGAFAUNA 1014 // battle music //THIS SHOULD ALWAYS BE THE LOWEST ONE! //KEEP IT UPDATED -#define CHANNEL_HIGHEST_AVAILABLE 1014 +#define CHANNEL_HIGHEST_AVAILABLE 1013 #define MAX_INSTRUMENT_CHANNELS (128 * 6) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index add9b62fbbcb..fe561457626e 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -176,6 +176,17 @@ active = TRUE update_icon() START_PROCESSING(SSobj, src) + var/sound/song_played = sound(selection.song_path) + var/list/close = range(10,src) + for(var/mob/L in GLOB.player_list) + if(!L || !L.client) + continue + // it doesn't send at 0 volume so you get 0.001 volume on init + L.playsound_local(get_turf(L), null, 0.001, channel = CHANNEL_JUKEBOX, S = song_played) + if(L in close && L.client.prefs.toggles & SOUND_JUKEBOX) + L.set_sound_channel_volume(CHANNEL_JUKEBOX, volume) // TURN THAT SHIT UP!!!! + else + L.set_sound_channel_volume(CHANNEL_JUKEBOX, 0) stop = world.time + selection.song_length /obj/machinery/jukebox/disco/activate_music() @@ -423,7 +434,7 @@ lying_prev = 0 /obj/machinery/jukebox/proc/dance_over() - for(var/mob/living/L in rangers) + for(var/mob/L in GLOB.player_list) if(!L || !L.client) continue L.stop_sound_channel(CHANNEL_JUKEBOX) @@ -436,20 +447,18 @@ /obj/machinery/jukebox/process() if(world.time < stop && active) - var/sound/song_played = sound(selection.song_path) - for(var/mob/M in range(10,src)) if(!M.client || !(M.client.prefs.toggles & SOUND_JUKEBOX)) continue if(!(M in rangers)) rangers[M] = TRUE - M.playsound_local(get_turf(M), null, volume, channel = CHANNEL_JUKEBOX, S = song_played) + M.set_sound_channel_volume(CHANNEL_JUKEBOX, volume) // We want volume updated without having to walk away!! for(var/mob/L in rangers) if(get_dist(src,L) > 10) rangers -= L if(!L || !L.client) continue - L.stop_sound_channel(CHANNEL_JUKEBOX) + L.set_sound_channel_volume(CHANNEL_JUKEBOX, 0) else if(active) active = FALSE STOP_PROCESSING(SSobj, src) diff --git a/code/modules/music/music.dm b/code/modules/music/music.dm index 31b0d2510319..f959988c6a75 100644 --- a/code/modules/music/music.dm +++ b/code/modules/music/music.dm @@ -56,14 +56,14 @@ target.playing_music = src if(sound_datum || !target || !sound_file) return - sound_datum = sound(sound_file, does_loop, 0, CHANNEL_JUKEBOX, base_volume * fade_volume) + sound_datum = sound(sound_file, does_loop, 0, CHANNEL_MEGAFAUNA, base_volume * fade_volume) SEND_SOUND(target, sound_datum) /datum/music/proc/mask() if(target) target.playing_music = null if(sound_datum) - SEND_SOUND(target, sound(null, repeat = 0, wait = 0, channel = CHANNEL_JUKEBOX)) + SEND_SOUND(target, sound(null, repeat = 0, wait = 0, channel = CHANNEL_MEGAFAUNA)) sound_datum = null if(!does_loop) qdel(src)