From 0195f03435cff64e42d0c839fa143eea447c5a11 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Thu, 15 Feb 2018 17:09:16 -0500 Subject: [PATCH] [s]Fixes writing bugs/exploits (#35552) * literacy crisis * cleanup --- code/game/machinery/newscaster.dm | 5 ++- .../objects/items/implants/implantcase.dm | 5 ++- code/game/objects/items/implants/implanter.dm | 5 ++- code/game/objects/items/signs.dm | 5 ++- .../crates_lockers/closets/bodybag.dm | 5 ++- code/game/objects/structures/morgue.dm | 5 ++- code/modules/events/holiday/vday.dm | 5 +++ code/modules/food_and_drinks/pizzabox.dm | 5 +++ code/modules/games/cas.dm | 5 ++- code/modules/library/lib_items.dm | 31 ++++++++++++++----- code/modules/paperwork/folders.dm | 5 ++- code/modules/paperwork/paper.dm | 5 +-- code/modules/paperwork/photography.dm | 5 ++- .../reagents/reagent_containers/blood_pack.dm | 8 ++--- code/modules/recycling/sortingmachinery.dm | 10 ++++++ 15 files changed, 87 insertions(+), 22 deletions(-) diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index c15e26a5cf3..91eedfd9046 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -1040,13 +1040,16 @@ GLOBAL_LIST_EMPTY(allCasters) /obj/item/newspaper/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on [src]!") + return if(scribble_page == curr_page) to_chat(user, "There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?") else var/s = stripped_input(user, "Write something", "Newspaper") if (!s) return - if (!in_range(src, usr) && loc != usr) + if(!user.canUseTopic(src, BE_CLOSE)) return scribble_page = curr_page scribble = s diff --git a/code/game/objects/items/implants/implantcase.dm b/code/game/objects/items/implants/implantcase.dm index 00bda4dadbb..e26f38d7922 100644 --- a/code/game/objects/items/implants/implantcase.dm +++ b/code/game/objects/items/implants/implantcase.dm @@ -25,10 +25,13 @@ /obj/item/implantcase/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on the side of [src]!") + return var/t = stripped_input(user, "What would you like the label to be?", name, null) if(user.get_active_held_item() != W) return - if(!in_range(src, user) && loc != user) + if(!user.canUseTopic(src, BE_CLOSE)) return if(t) name = "implant case - '[t]'" diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index 99f016c8cca..528905be1e7 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -43,10 +43,13 @@ /obj/item/implanter/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You prod at [src] with [W]!") + return var/t = stripped_input(user, "What would you like the label to be?", name, null) if(user.get_active_held_item() != W) return - if(!in_range(src, user) && loc != user) + if(!user.canUseTopic(src, BE_CLOSE)) return if(t) name = "implanter ([t])" diff --git a/code/game/objects/items/signs.dm b/code/game/objects/items/signs.dm index 65716f2f305..2b00114ef87 100644 --- a/code/game/objects/items/signs.dm +++ b/code/game/objects/items/signs.dm @@ -18,8 +18,11 @@ actions_types = list(/datum/action/item_action/nano_picket_sign) /obj/item/picket_sign/proc/retext(mob/user) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on [src]!") + return var/txt = stripped_input(user, "What would you like to write on the sign?", "Sign Label", null , 30) - if(txt && Adjacent(user)) + if(txt && user.canUseTopic(src, BE_CLOSE)) label = txt name = "[label] sign" desc = "It reads: [label]" diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 9ca3fa96c8f..b82aaf8a2d0 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -17,10 +17,13 @@ /obj/structure/closet/body_bag/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, "You scribble illegibly on [src]!") + return var/t = stripped_input(user, "What would you like the label to be?", name, null, 53) if(user.get_active_held_item() != I) return - if(!in_range(src, user) && loc != user) + if(!user.canUseTopic(src, BE_CLOSE)) return if(t) name = "body bag - [t]" diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index e6cc6a15f65..06ca9152542 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -81,10 +81,13 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an /obj/structure/bodycontainer/attackby(obj/P, mob/user, params) add_fingerprint(user) if(istype(P, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on the side of [src]!") + return var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null) if (user.get_active_held_item() != P) return - if ((!in_range(src, usr) && src.loc != user)) + if(!user.canUseTopic(src, BE_CLOSE)) return if (t) name = text("[]- '[]'", initial(name), t) diff --git a/code/modules/events/holiday/vday.dm b/code/modules/events/holiday/vday.dm index 25464ba297b..4de50698592 100644 --- a/code/modules/events/holiday/vday.dm +++ b/code/modules/events/holiday/vday.dm @@ -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, "You scribble illegibly on [src]!") + 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]" diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index cc14864d110..928cc52fa8b 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -197,8 +197,13 @@ to_chat(user, "[src] already has a bomb in it!") else if(istype(I, /obj/item/pen)) if(!open) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on [src]!") + 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, "You write with [I] on [src].") update_icon() return diff --git a/code/modules/games/cas.dm b/code/modules/games/cas.dm index f5b4d8a86f8..39772b12162 100644 --- a/code/modules/games/cas.dm +++ b/code/modules/games/cas.dm @@ -143,11 +143,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, "You scribble illegibly on [src]!") + 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 diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 2b9ed28842f..7ecb0529ba2 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -93,7 +93,12 @@ to_chat(user, "You empty \the [I] into \the [src].") update_icon() else if(istype(I, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on the side of [src]!") + 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, "These pages don't seem to take the ink well! Looks like you can't modify it.") return + var/literate = user.is_literate() + if(!literate) + to_chat(user, "You scribble illegibly on the cover of [src]!") + 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 diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 5b15a309515..899c132f040 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -41,8 +41,11 @@ to_chat(user, "You put [W] into [src].") update_icon() else if(istype(W, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, "You scribble illegibly on the cover of [src]!") + 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)]" diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 312c789f07c..b9c21e10902 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -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 diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index b28b0768129..19a83f9770b 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -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, "You scribble illegibly on [src]!") + 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 ..() diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 85f99fb99a9..31e893aa3a7 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -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, "You scribble illegibly on the label of [src]!") + 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]" diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index c8d626b2d53..a32f5bf576e 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -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, "You scribble illegibly on the side of [src]!") + 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, "Invalid text!") 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, "You scribble illegibly on the side of [src]!") + 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, "Invalid text!") return