mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Process and Process Scheduler Tweaks
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user