Beaker and Pill Bottle Labeling

Can now label Pill Bottles with pens, just like Beakers

Beakers (and pill bottles) can now accept 26 character labels from pens.
This commit is contained in:
FalseIncarnate
2016-04-01 15:17:47 -04:00
parent 2338cfecfe
commit 777f8cbfb6
2 changed files with 26 additions and 3 deletions
@@ -215,9 +215,14 @@
use_to_pickup = 1
storage_slots = 14
display_contents_with_number = 1
var/base_name = ""
var/label_text = ""
/obj/item/weapon/storage/pill_bottle/New()
..()
base_name = name
/obj/item/weapon/storage/pill_bottle/MouseDrop(obj/over_object as obj) //Quick pillbottle fix. -Agouri
if (ishuman(usr)) //Can monkeys even place items in the pocket slots? Leaving this in just in case~
var/mob/M = usr
if (!( istype(over_object, /obj/screen) ))
@@ -239,6 +244,24 @@
return
return
/obj/item/weapon/storage/pill_bottle/attackby(var/obj/item/I, mob/user as mob, params)
if(istype(I, /obj/item/weapon/pen) || istype(I, /obj/item/device/flashlight/pen))
var/tmp_label = sanitize(input(user, "Enter a label for [name]","Label",label_text))
if(length(tmp_label) > MAX_NAME_LEN)
user << "<span class='warning'>The label can be at most [MAX_NAME_LEN] characters long.</span>"
else
user << "<span class='notice'>You set the label to \"[tmp_label]\".</span>"
label_text = tmp_label
update_name_label()
else
..()
/obj/item/weapon/storage/pill_bottle/proc/update_name_label()
if(label_text == "")
name = base_name
else
name = "[base_name] ([label_text])"
/obj/item/weapon/storage/pill_bottle/charcoal
name = "Pill bottle (Charcoal)"
desc = "Contains pills used to counter toxins."