Merge pull request #40517 from ShizCalev/instrument-stat

Fixes instruments not checking stat after inputs
This commit is contained in:
Jordan Brown
2018-09-28 09:46:00 -04:00
committed by GitHub
+7 -5
View File
@@ -82,7 +82,7 @@
/datum/song/proc/shouldStopPlaying(mob/user)
if(instrumentObj)
if(!user.canUseTopic(instrumentObj))
if(!user.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
return TRUE
return !instrumentObj.anchored // add special cases to stop in subclasses
else
@@ -217,7 +217,7 @@
updateDialog(usr) // make sure updates when complete
/datum/song/Topic(href, href_list)
if(!usr.canUseTopic(instrumentObj))
if(!usr.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
usr << browse(null, "window=instrument")
usr.unset_machine()
return
@@ -233,11 +233,13 @@
var/t = ""
do
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message)
if(!in_range(instrumentObj, usr))
if(!usr.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
return
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(!usr.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
return
if(cont == "no")
break
while(lentext(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS)
@@ -268,7 +270,7 @@
else if(href_list["newline"])
var/newline = html_encode(input("Enter your line: ", instrumentObj.name) as text|null)
if(!newline || !in_range(instrumentObj, usr))
if(!newline || !usr.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
return
if(lines.len > MUSIC_MAXLINES)
return
@@ -285,7 +287,7 @@
else if(href_list["modifyline"])
var/num = round(text2num(href_list["modifyline"]),1)
var/content = html_encode(input("Enter your line: ", instrumentObj.name, lines[num]) as text|null)
if(!content || !in_range(instrumentObj, usr))
if(!content || !usr.canUseTopic(instrumentObj, BE_CLOSE, FALSE, NO_TK))
return
if(lentext(content) > MUSIC_MAXLINECHARS)
content = copytext(content, 1, MUSIC_MAXLINECHARS)