diff --git a/code/game/objects/items/devices/guitar.dm b/code/game/objects/items/devices/guitar.dm index 546989c3c6e..9a3b4dd6901 100644 --- a/code/game/objects/items/devices/guitar.dm +++ b/code/game/objects/items/devices/guitar.dm @@ -20,17 +20,19 @@ return ..() /obj/item/device/guitar/attack_self(mob/user as mob) - interact(user) + ui_interact(user) -/obj/item/device/guitar/interact(mob/user as mob) +/obj/item/device/guitar/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) if(!user) return if(!isliving(user) || user.stat || user.restrained() || user.lying) return - user.set_machine(src) - song.interact(user) + song.ui_interact(user, ui_key, ui, force_open) + +/obj/item/device/guitar/Topic(href, href_list) + song.Topic(href, href_list) /datum/table_recipe/guitar name = "Guitar" diff --git a/code/game/objects/items/devices/violin.dm b/code/game/objects/items/devices/violin.dm index 02038717aff..9c4d5e9ddb4 100644 --- a/code/game/objects/items/devices/violin.dm +++ b/code/game/objects/items/devices/violin.dm @@ -24,14 +24,16 @@ ..() /obj/item/device/violin/attack_self(mob/user as mob) - interact(user) + ui_interact(user) -/obj/item/device/violin/interact(mob/user as mob) +/obj/item/device/violin/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) if(!user) return if(!isliving(user) || user.stat || user.restrained() || user.lying) return - user.set_machine(src) - song.interact(user) + song.ui_interact(user, ui_key, ui, force_open) + +/obj/item/device/violin/Topic(href, href_list) + song.Topic(href, href_list) \ No newline at end of file diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index b173ece5b0b..367208bbfe4 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -3,13 +3,12 @@ /datum/song var/name = "Untitled" var/list/lines = new() - var/tempo = 5 // delay between notes + var/tempo = 5 // delay between notes - var/playing = 0 // if we're playing - var/help = 0 // if help is open - var/edit = 1 // if we're in editing mode - var/repeat = 0 // number of times remaining to repeat - var/max_repeats = 10 // maximum times we can repeat + var/playing = 0 // if we're playing + var/help = 0 // if help is open + var/repeat = 0 // number of times remaining to repeat + var/max_repeat = 10 // maximum times we can repeat var/instrumentDir = "piano" // the folder with the sounds var/instrumentExt = "ogg" // the file extension @@ -63,9 +62,6 @@ continue M.playsound_local(source, soundfile, 100, falloff = 5) -/datum/song/proc/updateDialog(mob/user as mob) - instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise - /datum/song/proc/shouldStopPlaying(mob/user) if(instrumentObj) //if(!user.canUseTopic(instrumentObj)) @@ -113,68 +109,31 @@ else sleep(tempo) repeat-- - if(repeat >= 0) // don't show the last -1 repeat - updateDialog(user) playing = 0 repeat = 0 - updateDialog(user) -/datum/song/proc/interact(mob/user as mob) - var/dat = "" +/datum/song/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) + var/data[0] - if(lines.len > 0) - dat += "
+ Lines are a series of chords, separated by commas (,), each with notes seperated by hyphens (-).
+
+ Every note in a chord will play together, with the chord timed by the tempo as defined above.
+
+ Notes are played by the names of the note, and optionally, the accidental, and/or the octave number.
+
+ By default, every note is natural and in octave 3. Defining a different state for either is remembered for each note.
+
+ Chords can be played simply by seperating each note with a hyphon: A-C#,Cn-E,E-G#,Gn-B.
+ A pause may be denoted by an empty chord: C,E,,C,G.
+
+ To make a chord be a different time, end it with /x, where the chord length will be length defined by tempo / x, eg: C,G/2,E/4.
+
+ Combined, an example line is: E-E4/4,F#/2,G#/8,B/8,E3-E4/4. +