diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index b6e16181868..c5eba6e8092 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -287,7 +287,7 @@ spawn(0) temp_glassairlock.prison_open() for (var/obj/machinery/door_timer/temp_timer in A) - temp_timer.releasetime = 1 + temp_timer.timeleft = 0 sleep(150) command_alert(/datum/command_alert/graytide) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index a86ef490b9b..9acde08226f 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -14,16 +14,25 @@ icon_state = "frame" desc = "A remote control for a door." req_access = list(access_brig) - anchored = 1.0 // can't pick it up - density = 0 // can walk through it. - var/id_tag = null // id of door it controls. - var/releasetime = 0 // when world.timeofday reaches it - release the prisoneer - var/timing = 1 // boolean, true/1 timer is on, false/0 means it's not timing + anchored = TRUE + density = FALSE + var/id_tag = null // id of door it controls + var/timeleft = 0 // in seconds + var/timing = FALSE var/picture_state // icon_state of alert picture, if not displaying text/numbers var/list/obj/machinery/targets = list() var/last_call = 0 layer = ABOVE_WINDOW_LAYER +/obj/machinery/door_timer/New() + ..() + machines -= src + fast_objects += src //process every 0.5 instead of every 2 + +/obj/machinery/door_timer/Destroy() + fast_objects -= src + ..() + /obj/machinery/door_timer/initialize() ..() @@ -33,6 +42,7 @@ for(var/obj/machinery/door/window/brigdoor/M in all_doors) if (M.id_tag == src.id_tag) targets += M + M.open() //these start the shift open for(var/obj/machinery/flasher/F in flashers) if(F.id_tag == src.id_tag) @@ -50,16 +60,15 @@ // if it's less than 0, open door, reset timer // update the door_timer window and the icon /obj/machinery/door_timer/process() - if(stat & (NOPOWER|BROKEN)) + if((stat & (NOPOWER|BROKEN)) || !timing) return - if(src.timing) - if(timeleft() == 0) - src.timer_end() // open doors, reset timer, clear status screen - src.timing = 0 - src.updateUsrDialog() - src.update_icon() - else - timer_end() + if(timeleft <= 0) + timer_end() // open doors, reset timer, clear status screen + timing = FALSE + return + timeleft -= (SS_WAIT_FAST_OBJECTS/(1 SECONDS)) //this is a fast object + updateUsrDialog() + update_icon() // has the door power sitatuation changed, if so update icon. @@ -107,36 +116,28 @@ C.locked = 0 C.icon_state = C.icon_closed + timeleft = 0 + + update_icon() + return 1 -/obj/machinery/door_timer/proc/timeleft() - if(timing) - . = max((releasetime-world.timeofday)/10, 0) - else - . = max((releasetime-last_call)/10, 0) - - if(. < 0) . = 0 - last_call = world.timeofday - /obj/machinery/door_timer/proc/timeset(var/seconds) - releasetime=world.timeofday+seconds*10 - last_call = world.timeofday + timeleft = seconds //Allows AIs to use door_timer, see human attack_hand function below /obj/machinery/door_timer/attack_ai(var/mob/user as mob) - src.add_hiddenprint(user) - return src.attack_hand(user) + add_hiddenprint(user) + return attack_hand(user) //Allows humans to use door_timer //Opens dialog window when someone clicks on door timer // Allows altering timer and the timing boolean. -// Flasher activation limited to 150 seconds +// Flasher activation limited to 15 seconds /obj/machinery/door_timer/attack_hand(var/mob/user as mob) if(..()) return - var/second = round(timeleft() % 60) - var/minute = round((timeleft() - second) / 60) user.set_machine(src) var/dat = "
" @@ -148,10 +149,10 @@ dat += "Activate Timer and close door