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

@@ -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, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
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>")
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

View File

@@ -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, "<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)
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]'"

View File

@@ -1,70 +1,73 @@
/obj/item/implanter
name = "implanter"
desc = "A sterile automatic implant injector."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "implanter0"
item_state = "syringe_0"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=600, MAT_GLASS=200)
var/obj/item/implant/imp = null
var/imp_type = null
/obj/item/implanter/update_icon()
if(imp)
icon_state = "implanter1"
else
icon_state = "implanter0"
/obj/item/implanter/attack(mob/living/M, mob/user)
if(!istype(M))
return
if(user && imp)
if(M != user)
M.visible_message("<span class='warning'>[user] is attempting to implant [M].</span>")
var/turf/T = get_turf(M)
if(T && (M == user || do_mob(user, M, 50)))
if(src && imp)
if(imp.implant(M, user))
if (M == user)
to_chat(user, "<span class='notice'>You implant yourself.</span>")
else
M.visible_message("[user] has implanted [M].", "<span class='notice'>[user] implants you.</span>")
imp = null
update_icon()
else
to_chat(user, "<span class='warning'>[src] fails to implant [M].</span>")
/obj/item/implanter/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
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)
return
if(t)
name = "implanter ([t])"
else
name = "implanter"
else
return ..()
/obj/item/implanter/Initialize(mapload)
. = ..()
if(imp_type)
imp = new imp_type(src)
update_icon()
/obj/item/implanter/adrenalin
name = "implanter (adrenalin)"
imp_type = /obj/item/implant/adrenalin
/obj/item/implanter/emp
name = "implanter (EMP)"
imp_type = /obj/item/implant/emp
/obj/item/implanter
name = "implanter"
desc = "A sterile automatic implant injector."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "implanter0"
item_state = "syringe_0"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=600, MAT_GLASS=200)
var/obj/item/implant/imp = null
var/imp_type = null
/obj/item/implanter/update_icon()
if(imp)
icon_state = "implanter1"
else
icon_state = "implanter0"
/obj/item/implanter/attack(mob/living/M, mob/user)
if(!istype(M))
return
if(user && imp)
if(M != user)
M.visible_message("<span class='warning'>[user] is attempting to implant [M].</span>")
var/turf/T = get_turf(M)
if(T && (M == user || do_mob(user, M, 50)))
if(src && imp)
if(imp.implant(M, user))
if (M == user)
to_chat(user, "<span class='notice'>You implant yourself.</span>")
else
M.visible_message("[user] has implanted [M].", "<span class='notice'>[user] implants you.</span>")
imp = null
update_icon()
else
to_chat(user, "<span class='warning'>[src] fails to implant [M].</span>")
/obj/item/implanter/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
if(!user.is_literate())
to_chat(user, "<span class='notice'>You prod at [src] with [W]!</span>")
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(!user.canUseTopic(src, BE_CLOSE))
return
if(t)
name = "implanter ([t])"
else
name = "implanter"
else
return ..()
/obj/item/implanter/Initialize(mapload)
. = ..()
if(imp_type)
imp = new imp_type(src)
update_icon()
/obj/item/implanter/adrenalin
name = "implanter (adrenalin)"
imp_type = /obj/item/implant/adrenalin
/obj/item/implanter/emp
name = "implanter (EMP)"
imp_type = /obj/item/implant/emp

View File

@@ -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, "<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)
if(txt && Adjacent(user))
if(txt && user.canUseTopic(src, BE_CLOSE))
label = txt
name = "[label] sign"
desc = "It reads: [label]"

View File

@@ -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, "<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)
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]"

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)
add_fingerprint(user)
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)
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)

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