Refactors renaming things with a pen. (#14960)

* Refactors renaming things with a pen.

* Farie review (thanks!!)

* Derp.

* Farie take 2
This commit is contained in:
moxian
2020-12-16 14:43:15 -05:00
committed by GitHub
parent b797f85a49
commit 1683c4271a
27 changed files with 186 additions and 268 deletions
@@ -29,15 +29,7 @@
/obj/item/implantcase/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_hand() != W)
return
if(!in_range(src, user) && loc != user)
return
if(t)
name = "implant case - '[t]'"
else
name = "implant case"
rename_interactive(user, W)
else if(istype(W, /obj/item/implanter))
var/obj/item/implanter/I = W
if(I.imp)
@@ -43,15 +43,7 @@
/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_hand() != W)
return
if(!in_range(src, user) && loc != user)
return
if(t)
name = "implanter ([t])"
else
name = "implanter"
rename_interactive(user, W)
/obj/item/implanter/New()
..()
@@ -317,22 +317,10 @@
/obj/item/storage/pill_bottle/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/pen) || istype(I, /obj/item/flashlight/pen))
var/tmp_label = sanitize(input(user, "Enter a label for [name]","Label",label_text))
if(length(tmp_label) > MAX_NAME_LEN)
to_chat(user, "<span class='warning'>The label can be at most [MAX_NAME_LEN] characters long.</span>")
else
to_chat(user, "<span class='notice'>You set the label to \"[tmp_label]\".</span>")
label_text = tmp_label
update_name_label()
rename_interactive(user, I)
else
return ..()
/obj/item/storage/pill_bottle/proc/update_name_label()
if(label_text == "")
name = base_name
else
name = "[base_name] ([label_text])"
/obj/item/storage/pill_bottle/patch_pack
name = "Patch Pack"
desc = "It's a container for storing medical patches."