mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
[MIRROR] Refactor jukebox, jukebox datum, now jukebox audio is positional. And it fully respects deaf people. (#26301)
* Refactor jukebox, jukebox datum, now jukebox audio is positional. And it fully respects deaf people. * fix our stuff --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: jjpark-kb <mccorvey.norman@gmail.com>
This commit is contained in:
co-authored by
MrMelbert
jjpark-kb
parent
972e517cfe
commit
3d28268ea0
@@ -55,7 +55,7 @@
|
||||
mod.wearer.investigate_log("has been killed by [src].", INVESTIGATE_DEATHS)
|
||||
mod.wearer.death() //just in case, for some reason, they're still alive
|
||||
flash_color(mod.wearer, flash_color = "#FF0000", flash_time = 10 SECONDS)
|
||||
|
||||
/* SKYRAT EDIT: See skyrat_modular/modules/jukebox
|
||||
///Rave Visor - Gives you a rainbow visor and plays jukebox music to you.
|
||||
/obj/item/mod/module/visor/rave
|
||||
name = "MOD rave visor module"
|
||||
@@ -67,10 +67,6 @@
|
||||
var/datum/client_colour/rave_screen
|
||||
/// The current element in the rainbow_order list we are on.
|
||||
var/rave_number = 1
|
||||
/// The track we selected to play.
|
||||
var/datum/track/selection
|
||||
/// A list of all the songs we can play.
|
||||
var/list/songs = list()
|
||||
/// A list of the colors the module can take.
|
||||
var/static/list/rainbow_order = list(
|
||||
list(1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,0,0),
|
||||
@@ -80,23 +76,18 @@
|
||||
list(0,0,0,0, 0,0.5,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0),
|
||||
list(1,0,0,0, 0,0,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0),
|
||||
)
|
||||
/// What actually plays music to us
|
||||
var/datum/jukebox/single_mob/music_player
|
||||
|
||||
/obj/item/mod/module/visor/rave/Initialize(mapload)
|
||||
. = ..()
|
||||
var/list/tracks = flist("[global.config.directory]/jukebox_music/sounds/")
|
||||
for(var/sound in tracks)
|
||||
var/datum/track/track = new()
|
||||
track.song_path = file("[global.config.directory]/jukebox_music/sounds/[sound]")
|
||||
var/list/sound_params = splittext(sound,"+")
|
||||
if(length(sound_params) != 3)
|
||||
continue
|
||||
track.song_name = sound_params[1]
|
||||
track.song_length = text2num(sound_params[2])
|
||||
track.song_beat = text2num(sound_params[3])
|
||||
songs[track.song_name] = track
|
||||
if(length(songs))
|
||||
var/song_name = pick(songs)
|
||||
selection = songs[song_name]
|
||||
music_player = new(src)
|
||||
music_player.sound_loops = TRUE
|
||||
|
||||
/obj/item/mod/module/visor/rave/Destroy()
|
||||
QDEL_NULL(music_player)
|
||||
QDEL_NULL(rave_screen)
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/module/visor/rave/on_activation()
|
||||
. = ..()
|
||||
@@ -104,24 +95,26 @@
|
||||
return
|
||||
rave_screen = mod.wearer.add_client_colour(/datum/client_colour/rave)
|
||||
rave_screen.update_colour(rainbow_order[rave_number])
|
||||
if(selection)
|
||||
mod.wearer.playsound_local(get_turf(src), null, 50, channel = CHANNEL_JUKEBOX, sound_to_use = sound(selection.song_path), use_reverb = FALSE)
|
||||
music_player.start_music(mod.wearer)
|
||||
|
||||
/obj/item/mod/module/visor/rave/on_deactivation(display_message = TRUE, deleting = FALSE)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
QDEL_NULL(rave_screen)
|
||||
if(selection)
|
||||
mod.wearer.stop_sound_channel(CHANNEL_JUKEBOX)
|
||||
if(deleting)
|
||||
return
|
||||
SEND_SOUND(mod.wearer, sound('sound/machines/terminal_off.ogg', volume = 50, channel = CHANNEL_JUKEBOX))
|
||||
if(isnull(music_player.active_song_sound))
|
||||
return
|
||||
|
||||
music_player.unlisten_all()
|
||||
QDEL_NULL(music_player)
|
||||
if(deleting)
|
||||
return
|
||||
SEND_SOUND(mod.wearer, sound('sound/machines/terminal_off.ogg', volume = 50, channel = CHANNEL_JUKEBOX))
|
||||
|
||||
/obj/item/mod/module/visor/rave/generate_worn_overlay(mutable_appearance/standing)
|
||||
. = ..()
|
||||
for(var/mutable_appearance/appearance as anything in .)
|
||||
appearance.color = active ? rainbow_order[rave_number] : null
|
||||
appearance.color = isnull(music_player.active_song_sound) ? null : rainbow_order[rave_number]
|
||||
|
||||
/obj/item/mod/module/visor/rave/on_active_process(seconds_per_tick)
|
||||
rave_number++
|
||||
@@ -132,21 +125,21 @@
|
||||
|
||||
/obj/item/mod/module/visor/rave/get_configuration()
|
||||
. = ..()
|
||||
if(length(songs))
|
||||
.["selection"] = add_ui_configuration("Song", "list", selection.song_name, clean_songs())
|
||||
if(length(music_player.songs))
|
||||
.["selection"] = add_ui_configuration("Song", "list", music_player.selection.song_name, music_player.songs)
|
||||
|
||||
/obj/item/mod/module/visor/rave/configure_edit(key, value)
|
||||
switch(key)
|
||||
if("selection")
|
||||
if(active)
|
||||
if(!isnull(music_player.active_song_sound))
|
||||
return
|
||||
selection = songs[value]
|
||||
|
||||
/obj/item/mod/module/visor/rave/proc/clean_songs()
|
||||
. = list()
|
||||
for(var/track in songs)
|
||||
. += track
|
||||
var/datum/track/new_song = music_player.songs[value]
|
||||
if(QDELETED(src) || !istype(new_song, /datum/track))
|
||||
return
|
||||
|
||||
music_player.selection = new_song
|
||||
SKYRAT EDIT END */
|
||||
///Tanner - Tans you with spraytan.
|
||||
/obj/item/mod/module/tanner
|
||||
name = "MOD tanning module"
|
||||
|
||||
Reference in New Issue
Block a user