TG Label Component Port (#13449)

* TG Label Component Port

* every time I swear
This commit is contained in:
Fox McCloud
2020-05-24 13:55:05 -04:00
committed by GitHub
parent bf796cf8fc
commit 40baacc405
7 changed files with 114 additions and 3 deletions
+22 -2
View File
@@ -1,11 +1,12 @@
/obj/item/hand_labeler
name = "hand labeler"
desc = "A combined label printer, applicator, and remover, all in a single portable device. Designed to be easy to operate and use."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "labeler0"
item_state = "flight"
var/label = null
var/labels_left = 30
var/mode = 0 //off or on.
var/mode = 0
/obj/item/hand_labeler/afterattack(atom/A, mob/user, proximity)
if(!proximity)
@@ -29,7 +30,9 @@
user.visible_message("<span class='notice'>[user] labels [A] as [label].</span>", \
"<span class='notice'>You label [A] as [label].</span>")
investigate_log("[key_name(user)] labelled [A] as [label].", INVESTIGATE_LABEL) // Investigate goes BEFORE rename so the original name is preserved in the log
A.name = "[A.name] ([label])"
A.AddComponent(/datum/component/label, label)
playsound(A, 'sound/items/handling/component_pickup.ogg', 20, TRUE)
labels_left--
/obj/item/hand_labeler/attack_self(mob/user as mob)
mode = !mode
@@ -45,3 +48,20 @@
to_chat(user, "<span class='notice'>You set the text to '[str]'.</span>")
else
to_chat(user, "<span class='notice'>You turn off \the [src].</span>")
/obj/item/hand_labeler/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/hand_labeler_refill))
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
user.drop_item()
qdel(I)
labels_left = initial(labels_left) //Yes, it's capped at its initial value
else
return ..()
/obj/item/hand_labeler_refill
name = "hand labeler paper roll"
icon = 'icons/obj/bureaucracy.dmi'
desc = "A roll of paper. Use it on a hand labeler to refill it."
icon_state = "labeler_refill"
item_state = "electropack"
w_class = WEIGHT_CLASS_TINY