Skip to content

Commit

Permalink
Merge pull request tgstation#40517 from ShizCalev/instrument-stat
Browse files Browse the repository at this point in the history
Fixes instruments not checking stat after inputs
  • Loading branch information
Cyberboss authored Sep 28, 2018
2 parents 5afcb99 + 3ac2c09 commit 9f094a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions code/game/objects/structures/musician.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 9f094a4

Please sign in to comment.