Closet contents are shown during the closet shutting animation (#93487)

## About The Pull Request


https://github.com/user-attachments/assets/d3ddfa79-c7c1-4ab3-81fb-08eedbf51539

## Why It's Good For The Game

I didn't really like how closets shutting would instantly vanish all of
the objects inside, so this is just a small tweak to maintain the
illusion.

The items are not grabbable while the closet is shutting, physically
they still enter instantly, we just visually keep them in place for a
moment

Unfortunately it seems like this doesn't play too nicely with sidemap -
some objects will outright disappear and the display order is shuffled,
I'm not sure the best way to get around that

## Changelog

🆑 Melbert
qol: Closet animation has been updated slightly - when closing objects
no longer disappear instantly.
/🆑
This commit is contained in:
MrMelbert
2025-10-18 21:56:45 -05:00
committed by GitHub
parent a574c90b8d
commit 799ec95d4e
@@ -289,12 +289,27 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
if(vname in list(NAMEOF(src, locked), NAMEOF(src, welded), NAMEOF(src, secure), NAMEOF(src, icon_welded), NAMEOF(src, delivery_icon)))
update_appearance()
// Clone of closet items
/obj/effect/appearance_clone/closet_item
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/// Animates the closet door opening and closing
/obj/structure/closet/proc/animate_door(closing = FALSE)
if(!door_anim_time)
return
if(!door_obj)
door_obj = new
if(closing && length(contents))
var/icon/mask_icon = icon(icon, has_closed_overlay ? "[icon_door || base_icon_state || initial(icon_state)]_door" : icon_state)
// When closing, all of our contents are already in src - they've already disappeared from the world
// So to make the animation less jarring, we create a clone of everything in the closet to show in the animation
for(var/content in src)
var/obj/effect/appearance_clone/closet_item/clone = new(loc, content)
// Mask keeps in in bounds of the inside of the closet
clone.add_filter("closet_mask", 1, alpha_mask_filter(x = -1 * (clone.pixel_x + clone.pixel_w), y = -1 * (clone.pixel_y + clone.pixel_z), icon = mask_icon))
clone.layer = FLOAT_LAYER - 1
vis_contents += clone
var/default_door_icon = "[icon_door || icon_state]_door"
vis_contents += door_obj
door_obj.icon = icon
@@ -330,6 +345,9 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
/obj/structure/closet/proc/end_door_animation()
is_animating_door = FALSE
vis_contents -= door_obj
for(var/obj/effect/appearance_clone/closet_item/clone in vis_contents)
vis_contents -= clone
qdel(clone)
update_icon()
/// Calculates the matrix to be applied to the animated door overlay