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 11:43:15 -08:00
committed by GitHub
parent b797f85a49
commit 1683c4271a
27 changed files with 186 additions and 268 deletions
@@ -55,12 +55,11 @@
/obj/structure/door_assembly/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
var/t = copytext(stripped_input(user, "Enter the name for the door.", name, created_name),1,MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)
return
created_name = t
// The door assembly gets renamed to "Assembly - Foobar",
// but the `t` returned from the proc is just "Foobar" without the prefix.
var/t = rename_interactive(user, W)
if(!isnull(t))
created_name = t
return
else if(iscoil(W) && state == AIRLOCK_ASSEMBLY_NEEDS_WIRES && anchored)
+5 -20
View File
@@ -125,18 +125,12 @@
/obj/structure/morgue/attackby(P as obj, mob/user as mob, params)
if(istype(P, /obj/item/pen))
var/t = input(user, "What would you like the label to be?", text("[]", name), null) as text
if(user.get_active_hand() != P)
var/t = rename_interactive(user, P)
if(isnull(t))
return
if((!in_range(src, usr) && loc != user))
return
t = sanitize(copytext(t,1,MAX_MESSAGE_LEN))
cut_overlays()
if(t)
name = text("Morgue- '[]'", t)
overlays += image(icon, "morgue_label")
else
name = "Morgue"
overlays.Cut()
add_overlay(image(icon, "morgue_label"))
add_fingerprint(user)
return
return ..()
@@ -325,16 +319,7 @@
/obj/structure/crematorium/attackby(P as obj, mob/user as mob, params)
if(istype(P, /obj/item/pen))
var/t = input(user, "What would you like the label to be?", text("[]", name), null) as text
if(user.get_active_hand() != P)
return
if((!in_range(src, usr) > 1 && loc != user))
return
t = sanitize(copytext(t,1,MAX_MESSAGE_LEN))
if(t)
name = text("Crematorium- '[]'", t)
else
name = "Crematorium"
rename_interactive(user, P)
add_fingerprint(user)
return
return ..()
@@ -148,12 +148,9 @@
W.forceMove(loc)
else if(istype(W, /obj/item/pen))
var/t = stripped_input(user, "Enter the name for the door.", name, created_name,MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)
return
created_name = t
var/t = rename_interactive(user, W)
if(!isnull(t))
created_name = t
return
else
return ..()