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
+4 -1
View File
@@ -1040,13 +1040,16 @@ GLOBAL_LIST_EMPTY(allCasters)
/obj/item/newspaper/attackby(obj/item/W, mob/user, params) /obj/item/newspaper/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen)) if(istype(W, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
if(scribble_page == curr_page) if(scribble_page == curr_page)
to_chat(user, "<span class='notice'>There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?</span>") to_chat(user, "<span class='notice'>There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?</span>")
else else
var/s = stripped_input(user, "Write something", "Newspaper") var/s = stripped_input(user, "Write something", "Newspaper")
if (!s) if (!s)
return return
if (!in_range(src, usr) && loc != usr) if(!user.canUseTopic(src, BE_CLOSE))
return return
scribble_page = curr_page scribble_page = curr_page
scribble = s scribble = s
@@ -25,10 +25,13 @@
/obj/item/implantcase/attackby(obj/item/W, mob/user, params) /obj/item/implantcase/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen)) 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/t = stripped_input(user, "What would you like the label to be?", name, null) var/t = stripped_input(user, "What would you like the label to be?", name, null)
if(user.get_active_held_item() != W) if(user.get_active_held_item() != W)
return return
if(!in_range(src, user) && loc != user) if(!user.canUseTopic(src, BE_CLOSE))
return return
if(t) if(t)
name = "implant case - '[t]'" name = "implant case - '[t]'"
+73 -70
View File
@@ -1,70 +1,73 @@
/obj/item/implanter /obj/item/implanter
name = "implanter" name = "implanter"
desc = "A sterile automatic implant injector." desc = "A sterile automatic implant injector."
icon = 'icons/obj/items_and_weapons.dmi' icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "implanter0" icon_state = "implanter0"
item_state = "syringe_0" item_state = "syringe_0"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi' lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi' righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3 throw_speed = 3
throw_range = 5 throw_range = 5
w_class = WEIGHT_CLASS_SMALL w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=600, MAT_GLASS=200) materials = list(MAT_METAL=600, MAT_GLASS=200)
var/obj/item/implant/imp = null var/obj/item/implant/imp = null
var/imp_type = null var/imp_type = null
/obj/item/implanter/update_icon() /obj/item/implanter/update_icon()
if(imp) if(imp)
icon_state = "implanter1" icon_state = "implanter1"
else else
icon_state = "implanter0" icon_state = "implanter0"
/obj/item/implanter/attack(mob/living/M, mob/user) /obj/item/implanter/attack(mob/living/M, mob/user)
if(!istype(M)) if(!istype(M))
return return
if(user && imp) if(user && imp)
if(M != user) if(M != user)
M.visible_message("<span class='warning'>[user] is attempting to implant [M].</span>") M.visible_message("<span class='warning'>[user] is attempting to implant [M].</span>")
var/turf/T = get_turf(M) var/turf/T = get_turf(M)
if(T && (M == user || do_mob(user, M, 50))) if(T && (M == user || do_mob(user, M, 50)))
if(src && imp) if(src && imp)
if(imp.implant(M, user)) if(imp.implant(M, user))
if (M == user) if (M == user)
to_chat(user, "<span class='notice'>You implant yourself.</span>") to_chat(user, "<span class='notice'>You implant yourself.</span>")
else else
M.visible_message("[user] has implanted [M].", "<span class='notice'>[user] implants you.</span>") M.visible_message("[user] has implanted [M].", "<span class='notice'>[user] implants you.</span>")
imp = null imp = null
update_icon() update_icon()
else else
to_chat(user, "<span class='warning'>[src] fails to implant [M].</span>") to_chat(user, "<span class='warning'>[src] fails to implant [M].</span>")
/obj/item/implanter/attackby(obj/item/W, mob/user, params) /obj/item/implanter/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen)) if(istype(W, /obj/item/pen))
var/t = stripped_input(user, "What would you like the label to be?", name, null) if(!user.is_literate())
if(user.get_active_held_item() != W) to_chat(user, "<span class='notice'>You prod at [src] with [W]!</span>")
return return
if(!in_range(src, user) && loc != user) var/t = stripped_input(user, "What would you like the label to be?", name, null)
return if(user.get_active_held_item() != W)
if(t) return
name = "implanter ([t])" if(!user.canUseTopic(src, BE_CLOSE))
else return
name = "implanter" if(t)
else name = "implanter ([t])"
return ..() else
name = "implanter"
/obj/item/implanter/Initialize(mapload) else
. = ..() return ..()
if(imp_type)
imp = new imp_type(src) /obj/item/implanter/Initialize(mapload)
update_icon() . = ..()
if(imp_type)
/obj/item/implanter/adrenalin imp = new imp_type(src)
name = "implanter (adrenalin)" update_icon()
imp_type = /obj/item/implant/adrenalin
/obj/item/implanter/adrenalin
/obj/item/implanter/emp name = "implanter (adrenalin)"
name = "implanter (EMP)" imp_type = /obj/item/implant/adrenalin
imp_type = /obj/item/implant/emp
/obj/item/implanter/emp
name = "implanter (EMP)"
imp_type = /obj/item/implant/emp
+4 -1
View File
@@ -18,8 +18,11 @@
actions_types = list(/datum/action/item_action/nano_picket_sign) actions_types = list(/datum/action/item_action/nano_picket_sign)
/obj/item/picket_sign/proc/retext(mob/user) /obj/item/picket_sign/proc/retext(mob/user)
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
var/txt = stripped_input(user, "What would you like to write on the sign?", "Sign Label", null , 30) 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 label = txt
name = "[label] sign" name = "[label] sign"
desc = "It reads: [label]" desc = "It reads: [label]"
@@ -17,10 +17,13 @@
/obj/structure/closet/body_bag/attackby(obj/item/I, mob/user, params) /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 (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 [src]!</span>")
return
var/t = stripped_input(user, "What would you like the label to be?", name, null, 53) var/t = stripped_input(user, "What would you like the label to be?", name, null, 53)
if(user.get_active_held_item() != I) if(user.get_active_held_item() != I)
return return
if(!in_range(src, user) && loc != user) if(!user.canUseTopic(src, BE_CLOSE))
return return
if(t) if(t)
name = "body bag - [t]" name = "body bag - [t]"
+4 -1
View File
@@ -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) /obj/structure/bodycontainer/attackby(obj/P, mob/user, params)
add_fingerprint(user) add_fingerprint(user)
if(istype(P, /obj/item/pen)) if(istype(P, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null) var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null)
if (user.get_active_held_item() != P) if (user.get_active_held_item() != P)
return return
if ((!in_range(src, usr) && src.loc != user)) if(!user.canUseTopic(src, BE_CLOSE))
return return
if (t) if (t)
name = text("[]- '[]'", initial(name), t) name = text("[]- '[]'", initial(name), t)
+5
View File
@@ -137,8 +137,13 @@
/obj/item/valentine/attackby(obj/item/W, mob/user, params) /obj/item/valentine/attackby(obj/item/W, mob/user, params)
..() ..()
if(istype(W, /obj/item/pen) || istype(W, /obj/item/toy/crayon)) 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/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) var/sender = stripped_input(user, "Who is sending this valentine?", "From:", null , 20)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(recipient && sender) if(recipient && sender)
name = "valentine - To: [recipient] From: [sender]" name = "valentine - To: [recipient] From: [sender]"
+5
View File
@@ -197,8 +197,13 @@
to_chat(user, "<span class='notice'>[src] already has a bomb in it!</span>") to_chat(user, "<span class='notice'>[src] already has a bomb in it!</span>")
else if(istype(I, /obj/item/pen)) else if(istype(I, /obj/item/pen))
if(!open) 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 var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src
box.boxtag += stripped_input(user, "Write on [box]'s tag:", box, "", 30) 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>") to_chat(user, "<span class='notice'>You write with [I] on [src].</span>")
update_icon() update_icon()
return return
+4 -1
View File
@@ -139,11 +139,14 @@
/obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params) /obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/pen)) 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) if(!blank)
to_chat(user, "You cannot write on that card.") to_chat(user, "You cannot write on that card.")
return return
var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50) 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 return
name = cardtext name = cardtext
buffertext = cardtext buffertext = cardtext
+24 -7
View File
@@ -93,7 +93,12 @@
to_chat(user, "<span class='notice'>You empty \the [I] into \the [src].</span>") to_chat(user, "<span class='notice'>You empty \the [I] into \the [src].</span>")
update_icon() update_icon()
else if(istype(I, /obj/item/pen)) 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?") var/newname = stripped_input(user, "What would you like to title this bookshelf?")
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!newname) if(!newname)
return return
else else
@@ -214,30 +219,42 @@
if(unique) 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>") 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 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") 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) switch(choice)
if("Title") 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) 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 return
if(!newtitle) if(!newtitle)
to_chat(usr, "That title is invalid.") to_chat(user, "That title is invalid.")
return return
else else
name = newtitle name = newtitle
title = newtitle title = newtitle
if("Contents") 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) if(!content)
to_chat(usr, "The content is invalid.") to_chat(user, "The content is invalid.")
return return
else else
dat += content dat += content
if("Author") 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) if(!newauthor)
to_chat(usr, "The name is invalid.") to_chat(user, "The name is invalid.")
return return
else else
author = newauthor author = newauthor
+4 -1
View File
@@ -41,8 +41,11 @@
to_chat(user, "<span class='notice'>You put [W] into [src].</span>") to_chat(user, "<span class='notice'>You put [W] into [src].</span>")
update_icon() update_icon()
else if(istype(W, /obj/item/pen)) 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) 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)]" name = "folder[(n_name ? " - '[n_name]'" : null)]"
+3 -2
View File
@@ -244,7 +244,8 @@
/obj/item/paper/Topic(href, href_list) /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 return
if(href_list["help"]) if(href_list["help"])
@@ -253,7 +254,7 @@
if(href_list["write"]) if(href_list["write"])
var/id = href_list["write"] var/id = href_list["write"]
var/t = stripped_multiline_input("Enter what you want to write:", "Write", no_trim=TRUE) 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 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/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 var/iscrayon = 0
+4 -1
View File
@@ -54,9 +54,12 @@
/obj/item/photo/attackby(obj/item/P, mob/user, params) /obj/item/photo/attackby(obj/item/P, mob/user, params)
if(istype(P, /obj/item/pen) || istype(P, /obj/item/toy/crayon)) 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) var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text)
txt = copytext(txt, 1, 128) txt = copytext(txt, 1, 128)
if(loc == user && user.stat == CONSCIOUS) if(user.canUseTopic(src, BE_CLOSE))
scribble = txt scribble = txt
..() ..()
@@ -74,14 +74,14 @@
/obj/item/reagent_containers/blood/attackby(obj/item/I, mob/user, params) /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 (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) 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 return
if(user.get_active_held_item() != I) if(user.get_active_held_item() != I)
return return
if(loc != user)
return
if(t) if(t)
labelled = 1 labelled = 1
name = "blood pack - [t]" name = "blood pack - [t]"
@@ -33,7 +33,12 @@
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1) playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/pen)) 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) 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)) if(!str || !length(str))
to_chat(user, "<span class='warning'>Invalid text!</span>") to_chat(user, "<span class='warning'>Invalid text!</span>")
return return
@@ -114,7 +119,12 @@
playsound(loc, 'sound/machines/twobeep.ogg', 100, 1) playsound(loc, 'sound/machines/twobeep.ogg', 100, 1)
else if(istype(W, /obj/item/pen)) 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) 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)) if(!str || !length(str))
to_chat(user, "<span class='warning'>Invalid text!</span>") to_chat(user, "<span class='warning'>Invalid text!</span>")
return return