Skip to content

Commit

Permalink
Merge pull request #240 from Mirag1993/Мердж-с-оффами
Browse files Browse the repository at this point in the history
crate shjelf layer fix (shiptest-ss13#2597)
  • Loading branch information
MysticalFaceLesS authored Dec 23, 2023
2 parents 319d22a + 9ca0585 commit f269371
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions code/game/objects/structures/crateshelf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
var/stack_layer // This is used to generate the sprite layering of the shelf pieces.
var/stack_offset // This is used to generate the vertical offset of the shelf pieces.
for(var/i in 1 to (capacity - 1))
stack_layer = BELOW_OBJ_LAYER + (0.02 * i) - 0.01 // Make each shelf piece render above the last, but below the crate that should be on it.
if(i >= 3) // If we're at or above three, we'll be on the way to going off the tile we're on. This allows mobs to be below the shelf when this happens.
stack_layer = ABOVE_MOB_LAYER + (0.02 * i) - 0.01
else
stack_layer = BELOW_OBJ_LAYER + (0.02 * i) - 0.01 // Make each shelf piece render above the last, but below the crate that should be on it.
stack_offset = DEFAULT_SHELF_VERTICAL_OFFSET * i // Make each shelf piece physically above the last.
overlays += image(icon = 'icons/obj/objects.dmi', icon_state = "shelf_stack", layer = stack_layer, pixel_y = stack_offset)
return
Expand Down Expand Up @@ -85,7 +88,10 @@
shelf_contents[next_free] = crate // Insert a reference to the crate into the free slot.
crate.forceMove(src) // Insert the crate into the shelf.
crate.pixel_y = DEFAULT_SHELF_VERTICAL_OFFSET * (next_free - 1) // Adjust the vertical offset of the crate to look like it's on the shelf.
crate.layer = BELOW_OBJ_LAYER + 0.02 * (next_free - 1) // Adjust the layer of the crate to look like it's in the shelf.
if(next_free >= 3) // If we're at or above three, we'll be on the way to going off the tile we're on. This allows mobs to be below the crate when this happens.
crate.layer = ABOVE_MOB_LAYER + 0.02 * (next_free - 1)
else
crate.layer = BELOW_OBJ_LAYER + 0.02 * (next_free - 1) // Adjust the layer of the crate to look like it's in the shelf.
handle_visuals()
return TRUE
return FALSE // If the do_after() is interrupted, return FALSE!
Expand Down

0 comments on commit f269371

Please sign in to comment.