diff --git a/code/game/objects/structures/crates_lockers/largecrate.dm b/code/game/objects/structures/crates_lockers/largecrate.dm index 39a659c5f397..5620f106b560 100644 --- a/code/game/objects/structures/crates_lockers/largecrate.dm +++ b/code/game/objects/structures/crates_lockers/largecrate.dm @@ -22,32 +22,18 @@ playsound(src, unpacking_sound, 35) - /// Store the reference of the crate material - var/obj/item/stack/sheet/material_sheet - if(parts_type) // Create the crate material and store its reference - material_sheet = new parts_type(current_turf, 2) - - // Move the objects back to the turf, above the crate material + // Move the contents back to the turf for(var/atom/movable/moving_atom as anything in contents) moving_atom.forceMove(current_turf) - deconstruct(TRUE) - - // Move the crate material to the bottom of the turf's contents - if(material_sheet) - move_to_bottom(material_sheet, current_turf) + if(parts_type) // Create the crate material + new parts_type(current_turf, 2) -/// Custom proc to move an object to the bottom of the turf's contents -/obj/structure/largecrate/proc/move_to_bottom(obj/moving_down, turf/current_turf) - if(!istype(moving_down) || !istype(current_turf)) - return - for(var/atom/movable/checking_atom in current_turf.contents) - if(checking_atom != moving_down) - checking_atom.layer = max(checking_atom.layer, moving_down.layer + 0.1) + deconstruct(TRUE) /obj/structure/largecrate/deconstruct(disassembled = TRUE) if(!disassembled) - new /obj/item/stack/sheet/wood(loc) + new parts_type(loc) return ..()