From 4697e7b347d23bb875ea594ea0966c5cf0591cdb Mon Sep 17 00:00:00 2001
From: AlaunusLux <89751433+AlaunusLux@users.noreply.github.com>
Date: Fri, 15 Aug 2025 08:58:31 -0500
Subject: [PATCH] Reduces vision while in closet or trash pile and fixes closet
teleporter camera update (#21154)
This started out as an update to reduce vision while inside closets.
While I was testing that, I noticed closet teleporters weren't updating
the camera properly, so I fixed that, as well as a bug with an early
`return` causing closets to have 0 density while a closet teleporter was
on cooldown.
Reduce vision inside locker:
---
code/_onclick/hud/fullscreen.dm | 3 +
.../objects/items/weapons/teleportation.dm | 6 ++
.../structures/crates_lockers/closets.dm | 6 +-
code/game/objects/structures/trash_pile.dm | 3 +
...nusLux-add-closet-vision-reduction-etc.yml | 60 +++++++++++++++++++
5 files changed, 75 insertions(+), 3 deletions(-)
create mode 100644 html/changelogs/AlaunusLux-add-closet-vision-reduction-etc.yml
diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm
index e55d6cb73cb..55a80d28a43 100644
--- a/code/_onclick/hud/fullscreen.dm
+++ b/code/_onclick/hud/fullscreen.dm
@@ -101,6 +101,9 @@
/atom/movable/screen/fullscreen/impaired
icon_state = "impairedoverlay"
+/atom/movable/screen/fullscreen/closet_impaired
+ icon_state = "impairedoverlay2"
+
/atom/movable/screen/fullscreen/blurry
icon = 'icons/mob/screen/effects.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm
index a8f19a6d9ae..ae42179bce7 100644
--- a/code/game/objects/items/weapons/teleportation.dm
+++ b/code/game/objects/items/weapons/teleportation.dm
@@ -308,8 +308,14 @@ Frequency:
var/obj/structure/closet/target_closet = linked_teleporter.attached_closet
user.forceMove(target_closet.opened ? get_turf(target_closet) : target_closet)
if(target_closet.opened)
+ if(user.client)
+ user.client.eye = user.client.mob
+ user.client.perspective = MOB_PERSPECTIVE
user.visible_message(SPAN_NOTICE("\The [user] steps out of the back of \the [target_closet]."), SPAN_NOTICE("You teleport into the linked closet, stepping out of it."))
+ user.set_fullscreen(FALSE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
else
+ if(user.client)
+ user.client.eye = target_closet
target_closet.visible_message(SPAN_WARNING("\The [target_closet] rattles."))
to_chat(user, SPAN_NOTICE("You teleport into the target closet, bumping into the closed door."))
target_closet.shake_animation()
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 16394ee81d6..83f47818cad 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -190,6 +190,7 @@
if(M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
+ M.set_fullscreen(FALSE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
/obj/structure/closet/proc/open()
if(opened)
@@ -232,9 +233,7 @@
animate_door_alt(TRUE)
update_icon()
- if(linked_teleporter)
- if(linked_teleporter.last_use + 600 > world.time)
- return
+ if(linked_teleporter && linked_teleporter.last_use + 600 < world.time)
var/did_teleport = FALSE
for(var/mob/M in contents)
if(linked_teleporter.do_teleport(M))
@@ -279,6 +278,7 @@
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
+ M.set_fullscreen(TRUE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
M.forceMove(src)
added_units += M.mob_size
if(mob_limit) //We only want to store one valid mob
diff --git a/code/game/objects/structures/trash_pile.dm b/code/game/objects/structures/trash_pile.dm
index 0fcc988f9d7..302f1829ca6 100644
--- a/code/game/objects/structures/trash_pile.dm
+++ b/code/game/objects/structures/trash_pile.dm
@@ -35,6 +35,7 @@
if(do_after(user, 3 SECONDS, src, DO_UNIQUE))
user.visible_message("[user] climbs into \the [src], disappearing from sight.", SPAN_NOTICE("You climb into \the [src], finally finding a good spot to hide."))
user.forceMove(src)
+ user.set_fullscreen(TRUE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
hider = user
if(ishuman(user) && prob(5))
var/mob/living/carbon/human/H = user
@@ -47,6 +48,7 @@
if(user.stat || user.resting) // don't care too much about use_check here, checking these will suffice
return
user.forceMove(get_turf(src))
+ user.set_fullscreen(FALSE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
if(user == hider)
hider = null
@@ -93,6 +95,7 @@
if(hider && prob(chance))
to_chat(hider, SPAN_DANGER("You've been discovered!"))
hider.forceMove(get_turf(src))
+ hider.set_fullscreen(FALSE, "closet_impaired", /atom/movable/screen/fullscreen/closet_impaired)
to_chat(user, SPAN_DANGER("You discover that \the [hider] was hiding inside \the [src]!"))
hider = null
return TRUE
diff --git a/html/changelogs/AlaunusLux-add-closet-vision-reduction-etc.yml b/html/changelogs/AlaunusLux-add-closet-vision-reduction-etc.yml
new file mode 100644
index 00000000000..2ef3deab788
--- /dev/null
+++ b/html/changelogs/AlaunusLux-add-closet-vision-reduction-etc.yml
@@ -0,0 +1,60 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# - (fixes bugs)
+# wip
+# - (work in progress)
+# qol
+# - (quality of life)
+# soundadd
+# - (adds a sound)
+# sounddel
+# - (removes a sound)
+# rscadd
+# - (adds a feature)
+# rscdel
+# - (removes a feature)
+# imageadd
+# - (adds an image or sprite)
+# imagedel
+# - (removes an image or sprite)
+# spellcheck
+# - (fixes spelling or grammar)
+# experiment
+# - (experimental change)
+# balance
+# - (balance changes)
+# code_imp
+# - (misc internal code change)
+# refactor
+# - (refactors code)
+# config
+# - (makes a change to the config files)
+# admin
+# - (makes changes to administrator tools)
+# server
+# - (miscellaneous changes to server)
+#################################
+
+# Your name.
+author: AlaunusLux
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
+# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - balance: "Adds an overlay to reduce vision while in a trash pile or closed locker."
+ - bugfix: "Fixed vision not updating when using closet teleporters."
+ - bugfix: "Fixed closet density and closet closing sound being lost while closets with teleporters were on cooldown."