Process and Process Scheduler Tweaks

This commit is contained in:
Krausus
2015-07-18 13:14:32 -04:00
parent fd87909ff5
commit c520ebd8a5
22 changed files with 257 additions and 204 deletions
+18 -11
View File
@@ -1,27 +1,34 @@
/datum/controller/process/mob
var/tmp/datum/updateQueue/updateQueueInstance
/datum/controller/process/mob/setup()
name = "mob"
schedule_interval = 20 // every 2 seconds
updateQueueInstance = new
start_delay = 16
if(!mob_master)
mob_master = new
mob_master.Setup()
/datum/controller/process/mob/started()
..()
if(!updateQueueInstance)
if(!mob_list)
mob_list = list()
else if(mob_list.len)
updateQueueInstance = new
if(!mob_list)
mob_list = list()
/datum/controller/process/mob/statProcess()
..()
stat(null, "[mob_list.len] mobs")
/datum/controller/process/mob/doWork()
if(updateQueueInstance)
updateQueueInstance.init(mob_list, "Life")
updateQueueInstance.Run()
mob_master.process()
for(var/mob/M in mob_list)
if(istype(M) && isnull(M.gcDestroyed))
try
M.Life()
catch(var/exception/e)
catchException(e, M)
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
src.scheck()
else
mob_list -= M
mob_master.process()
var/global/datum/controller/mob_system/mob_master