mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 16:13:19 +01:00
Process and Process Scheduler Tweaks
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
var/global/list/object_profiling = list()
|
||||
/datum/controller/process/obj
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/obj/setup()
|
||||
name = "obj"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
start_delay = 8
|
||||
|
||||
/datum/controller/process/obj/started()
|
||||
..()
|
||||
if(!updateQueueInstance)
|
||||
if(!processing_objects)
|
||||
processing_objects = list()
|
||||
else if(processing_objects.len)
|
||||
updateQueueInstance = new
|
||||
if(!processing_objects)
|
||||
processing_objects = list()
|
||||
|
||||
/datum/controller/process/obj/statProcess()
|
||||
..()
|
||||
stat(null, "[processing_objects.len] objects")
|
||||
|
||||
/datum/controller/process/obj/doWork()
|
||||
if(updateQueueInstance)
|
||||
updateQueueInstance.init(processing_objects, "process")
|
||||
updateQueueInstance.Run()
|
||||
for(var/obj/O in processing_objects)
|
||||
if(istype(O) && isnull(O.gcDestroyed))
|
||||
try
|
||||
O.process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, O)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
else
|
||||
processing_objects -= O
|
||||
Reference in New Issue
Block a user