mirror of
https://github.com/KabKebab/GS13.git
synced 2026-08-26 06:26:17 +01:00
Halt autoclose when blocked too many times
Wooden barricades in powered airlocks cause lag as the doors try to autoclose over and over. This change adds a failure count that increments each time a door attempts to close but something is blocking it. If it fails too many times, it simply stops trying. Doors can be closed manually once the blockage is removed.
This commit is contained in:
@@ -1204,9 +1204,16 @@
|
||||
return
|
||||
if(safe)
|
||||
for(var/atom/movable/M in get_turf(src))
|
||||
if (failCount > failThreshold) //something is continuously blocking the door
|
||||
do_sparks(5, TRUE, src)
|
||||
visible_message("<span class='warning'>[src]'s timing mechanism fails.</span>")
|
||||
failCount = 0
|
||||
return
|
||||
if(M.density && M != src) //something is blocking the door
|
||||
autoclose_in(60)
|
||||
failCount++
|
||||
return
|
||||
failCount = 0
|
||||
|
||||
if(forced < 2)
|
||||
if(obj_flags & EMAGGED)
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
var/poddoor = FALSE
|
||||
var/unres_sides = 0 //Unrestricted sides. A bitflag for which direction (if any) can open the door with no access
|
||||
|
||||
// GS13: Halt autoclose when blocked with static object, like a wooden barricade...
|
||||
var/failCount = 0
|
||||
var/failThreshold = 5
|
||||
|
||||
/obj/machinery/door/examine(mob/user)
|
||||
. = ..()
|
||||
if(red_alert_access)
|
||||
@@ -284,10 +288,16 @@
|
||||
return
|
||||
if(safe)
|
||||
for(var/atom/movable/M in get_turf(src))
|
||||
if (failCount > failThreshold) //something is continuously blocking the door
|
||||
do_sparks(5, TRUE, src)
|
||||
visible_message("<span class='warning'>[src]'s timing mechanism fails.</span>")
|
||||
failCount = 0
|
||||
return
|
||||
if(M.density && M != src) //something is blocking the door
|
||||
if(autoclose)
|
||||
autoclose_in(60)
|
||||
return
|
||||
failCount = 0
|
||||
|
||||
operating = TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user