From c9897bf3f7be3a5af6858a04f6f813d27fe4b7e7 Mon Sep 17 00:00:00 2001 From: "sieve32@gmail.com" Date: Sun, 7 Oct 2012 21:45:04 +0000 Subject: [PATCH] -Fixed Fire Alarm timers, the issue was caused by the fact that they were no longer processing, on account of it not really being necessary. I changed it so that they only process so long as they are timing, and changed the timing to work off of world.timeofday so it won't be affected by lag (Did that for the purpose of shenanigans). Fixes Issue 987 -Added donkie's list shuffle for Space Ninjas, was trying to work on Issue 904 and saw that it didn't shuffle the candidates so I added that, though I doubt it will fix the problem. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4828 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/gamemodes/events/space_ninja.dm | 3 +- code/game/machinery/alarm.dm | 37 ++++++++++++++--------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/code/game/gamemodes/events/space_ninja.dm b/code/game/gamemodes/events/space_ninja.dm index 90c44fdfa5b..51cebd65e49 100644 --- a/code/game/gamemodes/events/space_ninja.dm +++ b/code/game/gamemodes/events/space_ninja.dm @@ -140,10 +140,11 @@ Malf AIs/silicons aren't added. Monkeys aren't added. Messes with objective comp var/list/candidates = list() //list of candidate keys for(var/mob/dead/observer/G in player_list) - if(!G.client.holder && ((G.client.inactivity/10)/60) <= 5) + if(G.client && !G.client.holder && ((G.client.inactivity/10)/60) <= 5) if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) candidates += G.key if(!candidates.len) return + candidates = shuffle(candidates)//Incorporating Donkie's list shuffle //The ninja will be created on the right spawn point or at late join. diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 8acfe1740a2..dad383d0d0d 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1008,6 +1008,9 @@ table tr:first-child th:first-child { border: none;} spawn(rand(0,15)) update_icon() +/obj/machinery/firealarm + var/last_process = 0 + /obj/machinery/firealarm/temperature_expose(datum/gas_mixture/air, temperature, volume) if(src.detecting) if(temperature > T0C+200) @@ -1039,26 +1042,28 @@ table tr:first-child th:first-child { border: none;} src.add_fingerprint(user) return -/obj/machinery/firealarm/process() +/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed if(stat & (NOPOWER|BROKEN)) return - var/area/A = src.loc - A = A.loc +// var/area/A = src.loc +// A = A.loc - if(A.fire) - src.icon_state = "fire1" - else - src.icon_state = "fire0" +// if(A.fire) +// src.icon_state = "fire1" +// else +// src.icon_state = "fire0" - if (src.timing) - if (src.time > 0) - src.time = round(src.time) - 1 + if(src.timing) + if(src.time > 0) + src.time = src.time - ((world.timeofday - last_process)/10) else - alarm() + src.alarm() src.time = 0 src.timing = 0 + processing_objects.Remove(src) src.updateDialog() + last_process = world.timeofday return /obj/machinery/firealarm/power_change() @@ -1089,8 +1094,8 @@ table tr:first-child th:first-child { border: none;} d2 = text("Stop Time Lock", src) else d2 = text("Initiate Time Lock", src) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 + var/second = round(src.time) % 60 + var/minute = (round(src.time) - second) / 60 var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]

\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") @@ -1104,8 +1109,8 @@ table tr:first-child th:first-child { border: none;} d2 = text("[]", src, stars("Stop Time Lock")) else d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 + var/second = round(src.time) % 60 + var/minute = (round(src.time) - second) / 60 var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]

\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") @@ -1125,6 +1130,8 @@ table tr:first-child th:first-child { border: none;} else if (href_list["time"]) src.timing = text2num(href_list["time"]) + last_process = world.timeofday + processing_objects.Add(src) else if (href_list["tp"]) var/tp = text2num(href_list["tp"])