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
This commit is contained in:
VivianFoxfoot@gmail.com
2012-04-09 18:53:04 +00:00
parent 97ee64f5e9
commit 92fedfe8df
6 changed files with 161 additions and 27 deletions
+21 -2
View File
@@ -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<time)
@@ -1286,6 +1287,24 @@ proc/listclearnulls(list/list)
else
return 0
return 1
*/
/proc/do_after(var/mob/user as mob, delay as num, var/numticks = 5) // Replacing the upper one with this one because Byond keeps feeling that the upper one is an infinate loop
if(!user || isnull(user)) // This one should have less temptation
return 0
if(numticks == 0)
return 0
var/delayfraction = delay/numticks
var/turf/T = user.loc
var/holding = user.equipped()
for(var/i = 0, i<numticks, i++)
sleep(delayfraction)
if(!src || !user || !user.canmove || !(user.loc == T) || !(user.equipped() == holding))
return 0
return 1
/proc/hasvar(var/datum/A, var/varname)
//Takes: Anything that could possibly have variables and a varname to check.