Skip to content

Commit

Permalink
Fix for crates and traps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Segrain committed Feb 27, 2024
1 parent d728744 commit d0a990c
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions code/game/objects/structures/crates_lockers/largecrate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()


Expand Down

0 comments on commit d0a990c

Please sign in to comment.