diff --git a/code/game/objects/items/weapons/storage/internal.dm b/code/game/objects/items/weapons/storage/internal.dm index 4e37c50928..3d84dd9475 100644 --- a/code/game/objects/items/weapons/storage/internal.dm +++ b/code/game/objects/items/weapons/storage/internal.dm @@ -4,18 +4,24 @@ preserve_item = 1 var/atom/movable/master_atom -/obj/item/storage/internal/Initialize() - . = ..() - master_atom = loc - if(!istype(master_atom)) - return INITIALIZE_HINT_QDEL - loc = master_atom - name = master_atom.name - verbs -= /obj/item/verb/verb_pickup //make sure this is never picked up. /obj/item/storage/internal/Destroy() master_atom = null + return ..() + + +/obj/item/storage/internal/Initialize() . = ..() + master_atom = loc + if (!istype(master_atom)) + return INITIALIZE_HINT_QDEL + loc = master_atom + verbs -= /obj/item/verb/verb_pickup + + +/obj/item/storage/internal/LateInitializeName() + name = master_atom.name + /obj/item/storage/internal/attack_hand() return //make sure this is never picked up diff --git a/code/game/objects/items/weapons/storage/misc.dm b/code/game/objects/items/weapons/storage/misc.dm index 39c4907e8a..03259d0cf4 100644 --- a/code/game/objects/items/weapons/storage/misc.dm +++ b/code/game/objects/items/weapons/storage/misc.dm @@ -38,16 +38,13 @@ var/global/list/random_weighted_donuts = list( max_storage_space = ITEMSIZE_COST_SMALL * 6 can_hold = list(/obj/item/reagent_containers/food/snacks/donut) foldable = /obj/item/stack/material/cardboard - //starts_with = list(/obj/item/reagent_containers/food/snacks/donut/normal = 6) /obj/item/storage/box/donut/Initialize() - if(!empty) - for(var/i in 1 to 6) - var/type_to_spawn = pickweight(random_weighted_donuts) - new type_to_spawn(src) + PopulateDonutSelection() . = ..() update_icon() + /obj/item/storage/box/donut/update_icon() cut_overlays() var/x_offset = 0 @@ -57,8 +54,16 @@ var/global/list/random_weighted_donuts = list( add_overlay(ma) x_offset += 3 -/obj/item/storage/box/donut/empty - empty = TRUE + +/obj/item/storage/box/donut/proc/PopulateDonutSelection() + starts_with = list() + for (var/i = 1 to 6) + starts_with += pickweight(random_weighted_donuts) + + +/obj/item/storage/box/donut/empty/PopulateDonutSelection() + return + /obj/item/storage/box/wormcan icon = 'icons/obj/food.dmi' diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index ff314ffdbc..21870fff15 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -25,9 +25,9 @@ var/obj/screen/storage/storage_start = null //storage UI var/obj/screen/storage/storage_continue = null var/obj/screen/storage/storage_end = null - var/obj/screen/storage/stored_start = null - var/obj/screen/storage/stored_continue = null - var/obj/screen/storage/stored_end = null + var/obj/stored_start = null + var/obj/stored_continue = null + var/obj/stored_end = null var/obj/screen/close/closer = null var/use_to_pickup //Set this to make it possible to use this item in an inverse way, so you can have the item in your hand and click items on the floor to pick them up. var/display_contents_with_number //Set this to make the storage item group contents of the same type and display them as a number. @@ -36,19 +36,72 @@ var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile var/use_sound = "rustle" //sound played when used. null for no sound. var/list/starts_with //Things to spawn on the box on spawn - var/empty //Mapper override to spawn an empty version of a container that usually has stuff + /obj/item/storage/Destroy() close_all() QDEL_NULL(boxes) - QDEL_NULL(src.storage_start) - QDEL_NULL(src.storage_continue) - QDEL_NULL(src.storage_end) - QDEL_NULL(src.stored_start) - QDEL_NULL(src.stored_continue) - QDEL_NULL(src.stored_end) + QDEL_NULL(storage_start) + QDEL_NULL(storage_continue) + QDEL_NULL(storage_end) + QDEL_NULL(stored_start) + QDEL_NULL(stored_continue) + QDEL_NULL(stored_end) QDEL_NULL(closer) + return ..() + + +/obj/item/storage/Initialize() . = ..() + if (allow_quick_empty) + verbs += /obj/item/storage/verb/quick_empty + else + verbs -= /obj/item/storage/verb/quick_empty + if (allow_quick_gather) + verbs += /obj/item/storage/verb/toggle_gathering_mode + else + verbs -= /obj/item/storage/verb/toggle_gathering_mode + boxes = new + boxes.master = src + boxes.icon_state = "block" + boxes.screen_loc = "7,7 to 10,8" + storage_start = new + storage_start.master = src + storage_start.icon_state = "storage_start" + storage_start.screen_loc = "7,7 to 10,8" + storage_continue = new + storage_continue.master = src + storage_continue.icon_state = "storage_continue" + storage_continue.screen_loc = "7,7 to 10,8" + storage_end = new + storage_end.master = src + storage_end.icon_state = "storage_end" + storage_end.screen_loc = "7,7 to 10,8" + stored_start = new + stored_start.icon_state = "stored_start" + stored_continue = new + stored_continue.icon_state = "stored_continue" + stored_end = new + stored_end.icon_state = "stored_end" + closer = new + closer.master = src + closer.icon_state = "storage_close" + closer.hud_layerise() + orient2hud() + if (islist(starts_with)) + for (var/newtype in starts_with) + var/count = starts_with[newtype] || 1 + while (count) + count-- + new newtype (src) + starts_with = null + calibrate_size() + return INITIALIZE_HINT_LATELOAD + + +/obj/item/storage/LateInitialize() + LateInitializeName() + /obj/item/storage/MouseDrop(obj/over_object as obj) if(!canremove) @@ -539,68 +592,6 @@ for(var/obj/item/I in contents) remove_from_storage(I, T) -/obj/item/storage/Initialize() - . = ..() - - if(allow_quick_empty) - verbs += /obj/item/storage/verb/quick_empty - else - verbs -= /obj/item/storage/verb/quick_empty - - if(allow_quick_gather) - verbs += /obj/item/storage/verb/toggle_gathering_mode - else - verbs -= /obj/item/storage/verb/toggle_gathering_mode - - src.boxes = new /obj/screen/storage( ) - src.boxes.name = "storage" - src.boxes.master = src - src.boxes.icon_state = "block" - src.boxes.screen_loc = "7,7 to 10,8" - - src.storage_start = new /obj/screen/storage( ) - src.storage_start.name = "storage" - src.storage_start.master = src - src.storage_start.icon_state = "storage_start" - src.storage_start.screen_loc = "7,7 to 10,8" - - src.storage_continue = new /obj/screen/storage( ) - src.storage_continue.name = "storage" - src.storage_continue.master = src - src.storage_continue.icon_state = "storage_continue" - src.storage_continue.screen_loc = "7,7 to 10,8" - - src.storage_end = new /obj/screen/storage( ) - src.storage_end.name = "storage" - src.storage_end.master = src - src.storage_end.icon_state = "storage_end" - src.storage_end.screen_loc = "7,7 to 10,8" - - src.stored_start = new /obj //we just need these to hold the icon - src.stored_start.icon_state = "stored_start" - - src.stored_continue = new /obj - src.stored_continue.icon_state = "stored_continue" - - src.stored_end = new /obj - src.stored_end.icon_state = "stored_end" - - src.closer = new /obj/screen/close( ) - src.closer.master = src - src.closer.icon_state = "storage_close" - src.closer.hud_layerise() - orient2hud() - - if(LAZYLEN(starts_with) && !empty) - for(var/newtype in starts_with) - var/count = starts_with[newtype] || 1 //Could have left it blank. - while(count) - count-- - new newtype(src) - starts_with = null //Reduce list count. - - calibrate_size() - /obj/item/storage/proc/calibrate_size() var/total_storage_space = 0 for(var/obj/item/I in contents) @@ -685,6 +676,11 @@ max_w_class = max(I.w_class, max_w_class) max_storage_space += I.get_storage_cost() + +/obj/item/storage/proc/LateInitializeName() + return + + /* * Trinket Box - READDING SOON */ diff --git a/maps/cynosure/cynosure-3.dmm b/maps/cynosure/cynosure-3.dmm index 3f549a15a3..d90da3188c 100644 --- a/maps/cynosure/cynosure-3.dmm +++ b/maps/cynosure/cynosure-3.dmm @@ -29750,16 +29750,16 @@ /obj/item/assembly/prox_sensor, /obj/item/assembly/prox_sensor, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/healthanalyzer, /obj/item/healthanalyzer, diff --git a/maps/northern_star/polaris-1.dmm b/maps/northern_star/polaris-1.dmm index 6a749f2ff3..ba71c6bd3e 100644 --- a/maps/northern_star/polaris-1.dmm +++ b/maps/northern_star/polaris-1.dmm @@ -4510,7 +4510,7 @@ "bIL" = (/obj/structure/cable/green{d1 = 1; d2 = 2; icon_state = "1-2"},/obj/machinery/atmospherics/pipe/simple/hidden/supply,/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers,/obj/structure/table/standard,/obj/machinery/computer/med_data/laptop,/turf/simulated/floor/tiled/white,/area/assembly/robotics) "bIM" = (/obj/structure/disposalpipe/segment,/turf/simulated/floor/tiled/white,/area/assembly/robotics) "bIN" = (/obj/structure/cable/green{d1 = 1; d2 = 2; icon_state = "1-2"},/turf/simulated/floor/tiled/white,/area/assembly/robotics) -"bIO" = (/obj/structure/closet{name = "robotics parts"},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/assembly/prox_sensor{pixel_x = -8; pixel_y = 4},/obj/item/assembly/prox_sensor{pixel_x = -8; pixel_y = 4},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/storage/firstaid/regular{empty = 1; name = "First-Aid (empty)"},/obj/item/storage/firstaid/regular{empty = 1; name = "First-Aid (empty)"},/obj/item/storage/firstaid/regular{empty = 1; name = "First-Aid (empty)"},/obj/item/healthanalyzer,/obj/item/healthanalyzer,/obj/item/healthanalyzer,/obj/effect/floor_decal/corner/pink{dir = 6},/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/stack/cable_coil,/obj/item/stack/cable_coil,/turf/simulated/floor/tiled/white,/area/assembly/robotics) +"bIO" = (/obj/structure/closet{name = "robotics parts"},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/assembly/prox_sensor{pixel_x = -8; pixel_y = 4},/obj/item/assembly/prox_sensor{pixel_x = -8; pixel_y = 4},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/cell/high{charge = 100; maxcharge = 15000; pixel_x = 5; pixel_y = -5},/obj/item/storage/firstaid/regular{name = "First-Aid (empty)"; starts_with = null},/obj/item/storage/firstaid/regular{name = "First-Aid (empty)"; starts_with = null},/obj/item/storage/firstaid/regular{name = "First-Aid (empty)"; starts_with = null},/obj/item/healthanalyzer,/obj/item/healthanalyzer,/obj/item/healthanalyzer,/obj/effect/floor_decal/corner/pink{dir = 6},/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/flash/synthetic,/obj/item/stack/cable_coil,/obj/item/stack/cable_coil,/turf/simulated/floor/tiled/white,/area/assembly/robotics) "bIP" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 4},/obj/machinery/door/firedoor/border_only,/obj/structure/window/reinforced{dir = 8},/obj/machinery/door/blast/regular{density = 0; icon_state = "pdoor0"; id = "Biohazard"; name = "Biohazard Shutter"; opacity = 0},/turf/simulated/floor/plating,/area/assembly/robotics) "bIQ" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 4},/obj/machinery/door/firedoor/border_only,/obj/structure/window/reinforced{dir = 8},/turf/simulated/floor/plating,/area/hallway/primary/central_four) "bIR" = (/obj/structure/grille,/obj/structure/window/reinforced{dir = 4},/obj/structure/window/reinforced{dir = 8},/turf/simulated/floor/plating,/area/hallway/primary/central_four) diff --git a/maps/southern_cross/southern_cross-1.dmm b/maps/southern_cross/southern_cross-1.dmm index 920a26f2d5..a6aa89f53d 100644 --- a/maps/southern_cross/southern_cross-1.dmm +++ b/maps/southern_cross/southern_cross-1.dmm @@ -112977,16 +112977,16 @@ pixel_y = 4 }, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/storage/firstaid/regular{ - empty = 1; - name = "First-Aid (empty)" + name = "First-Aid (empty)"; + starts_with = null }, /obj/item/healthanalyzer, /obj/item/healthanalyzer,