mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Fix a bunch of jukebox issues, clean up UI a bit, add feedback, allow slapping it to reset if broken.
This commit is contained in:
@@ -39,6 +39,21 @@
|
||||
str += ", from '[album]'"
|
||||
return str
|
||||
|
||||
proc/displaytitle()
|
||||
if(artist==""&&title=="")
|
||||
return "\[NO TAGS\]"
|
||||
var/str=""
|
||||
if(artist!="")
|
||||
str += "[artist]"
|
||||
else
|
||||
str += "Unattributed"
|
||||
str += " - "
|
||||
if(title!="")
|
||||
str += "\"[title]\""
|
||||
else
|
||||
str += "Untitled"
|
||||
return str
|
||||
|
||||
|
||||
var/global/loopModeNames=list(
|
||||
JUKEMODE_SHUFFLE = "Shuffle",
|
||||
@@ -96,7 +111,10 @@ var/global/loopModeNames=list(
|
||||
/obj/machinery/media/jukebox/update_icon()
|
||||
overlays = 0
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
icon_state = "jukebox2-nopower"
|
||||
if(stat & BROKEN)
|
||||
icon_state = "jukebox2-broken"
|
||||
else
|
||||
icon_state = "jukebox2-nopower"
|
||||
stop_playing()
|
||||
return
|
||||
icon_state = "jukebox2"
|
||||
@@ -110,7 +128,14 @@ var/global/loopModeNames=list(
|
||||
return world.time > last_reload + JUKEBOX_RELOAD_COOLDOWN
|
||||
|
||||
/obj/machinery/media/jukebox/attack_hand(var/mob/user)
|
||||
if(stat & (NOPOWER|BROKEN) || emagged)
|
||||
if(stat & NOPOWER)
|
||||
usr << "\red You don't see anything to mess with."
|
||||
return
|
||||
if(stat & BROKEN && playlist!=null)
|
||||
user.visible_message("\red <b>[user.name] smacks the side of \the [src.name].</b>","\red You hammer the side of \the [src.name].")
|
||||
playlist=null
|
||||
playing=emagged
|
||||
update_icon()
|
||||
return
|
||||
var/t = "<h1>Jukebox Interface</h1>"
|
||||
t += "<b>Power:</b> <a href='?src=\ref[src];power=1'>[playing?"On":"Off"]</a><br />"
|
||||
@@ -122,7 +147,9 @@ var/global/loopModeNames=list(
|
||||
t += "<b>Playlist:</b> "
|
||||
for(var/plid in playlists)
|
||||
t += "<a href='?src=\ref[src];playlist=[plid]'>[playlists[plid]]</a>"
|
||||
t += "<br />"
|
||||
else
|
||||
t += "<i>Please wait before changing playlists.<i>"
|
||||
t += "<br />"
|
||||
if(current_song)
|
||||
var/datum/song_info/song=playlist[current_song]
|
||||
t += "<b>Current song:</b> [song.artist] - [song.title]<br />"
|
||||
@@ -130,7 +157,7 @@ var/global/loopModeNames=list(
|
||||
var/i
|
||||
for(i = 1,i <= playlist.len,i++)
|
||||
var/datum/song_info/song=playlist[i]
|
||||
t += "<tr><th>#[i]</th><td><A href='?src=\ref[src];song=[i]'>[song.artist] - [song.title]</A></td><td>[song.album]</td></tr>"
|
||||
t += "<tr><th>#[i]</th><td><A href='?src=\ref[src];song=[i]' class='nobg'>[song.displaytitle()]</A></td><td>[song.album]</td></tr>"
|
||||
t += "</table>"
|
||||
user.set_machine(src)
|
||||
var/datum/browser/popup = new (user,"jukebox",name,420,700)
|
||||
@@ -149,14 +176,16 @@ var/global/loopModeNames=list(
|
||||
loop_mode = JUKEMODE_SHUFFLE
|
||||
emagged = 1
|
||||
playing = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the [src.name].")
|
||||
user.visible_message("[user.name] slides something into the [src.name]'s card-reader.","\red You short out the [src.name].")
|
||||
update_icon()
|
||||
update_music()
|
||||
return
|
||||
|
||||
/obj/machinery/media/jukebox/Topic(href, href_list)
|
||||
..()
|
||||
if(emagged) return
|
||||
if(emagged)
|
||||
usr << "\red You touch the bluescreened menu. Nothing happens. You feel dumber."
|
||||
return
|
||||
|
||||
if (href_list["power"])
|
||||
playing=!playing
|
||||
@@ -203,9 +232,14 @@ var/global/loopModeNames=list(
|
||||
var/songdata = reader.read_value()
|
||||
for(var/list/record in songdata)
|
||||
playlist += new /datum/song_info(record)
|
||||
if(playlist.len==0)
|
||||
visible_message("<span class='warning'>\icon[src] \The [src] buzzes, unable to update its playlist.</span>","<em>You hear a buzz.</em>")
|
||||
stat &= BROKEN
|
||||
update_icon()
|
||||
return
|
||||
visible_message("<span class='notice'>\icon[src] \The [src] beeps, and the menu on its front fills with [playlist.len] items.</span>","<em>You hear a beep.</em>")
|
||||
else
|
||||
//testing("Failed to update playlist: Response null.")
|
||||
testing("[src] failed to update playlist: Response null.")
|
||||
stat &= BROKEN
|
||||
update_icon()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user