There were a bunch of boxes that had their own special code when they all do the same thing. So I've merged them into proper storage items.

Boxes affected:
- Donut boxes
- Egg cartons
- Candle packs
- Match boxes
- Snap pop boxes
- Monkey cube boxes

Items I didn't merge:
- Pizza boxes
- Cigarette packs

Pizza boxes are a whole new kind of 'special snowflake code' that is best left the way it is. Cigarette packs involve some stuff I'm unfamiliar with so that can wait until I learn what I need to learn.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4452 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-08-17 00:35:01 +00:00
parent cac628a640
commit 852b838e4e
17 changed files with 459 additions and 855 deletions
+106
View File
@@ -0,0 +1,106 @@
/*
* The 'fancy' path is for objects like donut boxes that show how many items are in the storage item on the sprite itself
* .. Sorry for the shitty path name, I couldnt think of a better one.
*
* WARNING: var/icon_type is used for both examine text and sprite name. Please look at the procs below and adjust your sprite names accordingly
*
* Contains:
* Donut Box
* Egg Box
* Candle Box
*/
/obj/item/weapon/storage/fancy/
icon = 'icons/obj/food.dmi'
icon_state = "donutbox6"
name = "donut box"
var/icon_type = "donut"
/obj/item/weapon/storage/fancy/attack_hand(mob/user as mob)
..()
update_icon()
return
/obj/item/weapon/storage/fancy/attackby(obj/item/W as obj, mob/user as mob)
..()
update_icon()
return
/obj/item/weapon/storage/fancy/update_icon(var/itemremoved = 0)
var/total_contents = src.contents.len - itemremoved
src.icon_state = "[src.icon_type]box[total_contents]"
return
/obj/item/weapon/storage/fancy/examine()
set src in oview(1)
if(contents.len <= 0)
usr << "There are no [src.icon_type]s left in the box."
else if(contents.len == 1)
usr << "There is one [src.icon_type] left in the box."
else
usr << "There are [src.contents.len] [src.icon_type]s in the box."
return
/*
* Donut Box
*/
/obj/item/weapon/storage/fancy/donut_box
icon = 'icons/obj/food.dmi'
icon_state = "donutbox6"
icon_type = "donut"
name = "donut box"
storage_slots = 6
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks/donut")
/obj/item/weapon/storage/fancy/donut_box/New()
..()
for(var/i=1; i <= storage_slots; i++)
new /obj/item/weapon/reagent_containers/food/snacks/donut/normal(src)
return
/*
* Egg Box
*/
/obj/item/weapon/storage/fancy/egg_box
icon = 'icons/obj/food.dmi'
icon_state = "eggbox"
icon_type = "egg"
name = "egg box"
storage_slots = 12
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks/egg")
/obj/item/weapon/storage/fancy/egg_box/New()
..()
for(var/i=1; i <= storage_slots; i++)
new /obj/item/weapon/reagent_containers/food/snacks/egg(src)
return
/*
* Candle Box
*/
/obj/item/weapon/storage/fancy/candle_box
name = "Candle pack"
desc = "A pack of red candles."
icon = 'icons/obj/candle.dmi'
icon_state = "candlebox5"
icon_type = "candle"
item_state = "candlebox5"
storage_slots = 5
throwforce = 2
flags = TABLEPASS
slot_flags = SLOT_BELT
/obj/item/weapon/storage/fancy/candle_box/New()
..()
for(var/i=1; i <= storage_slots; i++)
new /obj/item/candle(src)
return
+72
View File
@@ -0,0 +1,72 @@
/*
* Contains:
* Monkey Cube Box
* Candle Packs
* Snap Pop Box
*/
/*
* Monkey Cube Box
*/
/obj/item/weapon/storage/monkeycube_box
name = "monkey cube box"
desc = "Drymate brand monkey cubes. Just add water!"
icon = 'icons/obj/food.dmi'
icon_state = "monkeycubebox"
storage_slots = 7
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks/monkeycube")
/obj/item/weapon/storage/monkeycube_box/New()
..()
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
return
/*
* Snap Pop Box
*/
/obj/item/weapon/storage/snappopbox
name = "snap pop box"
desc = "Eight wrappers of fun! Ages 8 and up. Not suitable for children."
icon = 'icons/obj/toy.dmi'
icon_state = "spbox"
storage_slots = 8
can_hold = list("/obj/item/toy/snappop")
/obj/item/weapon/storage/snappopbox/New()
..()
for(var/i=1; i <= storage_slots; i++)
new /obj/item/toy/snappop(src)
/*
* Match Box
*/
/obj/item/weapon/storage/matchbox
name = "Matchbox"
desc = "A small box of Almost But Not Quite Plasma Premium Matches."
icon = 'icons/obj/cigarettes.dmi'
icon_state = "matchbox"
item_state = "zippo"
storage_slots = 10
w_class = 1
flags = TABLEPASS
slot_flags = SLOT_BELT
/obj/item/weapon/storage/matchbox/New()
..()
for(var/i=1; i <= storage_slots; i++)
new /obj/item/weapon/match(src)
return
/obj/item/weapon/storage/matchbox/attackby(obj/item/weapon/match/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/match) && W.lit == 0)
W.lit = 1
W.icon_state = "match_lit"
processing_objects.Add(W)
W.update_icon()
return
+5
View File
@@ -230,6 +230,11 @@
//Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target
/obj/item/weapon/storage/proc/remove_from_storage(obj/item/W as obj, atom/new_location)
if(!istype(W)) return
if(istype(src, /obj/item/weapon/storage/fancy))
var/obj/item/weapon/storage/fancy/F = src
F.update_icon(1)
for(var/mob/M in range(1, src.loc))
if (M.s_active == src.loc)
if (M.client)