From b3e62c530a95ec093702258351e82554e6cfeff3 Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Fri, 14 Jul 2017 18:09:48 -0700 Subject: [PATCH] Update musician.dm --- code/game/objects/structures/musician.dm | 37 ++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index c9ef64cffa4..18966016a1d 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -1,5 +1,6 @@ #define MUSIC_MAXLINES 300 +#define MUSIC_MAXLINECHARS 50 /datum/song var/name = "Untitled" @@ -70,10 +71,10 @@ /datum/song/proc/shouldStopPlaying(mob/user) if(instrumentObj) if(!user.canUseTopic(instrumentObj)) - return 1 + return TRUE return !instrumentObj.anchored // add special cases to stop in subclasses else - return 1 + return TRUE /datum/song/proc/playsong(mob/user) while(repeat >= 0) @@ -91,9 +92,9 @@ for(var/note in splittext(notes[1], "-")) //to_chat(world, "note: [note]") if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case - playing = 0 + playing = FALSE return - if(lentext(note) == 0) + if(!lentext(note)) continue //to_chat(world, "Parse: [copytext(note,1,2)]") var/cur_note = text2ascii(note) - 96 @@ -123,7 +124,7 @@ else sleep(tempo) repeat-- - playing = 0 + playing = FALSE repeat = 0 updateDialog(user) @@ -172,7 +173,7 @@ defined by tempo / x: C,G/2,E/4
Combined, an example is: E-E4/4,F#/2,G#/8,B/8,E3-E4/4
- Lines may be up to 50 characters.
+ Lines may be up to [MUSIC_MAXLINECHARS] characters.
A song may only contain up to [MUSIC_MAXLINES] lines.
"} else @@ -198,7 +199,7 @@ lines.Cut(MUSIC_MAXLINES + 1) var/linenum = 1 for(var/l in lines) - if(lentext(l) > 50) + if(lentext(l) > MUSIC_MAXLINECHARS) to_chat(usr, "Line [linenum] too long!") lines.Remove(l) else @@ -225,11 +226,11 @@ if(!in_range(instrumentObj, usr)) return - if(lentext(t) >= 3072) + if(lentext(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS) var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") if(cont == "no") break - while(lentext(t) > 3072) + while(lentext(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS) ParseSong(t) else if(href_list["help"]) @@ -251,7 +252,7 @@ tempo = sanitize_tempo(tempo + text2num(href_list["tempo"])) else if(href_list["play"]) - playing = 1 + playing = TRUE spawn() playsong(usr) @@ -261,8 +262,8 @@ return if(lines.len > MUSIC_MAXLINES) return - if(lentext(newline) > 50) - newline = copytext(newline, 1, 50) + if(lentext(newline) > MUSIC_MAXLINECHARS) + newline = copytext(newline, 1, MUSIC_MAXLINECHARS) lines.Add(newline) else if(href_list["deleteline"]) @@ -276,14 +277,14 @@ var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null) if(!content || !in_range(instrumentObj, usr)) return - if(lentext(content) > 50) - content = copytext(content, 1, 50) + if(lentext(content) > MUSIC_MAXLINECHARS) + content = copytext(content, 1, MUSIC_MAXLINECHARS) if(num > lines.len || num < 1) return lines[num] = content else if(href_list["stop"]) - playing = 0 + playing = FALSE updateDialog(usr) return @@ -302,7 +303,7 @@ if(instrumentObj) return !isliving(instrumentObj.loc) else - return 1 + return TRUE ////////////////////////////////////////////////////////////////////////// @@ -359,7 +360,7 @@ /obj/structure/piano/attackby(obj/item/O, mob/user, params) if (istype(O, /obj/item/weapon/wrench)) if (!anchored && !isinspace()) - playsound(src.loc, O.usesound, 50, 1) + playsound(src, O.usesound, 50, 1) to_chat(user, " You begin to tighten \the [src] to the floor...") if (do_after(user, 20*O.toolspeed, target = src)) user.visible_message( \ @@ -368,7 +369,7 @@ "You hear ratchet.") anchored = TRUE else if(anchored) - playsound(src.loc, O.usesound, 50, 1) + playsound(src, O.usesound, 50, 1) to_chat(user, " You begin to loosen \the [src]'s casters...") if (do_after(user, 40*O.toolspeed, target = src)) user.visible_message( \