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
This commit is contained in:
Luc
2022-09-21 16:43:55 -04:00
committed by GitHub
parent 5e4d0db18a
commit 875eb8a950
+13 -4
View File
@@ -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)