Makes removable labels a thing (#2440)

Not sure if this is the best use of a variable! But in special cases, initial(name) doesn't work. And this is the next safer option!
This commit is contained in:
skull132
2017-05-24 20:50:11 +03:00
committed by GitHub
parent 8cca057344
commit ea071a4b24
4 changed files with 45 additions and 16 deletions

View File

@@ -376,21 +376,11 @@
return
/obj/machinery/portable_atmospherics/hydroponics/verb/remove_label()
/obj/machinery/portable_atmospherics/hydroponics/remove_label()
if(..())
labelled = null
update_icon()
set name = "Remove Label"
set category = "Object"
set src in view(1)
if(usr.incapacitated())
return
if(ishuman(usr) || istype(usr, /mob/living/silicon/robot))
if(labelled)
usr << "You remove the label."
labelled = null
update_icon()
else
usr << "There is no label to remove."
return
/obj/machinery/portable_atmospherics/hydroponics/verb/setlight()

View File

@@ -29,7 +29,6 @@
/obj/machinery/portable_atmospherics/hydroponics/soil/New()
..()
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid_verb
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/remove_label
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/setlight
/obj/machinery/portable_atmospherics/hydroponics/soil/CanPass()

View File

@@ -1,3 +1,31 @@
/atom/var/name_unlabel = ""
// Yes, this is totally worth a new variable and a proc!
/atom/proc/remove_label()
set name = "Remove Label"
set category = "Object"
set src in view(1)
if (!usr.IsAdvancedToolUser() || usr.incapacitated())
to_chat(usr, "<span class='notice'>You lack the dexerity to do this!</span>")
return FALSE
if (!name_unlabel)
to_chat(usr, "<span class='notice'>You look again, unable to find the label! Perhaps your eyes need checking?</span>")
src.verbs -= .proc/remove_label
return FALSE
var/mob/living/carbon/human/H = usr
name = name_unlabel
name_unlabel = ""
src.verbs -= .proc/remove_label
H.visible_message("<span class='notice'>\The [H] removes the label from \the [src].</span>",
"<span class='notice'>You remove the label from \the [src].</span>")
return TRUE
/obj/item/weapon/hand_labeler
name = "hand labeler"
icon = 'icons/obj/bureaucracy.dmi'
@@ -50,6 +78,12 @@
user.visible_message("<span class='notice'>[user] labels [A] as [label].</span>", \
"<span class='notice'>You label [A] as [label].</span>")
// Prevent label stacking from making name unrecoverable.
if (!A.name_unlabel)
A.name_unlabel = A.name
A.verbs += /atom/proc/remove_label
A.name = "[A.name] ([label])"
/obj/item/weapon/hand_labeler/attack_self(mob/user as mob)
@@ -65,4 +99,4 @@
label = str
user << "<span class='notice'>You set the text to '[str]'.</span>"
else
user << "<span class='notice'>You turn off \the [src].</span>"
user << "<span class='notice'>You turn off \the [src].</span>"

View File

@@ -0,0 +1,6 @@
author: Skull132
delete-after: True
changes:
- rscadd: "Labels added with the hand labeler can now be removed."