Improvements to simple animal make_baby and Runtime

Runtime now only stores the children she actually made, instead of
being the mother of every cat in the mob list like some kind of god cat

make_baby no longer spawns off for 400 seconds to set a flag
This commit is contained in:
oranges
2016-10-10 05:10:57 +00:00
parent fe68e6f97e
commit b8ea78cd00
3 changed files with 20 additions and 15 deletions
@@ -80,7 +80,8 @@
icon_dead = "cat_dead"
gender = FEMALE
gold_core_spawnable = 0
var/list/family = list()
var/list/family = list()//var restored from savefile, has count of each child type
var/list/children = list()//Actual mob instances of children
var/cats_deployed = 0
var/memory_saved = 0
@@ -99,6 +100,12 @@
Write_Memory()
..()
/mob/living/simple_animal/pet/cat/Runtime/make_babies()
var/mob/baby = ..()
if(baby)
children += baby
return baby
/mob/living/simple_animal/pet/cat/Runtime/death()
if(!memory_saved)
Write_Memory(1)
@@ -115,7 +122,7 @@
var/savefile/S = new /savefile("data/npc_saves/Runtime.sav")
family = list()
if(!dead)
for(var/mob/living/simple_animal/pet/cat/kitten/C in mob_list)
for(var/mob/living/simple_animal/pet/cat/kitten/C in children)
if(istype(C,type) || C.stat || !C.z || !C.butcher_results) //That last one is a work around for hologram cats
continue
if(C.type in family)
@@ -955,11 +955,11 @@
make_babies()
/mob/living/simple_animal/hostile/asteroid/gutlunch/guthen/make_babies()
if(..())
. = ..()
if(.)
udder.reagents.clear_reagents()
regenerate_icons()
//Nests
/mob/living/simple_animal/hostile/spawner/lavaland
name = "necropolis tendril"
@@ -57,7 +57,7 @@
//Hot simple_animal baby making vars
var/list/childtype = null
var/scan_ready = 1
var/next_scan_time = 0
var/animal_species //Sorry, no spider+corgi buttbabies.
//simple_animal access
@@ -353,11 +353,9 @@
..()
/mob/living/simple_animal/proc/make_babies() // <3 <3 <3
if(gender != FEMALE || stat || !scan_ready || !childtype || !animal_species || ticker.current_state != GAME_STATE_PLAYING)
return 0
scan_ready = 0
spawn(400)
scan_ready = 1
if(gender != FEMALE || stat || next_scan_time > world.time || !childtype || !animal_species || ticker.current_state != GAME_STATE_PLAYING)
return
next_scan_time = world.time + 400
var/alone = 1
var/mob/living/simple_animal/partner
var/children = 0
@@ -373,13 +371,13 @@
partner = M
else if(isliving(M) && !faction_check(M)) //shyness check. we're not shy in front of things that share a faction with us.
alone = 0
continue
return //we never mate when not alone, so just abort early
if(alone && partner && children < 3)
var/childspawn = pickweight(childtype)
new childspawn(loc)
return 1
return 0
var/turf/target = get_turf(loc)
if(target)
return new childspawn(target)
/mob/living/simple_animal/canUseTopic(atom/movable/M, be_close = 0, no_dextery = 0)
if(incapacitated())