From 875eb8a950a0bda167e2fe1e9cd153749ce3784b Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:43:55 -0400 Subject: [PATCH] Keeps bumped windoors open if someone stands in front of them (#19019) * Makes windoors stay open if someone's standing in front of them * Windoor is now held open when you're on the same turf * I guess we do want to check the mob instead of the floor * Adds access control to propping open windoors * Ensure we check both people for access --- code/game/machinery/doors/windowdoor.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 14b3fdcc979..2c0e51f0c22 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -72,10 +72,19 @@ /obj/machinery/door/window/proc/open_and_close() open() - if(check_access(null)) - sleep(50) - else //secure doors close faster - sleep(20) + addtimer(CALLBACK(src, .proc/check_close), check_access(null) ? 5 SECONDS : 2 SECONDS) + + +/// 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/check_close), check_access(null) ? 5 SECONDS : 2 SECONDS) + return + close() /obj/machinery/door/window/Bumped(atom/movable/AM)