From b8ea78cd0097a32c84fab68f6047898019b5c320 Mon Sep 17 00:00:00 2001 From: oranges Date: Mon, 3 Oct 2016 23:01:03 +0000 Subject: [PATCH] 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 --- .../mob/living/simple_animal/friendly/cat.dm | 11 ++++++++-- .../simple_animal/hostile/mining_mobs.dm | 4 ++-- .../mob/living/simple_animal/simple_animal.dm | 20 +++++++++---------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 3a64055819a..d9823b36322 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -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) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm index 3478fff7ad0..75e22424426 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs.dm @@ -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" diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 5d571abf654..b50ff204cad 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -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())