Skip to content

Commit

Permalink
use initial() instead of assuming defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
GenericDM committed Oct 5, 2023
1 parent 72baf0e commit ec7b286
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/game/objects/structures/crateshelf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
/obj/structure/crate_shelf/Destroy()
var/turf/dump_turf = drop_location()
for(var/obj/structure/closet/crate/crate in shelf_contents)
crate.layer = BELOW_OBJ_LAYER // Reset the crates back to default visual state
crate.pixel_y = 0
crate.layer = initial(crate.layer) // Reset the crates back to default visual state
crate.pixel_y = initial(crate.pixel_y)
crate.forceMove(dump_turf)
step(crate, pick(GLOB.alldirs)) // Shuffle the crates around as though they've fallen down.
crate.SpinAnimation(rand(4,7), 1) // Spin the crates around a little as they fall. Randomness is applied so it doesn't look weird.
Expand Down Expand Up @@ -108,8 +108,8 @@
if(do_after(user, use_delay, target = crate))
if(!shelf_contents.Find(crate))
return FALSE // If something has happened to the crate while we were waiting, abort!
crate.layer = BELOW_OBJ_LAYER // Reset the crate back to having the default layer, otherwise we might get strange interactions.
crate.pixel_y = 0 // Reset the crate back to having no offset, otherwise it will be floating.
crate.layer = initial(crate.layer) // Reset the crate back to having the default layer, otherwise we might get strange interactions.
crate.pixel_y = initial(crate.pixel_y) // Reset the crate back to having no offset, otherwise it will be floating.
crate.forceMove(unload_turf)
shelf_contents[shelf_contents.Find(crate)] = null // We do this instead of removing it from the list to preserve the order of the shelf.
handle_visuals()
Expand Down

0 comments on commit ec7b286

Please sign in to comment.