Merge pull request #5510 from Citadel-Station-13/upstream-merge-35552

[MIRROR] [s]Fixes writing bugs/exploits
This commit is contained in:
deathride58
2018-02-16 01:32:23 +00:00
committed by GitHub
15 changed files with 156 additions and 91 deletions

View File

@@ -137,8 +137,13 @@
/obj/item/valentine/attackby(obj/item/W, mob/user, params)
..()
if(istype(W, /obj/item/pen) || istype(W, /obj/item/toy/crayon))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
var/recipient = stripped_input(user, "Who is receiving this valentine?", "To:", null , 20)
var/sender = stripped_input(user, "Who is sending this valentine?", "From:", null , 20)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(recipient && sender)
name = "valentine - To: [recipient] From: [sender]"

View File

@@ -197,8 +197,13 @@
to_chat(user, "<span class='notice'>[src] already has a bomb in it!</span>")
else if(istype(I, /obj/item/pen))
if(!open)
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src
box.boxtag += stripped_input(user, "Write on [box]'s tag:", box, "", 30)
if(!user.canUseTopic(src, BE_CLOSE))
return
to_chat(user, "<span class='notice'>You write with [I] on [src].</span>")
update_icon()
return

View File

@@ -139,11 +139,14 @@
/obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
if(!blank)
to_chat(user, "You cannot write on that card.")
return
var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50)
if(!cardtext)
if(!cardtext || !user.canUseTopic(src, BE_CLOSE))
return
name = cardtext
buffertext = cardtext

View File

@@ -93,7 +93,12 @@
to_chat(user, "<span class='notice'>You empty \the [I] into \the [src].</span>")
update_icon()
else if(istype(I, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/newname = stripped_input(user, "What would you like to title this bookshelf?")
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!newname)
return
else
@@ -214,30 +219,42 @@
if(unique)
to_chat(user, "<span class='warning'>These pages don't seem to take the ink well! Looks like you can't modify it.</span>")
return
var/literate = user.is_literate()
if(!literate)
to_chat(user, "<span class='notice'>You scribble illegibly on the cover of [src]!</span>")
return
var/choice = input("What would you like to change?") in list("Title", "Contents", "Author", "Cancel")
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
switch(choice)
if("Title")
var/newtitle = reject_bad_text(stripped_input(usr, "Write a new title:"))
var/newtitle = reject_bad_text(stripped_input(user, "Write a new title:"))
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if (length(newtitle) > 20)
to_chat(usr, "That title won't fit on the cover!")
to_chat(user, "That title won't fit on the cover!")
return
if(!newtitle)
to_chat(usr, "That title is invalid.")
to_chat(user, "That title is invalid.")
return
else
name = newtitle
title = newtitle
if("Contents")
var/content = stripped_input(usr, "Write your book's contents (HTML NOT allowed):","","",8192)
var/content = stripped_input(user, "Write your book's contents (HTML NOT allowed):","","",8192)
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if(!content)
to_chat(usr, "The content is invalid.")
to_chat(user, "The content is invalid.")
return
else
dat += content
if("Author")
var/newauthor = stripped_input(usr, "Write the author's name:")
var/newauthor = stripped_input(user, "Write the author's name:")
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if(!newauthor)
to_chat(usr, "The name is invalid.")
to_chat(user, "The name is invalid.")
return
else
author = newauthor

View File

@@ -41,8 +41,11 @@
to_chat(user, "<span class='notice'>You put [W] into [src].</span>")
update_icon()
else if(istype(W, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the cover of [src]!</span>")
return
var/n_name = copytext(sanitize(input(user, "What would you like to label the folder?", "Folder Labelling", null) as text), 1, MAX_NAME_LEN)
if((in_range(src,user) && user.stat == CONSCIOUS))
if(user.canUseTopic(src, BE_CLOSE))
name = "folder[(n_name ? " - '[n_name]'" : null)]"

View File

@@ -244,7 +244,8 @@
/obj/item/paper/Topic(href, href_list)
..()
if(usr.stat || usr.restrained())
var/literate = usr.is_literate()
if(!usr.canUseTopic(src, BE_CLOSE, literate))
return
if(href_list["help"])
@@ -253,7 +254,7 @@
if(href_list["write"])
var/id = href_list["write"]
var/t = stripped_multiline_input("Enter what you want to write:", "Write", no_trim=TRUE)
if(!t)
if(!t || !usr.canUseTopic(src, BE_CLOSE, literate))
return
var/obj/item/i = usr.get_active_held_item() //Check to see if he still got that darn pen, also check if he's using a crayon or pen.
var/iscrayon = 0

View File

@@ -54,9 +54,12 @@
/obj/item/photo/attackby(obj/item/P, mob/user, params)
if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text)
txt = copytext(txt, 1, 128)
if(loc == user && user.stat == CONSCIOUS)
if(user.canUseTopic(src, BE_CLOSE))
scribble = txt
..()

View File

@@ -74,14 +74,14 @@
/obj/item/reagent_containers/blood/attackby(obj/item/I, mob/user, params)
if (istype(I, /obj/item/pen) || istype(I, /obj/item/toy/crayon))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the label of [src]!</span>")
return
var/t = stripped_input(user, "What would you like to label the blood pack?", name, null, 53)
if(!user.canUseTopic(src))
if(!user.canUseTopic(src, BE_CLOSE))
return
if(user.get_active_held_item() != I)
return
if(loc != user)
return
if(t)
labelled = 1
name = "blood pack - [t]"

View File

@@ -33,7 +33,12 @@
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
to_chat(user, "<span class='warning'>Invalid text!</span>")
return
@@ -114,7 +119,12 @@
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
to_chat(user, "<span class='warning'>Invalid text!</span>")
return