TG: Crayon boxes are now storage items. I have no idea why they weren't storage

items to being with but now they are.
6 storage slots, can only hold crayons. Icon_state is properly updated when
crayons are taken out as well as when crayons are put in.

Updated uterus and 2.0.8 with the new type path, which is
/obj/item/weapon/storage/crayonbox
Revision: r3082
Author: 	 baloh.matevz
This commit is contained in:
Ren Erthilo
2012-04-22 19:29:03 +01:00
parent 8a78ec1575
commit b710813ed0
4 changed files with 49 additions and 34 deletions
+40 -29
View File
@@ -2,7 +2,7 @@
//CONTAINS
CRAYONS
--------*/
/obj/item/toy/crayonbox/New()
/obj/item/weapon/storage/crayonbox/New()
..()
new /obj/item/toy/crayon/red(src)
new /obj/item/toy/crayon/orange(src)
@@ -12,13 +12,13 @@ CRAYONS
new /obj/item/toy/crayon/purple(src)
updateIcon()
/obj/item/toy/crayonbox/proc/updateIcon()
/obj/item/weapon/storage/crayonbox/proc/updateIcon()
overlays = list() //resets list
overlays += image('crayons.dmi',"crayonbox")
for(var/obj/item/toy/crayon/crayon in contents)
overlays += image('crayons.dmi',crayon.colourName)
/obj/item/toy/crayonbox/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/weapon/storage/crayonbox/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/toy/crayon))
switch(W:colourName)
if("mime")
@@ -27,34 +27,37 @@ CRAYONS
if("rainbow")
usr << "This crayon is too powerful to be contained in this box."
return
else
usr << "You add the crayon to the box."
user.drop_item()
W.loc = src
add_fingerprint(user)
updateIcon()
return
else
..()
..()
updateIcon()
/obj/item/toy/crayonbox/attack_hand(mob/user as mob)
if(user.r_hand == src || user.l_hand == src)
if(!contents.len)
user << "\red You're out of crayons!"
/obj/item/weapon/storage/crayonbox/attack_hand(mob/user as mob)
updateIcon()
..()
/obj/item/weapon/storage/crayonbox/MouseDrop(obj/over_object as obj)
if (ishuman(usr) || ismonkey(usr))
var/mob/M = usr
if (!( istype(over_object, /obj/screen) ))
return ..()
if ((!( M.restrained() ) && !( M.stat )))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
M.u_equip(src)
M.r_hand = src
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_clothing()
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
if (usr.s_active)
usr.s_active.close(usr)
src.show_to(usr)
return
else
var/list/crayons = new()
for(var/obj/item/toy/crayon/C in contents)
crayons[C:colourName] = C
var/choice = input(user, "Pick a color:", "Crayon Box") in crayons as text|null
if(choice)
var/obj/crayon = crayons[choice]
user.put_in_hand(crayon)
user << "You take the [crayon:colourName] crayon out of the box."
updateIcon()
else
return ..()
icon_state = "crayonbox[contents.len]"
return
/obj/item/toy/crayon/red
@@ -157,6 +160,14 @@ CRAYONS
else
..()
/obj/item/toy/crayon/attack_hand(mob/user as mob)
var/obj/item/weapon/storage/crayonbox/CB
if(istype(src.loc, /obj/item/weapon/storage/crayonbox))
CB = src.loc
..()
if(CB)
CB.updateIcon()
/obj/effect/decal/cleanable/crayon
name = "rune"
desc = "A rune drawn in crayon."