You can see inside closets and interact with yourself and others inside them (#92029)

## About The Pull Request




https://github.com/user-attachments/assets/65a03f4a-0e44-4bce-b603-a019d5a3a36e

I want you to be able to pick up items and stuff in here but it seemed
annoying so I'm letting Melbert figure that out

Closes #92006

I didn't make it work with client log ins and log outs and all that such
and such fyi

## Why It's Good For The Game

Doesn't really make sense that you can't heal yourself in closets when
you're still able to use items and such in there. You're in the closet.

## Changelog
🆑
add: You can now see inside closets you're in, and interact with
yourself inside.
/🆑
This commit is contained in:
Mothblocks
2025-07-19 20:29:21 -04:00
committed by Roxy
parent f254c36b91
commit f71f5c32da
4 changed files with 113 additions and 1 deletions
@@ -0,0 +1,106 @@
/// Responsible for showing the insides of a closet to those inside it.
/datum/closet_see_inside
var/obj/structure/closet/closet
var/image/background_image
var/image/contents_image
var/list/client/clients_looking_at_image = list()
var/door_alpha = 85
/datum/closet_see_inside/New(obj/structure/closet/closet)
src.closet = closet
RegisterSignal(closet, COMSIG_ATOM_ENTERED, PROC_REF(on_atom_entered))
RegisterSignal(closet, COMSIG_ATOM_EXITED, PROC_REF(on_atom_exited))
/datum/closet_see_inside/Destroy(force)
if (contents_image)
for (var/client/looking_at_image as anything in clients_looking_at_image)
looking_at_image.images -= background_image
looking_at_image.images -= contents_image
contents_image.vis_contents.Cut()
clients_looking_at_image.Cut()
return ..()
/datum/closet_see_inside/proc/create_image()
contents_image = new
contents_image.loc = closet
contents_image.appearance_flags |= KEEP_TOGETHER
background_image = image(
icon = closet.icon,
icon_state = closet.base_icon_state == null ? initial(closet.icon_state) : closet.base_icon_state,
loc = closet,
layer = BELOW_OBJ_LAYER,
)
background_image.color = COLOR_GRAY
background_image.opacity = MOUSE_OPACITY_TRANSPARENT
background_image.override = TRUE
contents_image.add_filter(
"mask",
1,
list(
type = "alpha",
icon = icon('icons/effects/closet_see_inside_mask.dmi', "mask"),
y = -3,
)
)
contents_image.add_filter(
"color",
2,
list(
type = "color",
color = COLOR_GRAY,
)
)
if (closet.enable_door_overlay)
var/obj/effect/overlay/door = new
door.icon = closet.icon
door.icon_state = "[closet.icon_door || background_image.icon_state]_door"
door.alpha = door_alpha
door.layer = ABOVE_ALL_MOB_LAYER
door.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
contents_image.vis_contents += door
for (var/atom/movable/movable in closet)
contents_image.vis_contents += movable
/datum/closet_see_inside/proc/on_atom_entered(obj/structure/closet/source, atom/movable/arrived)
SIGNAL_HANDLER
if (contents_image)
contents_image.vis_contents += arrived
if (ismob(arrived))
var/mob/arrived_mob = arrived
var/client/client = GET_CLIENT(arrived_mob)
if (client)
create_image()
clients_looking_at_image += client
client.images += background_image
client.images += contents_image
/datum/closet_see_inside/proc/on_atom_exited(obj/structure/closet/source, atom/movable/exited)
SIGNAL_HANDLER
if (!contents_image)
return
contents_image.vis_contents -= exited
if (ismob(exited))
var/mob/exited_mob = exited
var/client/client = GET_CLIENT(exited_mob)
if (client)
clients_looking_at_image -= client
client.images -= background_image
client.images -= contents_image
@@ -101,6 +101,9 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
/// how many pixels the closet can shift on the y axes when shaking
var/y_shake_pixel_shift = 1
VAR_PRIVATE
datum/closet_see_inside/closet_see_inside
/datum/armor/structure_closet
melee = 20
bullet = 10
@@ -153,6 +156,8 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
if(is_station_level(z) && mapload)
add_to_roundstart_list()
closet_see_inside = new(src)
// if closed, any item at the crate's loc is put in the contents
if (mapload)
is_maploaded = TRUE
@@ -203,6 +208,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
id_card = null
QDEL_NULL(internal_air)
QDEL_NULL(door_obj)
QDEL_NULL(closet_see_inside)
GLOB.roundstart_station_closets -= src
return ..()
@@ -978,7 +984,6 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
return
container_resist_act(user)
/obj/structure/closet/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(.)