fix instruments breaking when a song has a space at the end of a line (#34394)

This commit is contained in:
nervere
2023-06-19 23:46:44 -04:00
committed by GitHub
parent 3d9755f89c
commit 36d816da22

View File

@@ -114,13 +114,15 @@
var/lineCount = 1; var/lineCount = 1;
for(var/line in lines) for(var/line in lines)
//world << line //to_chat(world, "line: [line]")
var/chordCount = 1; var/chordCount = 1;
for(var/beat in splittext(lowertext(line), ",")) for(var/beat in splittext(lowertext(line), ","))
//world << "beat: [beat]" //to_chat(world, "beat: [beat] / beat length: [length(beat)]")
if(!length(beat)) //This occurs when a comma is at the end of a line
beat = " " //It's intended to be a space so here we make it a space
var/list/notes = splittext(beat, "/") var/list/notes = splittext(beat, "/")
for(var/note in splittext(notes[1], "-")) for(var/note in splittext(notes[1], "-"))
//world << "note: [note]" //to_chat(world, "note: [note]")
if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case
playing = 0 playing = 0
return return