mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
Adds subtype friendly method to populate crates.
This commit is contained in:
9
code/_helpers/storage.dm
Normal file
9
code/_helpers/storage.dm
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/proc/create_objects_in_loc(var/atom/loc, var/list/item_paths)
|
||||||
|
if(!istype(loc))
|
||||||
|
CRASH("Inappropriate loction given.")
|
||||||
|
if(!istype(item_paths))
|
||||||
|
CRASH("Inappropriate item path list given.")
|
||||||
|
|
||||||
|
for(var/item_path in item_paths)
|
||||||
|
for(var/i = 1 to max(1, item_paths[item_path]))
|
||||||
|
new item_path(loc)
|
||||||
@@ -21,7 +21,13 @@
|
|||||||
var/store_items = 1
|
var/store_items = 1
|
||||||
var/store_mobs = 1
|
var/store_mobs = 1
|
||||||
|
|
||||||
|
var/list/will_contain
|
||||||
|
|
||||||
/obj/structure/closet/initialize()
|
/obj/structure/closet/initialize()
|
||||||
|
..()
|
||||||
|
if(will_contain)
|
||||||
|
create_objects_in_loc(src, will_contain)
|
||||||
|
|
||||||
if(!opened) // if closed, any item at the crate's loc is put in the contents
|
if(!opened) // if closed, any item at the crate's loc is put in the contents
|
||||||
var/obj/item/I
|
var/obj/item/I
|
||||||
for(I in src.loc)
|
for(I in src.loc)
|
||||||
|
|||||||
@@ -8,20 +8,7 @@
|
|||||||
icon_broken = "cabinetdetective_broken"
|
icon_broken = "cabinetdetective_broken"
|
||||||
icon_off = "cabinetdetective_broken"
|
icon_off = "cabinetdetective_broken"
|
||||||
|
|
||||||
|
will_contain = list(/obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer = 10)
|
||||||
New()
|
|
||||||
..()
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
new /obj/item/weapon/reagent_containers/food/drinks/bottle/small/beer( src )
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/structure/closet/secure_closet/bar/update_icon()
|
/obj/structure/closet/secure_closet/bar/update_icon()
|
||||||
if(broken)
|
if(broken)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
#include "code\_helpers\mobs.dm"
|
#include "code\_helpers\mobs.dm"
|
||||||
#include "code\_helpers\names.dm"
|
#include "code\_helpers\names.dm"
|
||||||
#include "code\_helpers\sanitize_values.dm"
|
#include "code\_helpers\sanitize_values.dm"
|
||||||
|
#include "code\_helpers\storage.dm"
|
||||||
#include "code\_helpers\text.dm"
|
#include "code\_helpers\text.dm"
|
||||||
#include "code\_helpers\time.dm"
|
#include "code\_helpers\time.dm"
|
||||||
#include "code\_helpers\turfs.dm"
|
#include "code\_helpers\turfs.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user