From 80453f856dbe33dfc161ff480865f1bfe631871d Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Nov 2025 04:49:42 -0500 Subject: [PATCH] Fix windoor autoclosing when valid mobs stand among dead mobs. (#31077) * Fix windoor autoclosing when valid mobs stand among dead mobs. * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Alan --------- Signed-off-by: Alan Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --- code/game/machinery/doors/windowdoor.dm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 71061ea12a9..978ec182a1f 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -85,21 +85,22 @@ /obj/machinery/door/window/proc/open_and_close() open() - addtimer(CALLBACK(src, PROC_REF(check_close)), check_access(null) ? 5 SECONDS : 2 SECONDS) - + delay_close() /// Check whether or not this door can close, based on whether or not someone's standing in front of it holding it open /obj/machinery/door/window/proc/check_close() - var/mob/living/blocker = locate(/mob/living) in get_turf(get_step(src, dir)) // check the facing turf - if(!blocker || blocker.stat || !allowed(blocker)) - blocker = locate(/mob/living) in get_turf(src) - if(blocker && !blocker.stat && allowed(blocker)) - // kick the can down the road, someone's holding the door. - addtimer(CALLBACK(src, PROC_REF(check_close)), check_access(null) ? 5 SECONDS : 2 SECONDS) - return + for(var/mob/living/blocker in get_step(src, dir)) + if(blocker && !blocker.stat && allowed(blocker)) + return delay_close() + for(var/mob/living/blocker in get_turf(src)) + if(blocker && !blocker.stat && allowed(blocker)) + return delay_close() close() +/obj/machinery/door/window/proc/delay_close() + addtimer(CALLBACK(src, PROC_REF(check_close)), check_access(null) ? 5 SECONDS : 2 SECONDS) + /obj/machinery/door/window/Bumped(atom/movable/AM) if(operating || !density) return