From 417a0d9d4a7b7f3f6613521d205ce1824449fa84 Mon Sep 17 00:00:00 2001 From: Dip Date: Tue, 13 Oct 2020 14:55:34 -0300 Subject: [PATCH] Jukeboxes Finally Work --- code/controllers/subsystem/jukeboxes.dm | 10 ++++++---- code/game/machinery/dance_machine.dm | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystem/jukeboxes.dm b/code/controllers/subsystem/jukeboxes.dm index b43f50d8..2c24262a 100644 --- a/code/controllers/subsystem/jukeboxes.dm +++ b/code/controllers/subsystem/jukeboxes.dm @@ -65,6 +65,7 @@ SUBSYSTEM_DEF(jukeboxes) /datum/controller/subsystem/jukeboxes/Initialize() var/list/tracks = flist("config/jukebox_music/sounds/") + var/songID = 1 for(var/S in tracks) var/datum/track/T = new() T.song_path = file("config/jukebox_music/sounds/[S]") @@ -72,8 +73,9 @@ SUBSYSTEM_DEF(jukeboxes) T.song_name = L[1] T.song_length = text2num(L[2]) T.song_beat = text2num(L[3]) - T.song_associated_id = L[4] + T.song_associated_id = songID songs |= T + songID++ for(var/i in CHANNEL_JUKEBOX_START to CHANNEL_JUKEBOX) freejukeboxchannels |= i return ..() @@ -83,15 +85,15 @@ SUBSYSTEM_DEF(jukeboxes) return for(var/list/jukeinfo in activejukeboxes) if(!jukeinfo.len) - EXCEPTION("Active jukebox without any associated metadata.") + stack_trace("Active jukebox without any associated metadata.") continue var/datum/track/juketrack = jukeinfo[1] if(!istype(juketrack)) - EXCEPTION("Invalid jukebox track datum.") + stack_trace("Invalid jukebox track datum.") continue var/obj/jukebox = jukeinfo[3] if(!istype(jukebox)) - EXCEPTION("Nonexistant or invalid object associated with jukebox.") + stack_trace("Nonexistant or invalid object associated with jukebox.") continue var/sound/song_played = sound(juketrack.song_path) var/area/currentarea = get_area(jukebox) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 78eff08e..0fdcc12a 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -202,6 +202,8 @@ for(var/i in 1 to 10) spawn_atom_to_turf(/obj/effect/temp_visual/hierophant/telegraph/edge, src, 1, FALSE) sleep(5) + if(QDELETED(src)) + return #define DISCO_INFENO_RANGE (rand(85, 115)*0.01) @@ -364,7 +366,7 @@ //for(var/mob/living/carbon/NS in rangers) // NS.resting = !NS.resting // NS.update_canmove() - time-- + time-- /obj/machinery/jukebox/disco/proc/dance5(var/mob/living/M) animate(M, transform = matrix(180, MATRIX_ROTATE), time = 1, loop = 0)