From 92fedfe8df04a74814dedae25a5cd308427abedf Mon Sep 17 00:00:00 2001 From: "VivianFoxfoot@gmail.com" Date: Mon, 9 Apr 2012 18:53:04 +0000 Subject: [PATCH] An attempt to make the master controller more robust. This shouldn't cause terrible additional lag, given that the master controller doesn't actually fire that often, and can also give us a clue as to what part of the controller has died in case of failure Modifies do_after to something that fires a lot less, and is hopefully more robust against infinite loops. It is now theoretically possible to run around and then come back to the same place and have it complete, but that's only really valid for extremely long times (like handcuff removal) and if you get lucky and dodge one of the timed checks. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3421 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/helpers.dm | 23 ++++- code/game/cellautomata.dm | 3 +- code/game/master_controller.dm | 146 +++++++++++++++++++++++++----- code/modules/admin/admin_verbs.dm | 2 + code/modules/admin/verbs/MC.dm | 10 ++ code/modules/mob/mob.dm | 4 +- 6 files changed, 161 insertions(+), 27 deletions(-) diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 7a12af92611..b3554fe083d 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -1273,9 +1273,10 @@ proc/listclearnulls(list/list) return 1 else return 0 - +/* /proc/do_after(mob/M as mob, time as num) - if(!M) return 0 + if(!M) + return 0 var/turf/T = M.loc var/holding = M.equipped() for(var/i=0, i Warning. The Master Controller has not fired in the last 15 seconds. Restart recommended. Automatic restart in 15 seconds." + + sleep(150) + if(current_iteration == controller_iteration) + for (var/mob/M in world) + if (M.client && M.client.holder) + M << " Warning. The Master Controller has not fired in the last 30 seconds. Automatic restart beginning." + master_controller.process() + sleep(150) + else + for (var/mob/M in world) + if (M.client && M.client.holder) + M << " The Master Controller has fired. Automatic restart aborted." \ No newline at end of file diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index fc429e0a834..ff811cbedb4 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -215,6 +215,7 @@ //verbs += /proc/togglebuildmode --Merged with view variables //verbs += /client/proc/cmd_modify_object_variables --Merged with view variables verbs += /client/proc/togglebuildmodeself + verbs += /client/proc/debug_master_controller else return //Game Admin @@ -413,6 +414,7 @@ //verbs -= /client/proc/cmd_switch_radio --removed because tcommsat is staying verbs -= /client/proc/togglebuildmodeself verbs -= /client/proc/kill_airgroup + verbs -= /client/proc/debug_master_controller return diff --git a/code/modules/admin/verbs/MC.dm b/code/modules/admin/verbs/MC.dm index ded7740c2c1..ae14eaa9b52 100644 --- a/code/modules/admin/verbs/MC.dm +++ b/code/modules/admin/verbs/MC.dm @@ -7,4 +7,14 @@ master_controller.process() if("No") return 0 + return + +/client/proc/debug_master_controller() + set category = "Debug" + set name = "Debug Master Controller" + switch(alert("Debug Master Controller or Failsafe?" ,, "Master Controller" , "Failsafe")) + if("Master Controller") + debug_variables(master_controller) + if("Failsafe") + debug_variables(Failsafe) return \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 9427db6513a..c6383a7abe5 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -938,8 +938,8 @@ note dizziness decrements automatically in the mob's Life() proc. stat(null, "([x], [y], [z])") stat(null, "CPU: [world.cpu]") stat(null, "Controller: [controllernum]") - //if (master_controller) - // stat(null, "Loop: [master_controller.loop_freq]") + if (master_controller) + stat(null, "Current Iteration: [controller_iteration]") if (spell_list.len)