Files
Paradise/code/controllers/subsystem/npcpool.dm
farie82 5b1941e784 Fixes a few runtimes (#12893)
* Some runtime fixes

* fixes #12892

* Alternative fix. Better behaviour

* qdel atmos thingy when loc is null

* Eye colour init protection

* Whoops. Forgotten /

* Suggestions update

* Fixed a runtime where IPCs losing their arms would cause a runtime in the hand

* Fixes mobs being able to nuzzle a grill to dead and a runtime there

* Added extra logging to the NPCpools
2020-02-14 22:17:29 -07:00

37 lines
1.3 KiB
Plaintext

SUBSYSTEM_DEF(npcpool)
name = "NPC Pool"
flags = SS_POST_FIRE_TIMING|SS_NO_INIT|SS_BACKGROUND
priority = FIRE_PRIORITY_NPC
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list()
/datum/controller/subsystem/npcpool/stat_entry()
var/list/activelist = GLOB.simple_animals[AI_ON]
..("SimpleAnimals:[activelist.len]")
/datum/controller/subsystem/npcpool/fire(resumed = FALSE)
if(!resumed)
var/list/activelist = GLOB.simple_animals[AI_ON]
src.currentrun = activelist.Copy()
var/list/currentrun = src.currentrun
while(currentrun.len)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
--currentrun.len
if(!SA)
log_debug("npcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_ON list: [SA in GLOB.simple_animals[AI_ON]]")
GLOB.simple_animals[AI_ON] -= SA
continue
if(!SA.ckey && !SA.notransform)
if(SA.stat != DEAD)
SA.handle_automated_movement()
if(SA.stat != DEAD)
SA.handle_automated_action()
if(SA.stat != DEAD)
SA.handle_automated_speech()
if(MC_TICK_CHECK)
return