mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* Fixes simple animals getting stuck in ai lists (#67273) DO NOT ADD US TO A LIST OF AI PROCESSING MOBS IF WE ARE QDELETING hhhhhhhhhhhhhhhhhhh Oh also lets add more deets to the warning, and upgrade it to an error I want to actually have to fix these, or just remove them if they become redundant * Fixes simple animals getting stuck in ai lists Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
41 lines
1.2 KiB
Plaintext
41 lines
1.2 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(msg)
|
|
var/list/activelist = GLOB.simple_animals[AI_ON]
|
|
msg = "NPCS:[length(activelist)]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/npcpool/fire(resumed = FALSE)
|
|
|
|
if (!resumed)
|
|
var/list/activelist = GLOB.simple_animals[AI_ON]
|
|
src.currentrun = activelist.Copy()
|
|
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
|
|
while(currentrun.len)
|
|
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
|
|
--currentrun.len
|
|
|
|
if (QDELETED(SA)) // Some issue causes nulls to get into this list some times. This keeps it running, but the bug is still there.
|
|
GLOB.simple_animals[AI_ON] -= SA
|
|
stack_trace("Found a null in simple_animals active list [SA.type]!")
|
|
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
|