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
+6 -2
View File
@@ -241,12 +241,16 @@
user.Weaken(5)
return
/obj/item/toy/crayonbox
/obj/item/weapon/storage/crayonbox
name = "box of crayons"
desc = "A box of crayons for all your drawing needs."
desc = "A box of crayons for all your rune drawing needs."
icon = 'crayons.dmi'
icon_state = "crayonbox"
w_class = 2.0
storage_slots = 6
can_hold = list(
"/obj/item/toy/crayon"
)
/obj/item/toy/crayon
name = "crayon"
+1 -1
View File
@@ -143,7 +143,7 @@
new /obj/item/clothing/suit/syndicatefake(src.loc)
new /obj/item/clothing/head/syndicatefake(src.loc)
if(8)
new /obj/item/toy/crayonbox(src.loc)
new /obj/item/weapon/storage/crayonbox(src.loc)
if(9)
new /obj/item/toy/spinningtoy(src.loc)
// if(10) //Commented out on Urist-chan's orders~
+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."
+2 -2
View File
@@ -873,7 +873,7 @@
"aqO" = (/obj/item/device/radio/intercom{name = "Station Intercom (General)"; pixel_y = -29},/turf/simulated/floor{icon_state = "carpet"},/area/crew_quarters)
"aqP" = (/turf/simulated/floor,/area/crew_quarters)
"aqQ" = (/obj/structure/stool{pixel_y = 8},/turf/simulated/floor,/area/crew_quarters)
"aqR" = (/obj/structure/table/woodentable,/obj/item/toy/crayonbox,/turf/simulated/floor,/area/crew_quarters)
"aqR" = (/obj/structure/table/woodentable,/obj/item/weapon/storage/crayonbox,/turf/simulated/floor,/area/crew_quarters)
"aqS" = (/obj/structure/table/woodentable,/turf/simulated/floor,/area/crew_quarters)
"aqT" = (/obj/structure/table/woodentable,/obj/item/weapon/rag,/turf/simulated/floor,/area/crew_quarters)
"aqU" = (/obj/structure/disposalpipe/segment,/obj/machinery/door/firedoor/border_only{dir = 8},/obj/machinery/door/window/northleft{base_state = "right"; dir = 8; icon_state = "right"},/turf/simulated/floor,/area/crew_quarters/fitness)
@@ -6388,7 +6388,7 @@
"csR" = (/obj/machinery/door/unpowered/shuttle,/turf/simulated/shuttle/floor{icon_state = "floor3"},/area/shuttle/escape/centcom)
"csS" = (/obj{anchored = 1; icon = 'shuttle.dmi'; icon_state = "floor"; layer = 1; name = "floor"},/turf/simulated/shuttle/wall{dir = 3; icon_state = "swall_f10"; layer = 2; tag = "icon-swall_f10"},/area/shuttle/escape/centcom)
"csT" = (/obj/structure/closet/emcloset,/turf/simulated/shuttle/floor{icon_state = "floor3"},/area/shuttle/escape/centcom)
"csU" = (/obj/structure/rack,/obj/item/toy/crayonbox,/turf/unsimulated/floor{icon_state = "cafeteria"; dir = 2},/area/centcom/holding)
"csU" = (/obj/structure/rack,/obj/item/weapon/storage/crayonbox,/turf/unsimulated/floor{icon_state = "cafeteria"; dir = 2},/area/centcom/holding)
"csV" = (/obj/machinery/vending/coffee,/obj/structure/window/reinforced{dir = 4},/turf/unsimulated/floor{icon_state = "cafeteria"; dir = 2},/area/centcom/holding)
"csW" = (/obj/effect/overlay{anchored = 1; icon = 'beach.dmi'; icon_state = "crab"; name = "crab"},/turf/unsimulated/floor{icon = 'icons/misc/beach2.dmi'; icon_state = "sandwater"},/area/centcom/holding)
"csX" = (/turf/unsimulated/floor{icon = 'icons/misc/beach2.dmi'; icon_state = "sandwater"},/area/centcom/holding)