Merge pull request #489 from Citadel-Station-13/upstream-merge-26319
[MIRROR] Moves simple animal automation from SSmob to SSnpc
This commit is contained in:
@@ -18,4 +18,5 @@ GLOBAL_LIST_EMPTY(silicon_mobs) //all silicon mobs
|
||||
GLOBAL_LIST_EMPTY(ai_list)
|
||||
GLOBAL_LIST_EMPTY(pai_list)
|
||||
GLOBAL_LIST_EMPTY(available_ai_shells)
|
||||
GLOBAL_LIST_EMPTY(language_datums)
|
||||
GLOBAL_LIST_EMPTY(language_datums)
|
||||
GLOBAL_LIST_EMPTY(simple_animals)
|
||||
@@ -1,6 +1,7 @@
|
||||
#define PROCESSING_NPCS 0
|
||||
#define PROCESSING_DELEGATES 1
|
||||
#define PROCESSING_ASSISTANTS 2
|
||||
#define PROCESSING_SIMPLES 0
|
||||
#define PROCESSING_NPCS 1
|
||||
#define PROCESSING_DELEGATES 2
|
||||
#define PROCESSING_ASSISTANTS 3
|
||||
|
||||
SUBSYSTEM_DEF(npcpool)
|
||||
name = "NPC Pool"
|
||||
@@ -35,10 +36,29 @@ SUBSYSTEM_DEF(npcpool)
|
||||
// 5. Do all assignments: goes through the delegated/coordianted bots and assigns the right variables/tasks to them.
|
||||
|
||||
if (!resumed)
|
||||
src.currentrun = processing.Copy()
|
||||
stage = PROCESSING_NPCS
|
||||
src.currentrun = GLOB.simple_animals.Copy()
|
||||
stage = PROCESSING_SIMPLES
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/currentrun = src.currentrun
|
||||
|
||||
if(stage == PROCESSING_SIMPLES)
|
||||
while(currentrun.len)
|
||||
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
|
||||
--currentrun.len
|
||||
|
||||
if(!SA.ckey)
|
||||
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
|
||||
|
||||
stage = PROCESSING_NPCS
|
||||
currentrun = processing.Copy()
|
||||
src.currentrun = currentrun
|
||||
var/list/canBeUsed = src.canBeUsed
|
||||
|
||||
if(stage == PROCESSING_NPCS)
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
/mob/living/simple_animal/Initialize()
|
||||
..()
|
||||
GLOB.simple_animals += src
|
||||
handcrafting = new()
|
||||
if(gender == PLURAL)
|
||||
gender = pick(MALE,FEMALE)
|
||||
@@ -104,18 +105,6 @@
|
||||
client.screen += client.void
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/Life()
|
||||
if(..()) //alive
|
||||
if(!ckey)
|
||||
if(stat != DEAD)
|
||||
handle_automated_movement()
|
||||
if(stat != DEAD)
|
||||
handle_automated_action()
|
||||
if(stat != DEAD)
|
||||
handle_automated_speech()
|
||||
if(stat != DEAD)
|
||||
return 1
|
||||
|
||||
/mob/living/simple_animal/updatehealth()
|
||||
..()
|
||||
health = Clamp(health, 0, maxHealth)
|
||||
@@ -426,6 +415,7 @@
|
||||
if(nest)
|
||||
nest.spawned_mobs -= src
|
||||
nest = null
|
||||
GLOB.simple_animals -= src
|
||||
return ..()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user