mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Jukeboxes will now be synced across all clients (#17599)
This commit is contained in:
@@ -9,11 +9,12 @@
|
|||||||
#define CHANNEL_BUZZ 1017
|
#define CHANNEL_BUZZ 1017
|
||||||
#define CHANNEL_BICYCLE 1016
|
#define CHANNEL_BICYCLE 1016
|
||||||
#define CHANNEL_VOICE_ANNOUNCE 1015
|
#define CHANNEL_VOICE_ANNOUNCE 1015
|
||||||
|
#define CHANNEL_MEGAFAUNA 1014 // battle music
|
||||||
|
|
||||||
//THIS SHOULD ALWAYS BE THE LOWEST ONE!
|
//THIS SHOULD ALWAYS BE THE LOWEST ONE!
|
||||||
//KEEP IT UPDATED
|
//KEEP IT UPDATED
|
||||||
|
|
||||||
#define CHANNEL_HIGHEST_AVAILABLE 1014
|
#define CHANNEL_HIGHEST_AVAILABLE 1013
|
||||||
|
|
||||||
#define MAX_INSTRUMENT_CHANNELS (128 * 6)
|
#define MAX_INSTRUMENT_CHANNELS (128 * 6)
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,17 @@
|
|||||||
active = TRUE
|
active = TRUE
|
||||||
update_icon()
|
update_icon()
|
||||||
START_PROCESSING(SSobj, src)
|
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
|
stop = world.time + selection.song_length
|
||||||
|
|
||||||
/obj/machinery/jukebox/disco/activate_music()
|
/obj/machinery/jukebox/disco/activate_music()
|
||||||
@@ -423,7 +434,7 @@
|
|||||||
lying_prev = 0
|
lying_prev = 0
|
||||||
|
|
||||||
/obj/machinery/jukebox/proc/dance_over()
|
/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)
|
if(!L || !L.client)
|
||||||
continue
|
continue
|
||||||
L.stop_sound_channel(CHANNEL_JUKEBOX)
|
L.stop_sound_channel(CHANNEL_JUKEBOX)
|
||||||
@@ -436,20 +447,18 @@
|
|||||||
|
|
||||||
/obj/machinery/jukebox/process()
|
/obj/machinery/jukebox/process()
|
||||||
if(world.time < stop && active)
|
if(world.time < stop && active)
|
||||||
var/sound/song_played = sound(selection.song_path)
|
|
||||||
|
|
||||||
for(var/mob/M in range(10,src))
|
for(var/mob/M in range(10,src))
|
||||||
if(!M.client || !(M.client.prefs.toggles & SOUND_JUKEBOX))
|
if(!M.client || !(M.client.prefs.toggles & SOUND_JUKEBOX))
|
||||||
continue
|
continue
|
||||||
if(!(M in rangers))
|
if(!(M in rangers))
|
||||||
rangers[M] = TRUE
|
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)
|
for(var/mob/L in rangers)
|
||||||
if(get_dist(src,L) > 10)
|
if(get_dist(src,L) > 10)
|
||||||
rangers -= L
|
rangers -= L
|
||||||
if(!L || !L.client)
|
if(!L || !L.client)
|
||||||
continue
|
continue
|
||||||
L.stop_sound_channel(CHANNEL_JUKEBOX)
|
L.set_sound_channel_volume(CHANNEL_JUKEBOX, 0)
|
||||||
else if(active)
|
else if(active)
|
||||||
active = FALSE
|
active = FALSE
|
||||||
STOP_PROCESSING(SSobj, src)
|
STOP_PROCESSING(SSobj, src)
|
||||||
|
|||||||
@@ -56,14 +56,14 @@
|
|||||||
target.playing_music = src
|
target.playing_music = src
|
||||||
if(sound_datum || !target || !sound_file)
|
if(sound_datum || !target || !sound_file)
|
||||||
return
|
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)
|
SEND_SOUND(target, sound_datum)
|
||||||
|
|
||||||
/datum/music/proc/mask()
|
/datum/music/proc/mask()
|
||||||
if(target)
|
if(target)
|
||||||
target.playing_music = null
|
target.playing_music = null
|
||||||
if(sound_datum)
|
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
|
sound_datum = null
|
||||||
if(!does_loop)
|
if(!does_loop)
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|||||||
Reference in New Issue
Block a user