Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for crates and traps. #5835

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading