Minor storage cleanup

Demotes folding to storage/box, makes doughnut boxes a subtype of box.
Removes a couple of istype() hacks from storage.
This commit is contained in:
mwerezak
2015-03-05 11:04:52 -05:00
parent 3bf5a5ca99
commit 9aed472531
8 changed files with 49 additions and 45 deletions
@@ -187,7 +187,7 @@ var/global/list/datum/stack_recipe/wood_recipes = list ( \
*/
var/global/list/datum/stack_recipe/cardboard_recipes = list ( \
new/datum/stack_recipe("box", /obj/item/weapon/storage/box), \
new/datum/stack_recipe("donut box", /obj/item/weapon/storage/donut_box/empty), \
new/datum/stack_recipe("donut box", /obj/item/weapon/storage/box/donut/empty), \
new/datum/stack_recipe("egg box", /obj/item/weapon/storage/fancy/egg_box), \
new/datum/stack_recipe("light tubes", /obj/item/weapon/storage/box/lights/tubes), \
new/datum/stack_recipe("light bulbs", /obj/item/weapon/storage/box/lights/bulbs), \
@@ -67,6 +67,12 @@
return
*/
..()
//Please don't clutter the parent storage item with stupid hacks.
can_be_inserted(obj/item/W as obj, stop_messages = 0)
if(istype(W, /obj/item/weapon/storage/backpack/holding))
return 1
return ..()
proc/failcheck(mob/user as mob)
if (prob(src.reliability)) return 1 //No failure
@@ -24,7 +24,31 @@
desc = "It's just an ordinary box."
icon_state = "box"
item_state = "syringe_kit"
foldable = /obj/item/stack/sheet/cardboard //BubbleWrap
var/foldable = null // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
// BubbleWrap - A box can be folded up to make card
/obj/item/weapon/storage/box/attack_self(mob/user as mob)
if(..()) return
//try to fold it.
if ( contents.len )
return
if ( !ispath(src.foldable) )
return
var/found = 0
// Close any open UI windows first
for(var/mob/M in range(1))
if (M.s_active == src)
src.close(M)
if ( M == user )
found = 1
if ( !found ) // User is too far away
return
// Now make the cardboard
user << "<span class='notice'>You fold [src] flat.</span>"
new src.foldable(get_turf(src))
del(src)
/obj/item/weapon/storage/box/survival/
New()
@@ -11,7 +11,7 @@
* Donut Box
*/
/obj/item/weapon/storage/donut_box
/obj/item/weapon/storage/box/donut
icon = 'icons/obj/food.dmi'
icon_state = "donutbox"
name = "donut box"
@@ -20,14 +20,14 @@
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/donut)
foldable = /obj/item/stack/sheet/cardboard
/obj/item/weapon/storage/donut_box/New()
/obj/item/weapon/storage/box/donut/New()
..()
for(var/i=1; i <= startswith; i++)
new /obj/item/weapon/reagent_containers/food/snacks/donut/normal(src)
update_icon()
return
/obj/item/weapon/storage/donut_box/update_icon()
/obj/item/weapon/storage/box/donut/update_icon()
overlays.Cut()
var/i = 0
for(var/obj/item/weapon/reagent_containers/food/snacks/donut/D in contents)
@@ -36,6 +36,6 @@
overlays += img
i++
/obj/item/weapon/storage/donut_box/empty
/obj/item/weapon/storage/box/donut/empty
icon_state = "donutbox0"
startswith = 0
@@ -21,7 +21,6 @@
var/allow_quick_empty //Set this variable to allow the object to have the 'empty' verb, which dumps all the contents on the floor.
var/allow_quick_gather //Set this variable to allow the object to have the 'toggle mode' verb, which quickly collects all items from a tile.
var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile
var/foldable = null // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
var/use_sound = "rustle" //sound played when used. null for no sound.
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj)
@@ -236,11 +235,9 @@
return 0
if(W.w_class >= src.w_class && (istype(W, /obj/item/weapon/storage)))
//TODO: remove hack
if(!istype(src, /obj/item/weapon/storage/backpack/holding)) //bohs should be able to hold backpacks again. The override for putting a boh in a boh is in backpack.dm.
if(!stop_messages)
usr << "<span class='notice'>[src] cannot hold [W] as it's a storage item of the same size.</span>"
return 0 //To prevent the stacking of same sized storage items.
if(!stop_messages)
usr << "<span class='notice'>[src] cannot hold [W] as it's a storage item of the same size.</span>"
return 0 //To prevent the stacking of same sized storage items.
return 1
@@ -260,7 +257,7 @@
W.dropped(usr)
add_fingerprint(usr)
if(!prevent_warning && !istype(W, /obj/item/weapon/gun/energy/crossbow))
if(!prevent_warning)
for(var/mob/M in viewers(usr, null))
if (M == usr)
usr << "<span class='notice'>You put \the [W] into [src].</span>"
@@ -416,35 +413,12 @@
O.emp_act(severity)
..()
// BubbleWrap - A box can be folded up to make card
/obj/item/weapon/storage/attack_self(mob/user as mob)
//Clicking on itself will empty it, if it has the verb to do that.
if(user.get_active_hand() == src)
if(src.verbs.Find(/obj/item/weapon/storage/verb/quick_empty))
src.quick_empty()
return
//Otherwise we'll try to fold it.
if ( contents.len )
return
if ( !ispath(src.foldable) )
return
var/found = 0
// Close any open UI windows first
for(var/mob/M in range(1))
if (M.s_active == src)
src.close(M)
if ( M == user )
found = 1
if ( !found ) // User is too far away
return
// Now make the cardboard
user << "<span class='notice'>You fold [src] flat.</span>"
new src.foldable(get_turf(src))
del(src)
//BubbleWrap END
return 1
/obj/item/weapon/storage/hear_talk(mob/M as mob, text, verb, datum/language/speaking)
for (var/atom/A in src)