Files
CHOMPStation2/code/controllers/Processes/mob.dm
Leshana 78563a608e Fix runtime in mob controller loop.
* Any nulls present in the mob_list would cause a runtime when checked if they are gcDestroyed.  Add a null check.
* Noticed that the object controller has the same bug, might as well fix now too.
2017-03-17 18:02:59 -04:00

29 lines
611 B
Plaintext

/datum/controller/process/mob
var/tmp/datum/updateQueue/updateQueueInstance
/datum/controller/process/mob/setup()
name = "mob"
schedule_interval = 20 // every 2 seconds
start_delay = 16
/datum/controller/process/mob/started()
..()
if(!mob_list)
mob_list = list()
/datum/controller/process/mob/doWork()
for(last_object in mob_list)
var/mob/M = last_object
if(M && isnull(M.gcDestroyed))
try
M.Life()
catch(var/exception/e)
catchException(e, M)
SCHECK
else
catchBadType(M)
mob_list -= M
/datum/controller/process/mob/statProcess()
..()
stat(null, "[mob_list.len] mobs")