diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm
index ec8c320a1c0..c2d3b94cfef 100644
--- a/code/game/objects/structures/musician.dm
+++ b/code/game/objects/structures/musician.dm
@@ -9,7 +9,7 @@
//For those other infidels who uses this datum
//VIOLINSSS
- var/list/lines
+ var/list/lines = new()
var/tempo = 5
@@ -245,10 +245,66 @@
soundlist["Cb9"] = 'sound/piano/Cb9.ogg'
soundlist["Cn9"] = 'sound/piano/Cn9.ogg'
- proc/statusmsg( var/txt as text )
+ proc/statusmsg( var/txt )
status = txt
updateUsrDialog()
+ proc/unbayify( var/text )
+
+ // text = dd_replacetext(text, "/0,", ",")
+ // text = dd_replacetext(text, "/infinity", "")
+ // text = dd_replacetext(text, "/Infini", "")
+
+ //if(copytext(text, lentext(text)-1) == "/0")
+ // text = copytext(text, 1, lentext(text)-1)
+
+ var/list/partlist = dd_text2list(text, ",")
+
+ var/i
+ for(i=1, i<=partlist.len, i++)
+ var/part = partlist[i]
+ var/list/x = dd_text2list(part, "/")
+
+ var/tone = ""
+ var/tempo = "1"
+ if(x.len >= 1)
+ tone = x[1]
+
+ if(x.len == 1)
+ //If there's only the tone set, move it to tempo side instead
+ //It has to be null, otherwise it means it starts with a number, which is something stupid.
+ if(!isnull(text2num(copytext(tone, 1, 2))))
+ world << "shitty tone [part]"
+ //Sets tempo to whatever number we found in there (text2num removes other symbols)
+ tone = ""
+ tempo = "[text2num(tone)]"
+
+ if(x.len == 2)
+ tempo = x[2]
+
+ //Can't divide by zero, what did they think?
+ if(tempo=="0")
+ world << "Divide by zero [part]"
+ tempo = "1"
+
+ //Removes /infinity, /Infini, whatever this means
+ if(findtext(lowertext(tempo), "inf"))
+ world << "inf [part]"
+ tempo = "1"
+
+ //If both tone and tempo is set, and its numbers on both sides, leftside is invalid and gets set to ""
+ //It has to be null, otherwise it means it starts with a number, which is something stupid.
+ if(!isnull(text2num(copytext(tone, 1, 2))))
+ world << "shitty tone 2 [part]"
+ //Sets tempo to whatever number we found in there (text2num removes other symbols)
+ tempo = ""
+
+ partlist[i] = "[tone]/[tempo]"
+
+ text = dd_list2text(partlist, ",")
+
+ return text
+
proc/playsong()
if(currentsong.compilesuccess == 0)
playing = 0
@@ -288,6 +344,7 @@
var/strippedsourcestring = dd_replacetext(currentsong.sourcestring, "\n", "")
+ strippedsourcestring = unbayify(strippedsourcestring)
for(var/part in dd_text2list(strippedsourcestring, ","))
var/list/x = dd_text2list(part, "/")
@@ -297,9 +354,10 @@
var/tempodiv = 1
if(xlen==2)
tempodiv = text2num(x[2])
- if(tempodiv == 0)
- statusmsg( "Compile Error: Can't divide by 0!\nAt Part:'[part]' Tone:" )
- return
+ if(tempodiv <= 0)
+ //statusmsg( "Compile Error: Can't divide by 0!\nAt Part:'[part]' Tone:" )
+ //return
+ tempodiv = 1
else if(xlen>2)
statusmsg( "Compile Error: Tempo Syntax Error!\nAt Part:'[part]' Tone:" )
return
@@ -368,7 +426,7 @@
compilestring += "x" + finaltone + "¤"
//y indicates its a sleep
- compilestring += "y[round((currentsong.tempo / tempodiv)*100)/100]¤"
+ compilestring += "y[round((currentsong.tempo / tempodiv)*10000)/10000]¤"
currentsong.compiledstring = compilestring
currentsong.compilesuccess = 1
@@ -467,12 +525,14 @@
if(showeditor)
dat += {"
Tempo:
- ---
+ +---
[calctempo] BPM
- +++
+ ++++
Compile
Edit
-
[currentsong.sourcestring]
[currentsong.sourcestring]