Adds a fallback system to the jukebox and makes it user friendlier

This commit is contained in:
Archie
2021-06-21 18:00:48 -03:00
parent ed0cabca5d
commit 774ea5475d
4 changed files with 23 additions and 5 deletions

View File

@@ -65,14 +65,25 @@ SUBSYSTEM_DEF(jukeboxes)
/datum/controller/subsystem/jukeboxes/Initialize()
var/list/tracks = flist("config/jukebox_music/sounds/")
var/list/fallbacktracks = flist("config/jukebox_music/fallback/")
var/songID = 1
for(var/S in tracks)
for(var/S in tracks) // Tracks that will not be in the repo, aka, localhost tracks.
var/datum/track/T = new()
T.song_path = file("config/jukebox_music/sounds/[S]")
var/list/L = splittext(S,"+")
T.song_name = L[1]
T.song_length = text2num(L[2])
T.song_beat = text2num(L[3])
T.song_length = text2num(L[2])*10 //We multiply it by ten because the system requires it in deciseconds
T.song_beat = (text2num(L[3])/6) //We divide it by six because it requires the Beats per seconds value, but in deciseconds. (Result/60) * 10)
T.song_associated_id = songID
songs |= T
songID++
for(var/S in fallbacktracks) // Tracks that will always be in the repo.
var/datum/track/T = new()
T.song_path = file("config/jukebox_music/fallback/[S]")
var/list/L = splittext(S,"+")
T.song_name = L[1]
T.song_length = text2num(L[2])*10 //We multiply it by ten because the system requires it in deciseconds
T.song_beat = (text2num(L[3])/6) //We divide it by six because it requires the Beats per seconds value, but in deciseconds. (Result/60) * 10)
T.song_associated_id = songID
songs |= T
songID++

View File

@@ -10,6 +10,6 @@ Naming Conventions:
Every sound you add must have a unique name. Avoid using the plus sign "+" and the period "." in names, as these are used internally to classify sounds.
Sound names must be in the format of [song name]+[length in deciseconds]+[beat in deciseconds].ogg
Sound names must be in the format of [song name]+[length in seconds]+[beats per minute].ogg
A three minute song title "SS13" that lasted 3 minutes would have a file name SS13+1800+5.ogg
A three minute song title "SS13" that lasted 3 minutes and had a BPM value of 120 would need the file name SS13+180+120.ogg

View File

@@ -26,3 +26,10 @@
cost = 35000
contains = list(/obj/machinery/jukebox)
crate_name = "Jukebox"
/datum/supply_pack/misc/discojukebox
name = "Disco Jukebox"
desc = "For the party within you. Needs engineering access or above."
cost = 60000
contains = list(/obj/machinery/jukebox/disco)
crate_name = "disco jukebox"