From 247aa415f4e9ba25e24d8eca53f5f4f3be9a5850 Mon Sep 17 00:00:00 2001 From: Alffd Date: Sun, 23 Apr 2017 18:06:22 -0400 Subject: [PATCH 1/7] Ports Catsplosion from TG --- .../mob/living/simple_animal/friendly/cat.dm | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 95a1d100161..e98d1007676 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -37,6 +37,59 @@ icon_resting = "cat_rest" gender = FEMALE gold_core_spawnable = CHEM_MOB_SPAWN_INVALID + var/list/family = list() + var/lives = 9 + var/memory_saved = 0 + +/mob/living/simple_animal/pet/cat/Runtime/New() + Read_Memory() + ..() + +/mob/living/simple_animal/pet/cat/Runtime/Life() + if(!stat && ticker.current_state == GAME_STATE_FINISHED && !memory_saved) + Write_Memory() + ..() + +/mob/living/simple_animal/pet/cat/Runtime/death() + if(!memory_saved) + Write_Memory(1) + ..() + +/mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory() + var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") + S["family"] >> family + S["lives"] >> lives + + if(isnull(family)) + family = list() + + if(isnull(lives)) + lives = 9 + + if(lives <= 0) + lives = 10 //Lowers to 9 in Write_Memory + Write_Memory(1) + qdel(src) + + for(var/cat_type in family) + if(family[cat_type] > 0) + for(var/i in 1 to family[cat_type]) + new cat_type(loc) + +/mob/living/simple_animal/pet/cat/Runtime/proc/Write_Memory(dead) + var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") + if(dead) + S["lives"] << lives - 1 + family = list() + for(var/mob/living/simple_animal/pet/cat/C in mob_list) + if(istype(C,type) || C.stat || !C.butcher_results || C.name == "SyndiCat") + continue + if(C.type in family) + family[C.type] += 1 + else + family[C.type] = 1 + S["family"] << family + memory_saved = 1 /mob/living/simple_animal/pet/cat/handle_automated_action() ..() From 0d6163445165a583914494d12c0f1a58fd674ae2 Mon Sep 17 00:00:00 2001 From: Alffd Date: Thu, 4 May 2017 15:07:07 -0400 Subject: [PATCH 2/7] Ports current TG version better handling of cat creation Limits cats to 500 #nofunallowed --- .../mob/living/simple_animal/friendly/cat.dm | 32 ++++++++++--------- 1 file changed, 17 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 e98d1007676..3b8808c1e2c 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -40,12 +40,16 @@ var/list/family = list() var/lives = 9 var/memory_saved = 0 + var/list/children = list() //Actual mob instances of children + var/cats_deployed = 0 /mob/living/simple_animal/pet/cat/Runtime/New() Read_Memory() ..() /mob/living/simple_animal/pet/cat/Runtime/Life() + if(!cats_deployed && ticker.current_state >= GAME_STATE_SETTING_UP) + Deploy_The_Cats() if(!stat && ticker.current_state == GAME_STATE_FINISHED && !memory_saved) Write_Memory() ..() @@ -58,24 +62,9 @@ /mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory() var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") S["family"] >> family - S["lives"] >> lives - if(isnull(family)) family = list() - if(isnull(lives)) - lives = 9 - - if(lives <= 0) - lives = 10 //Lowers to 9 in Write_Memory - Write_Memory(1) - qdel(src) - - for(var/cat_type in family) - if(family[cat_type] > 0) - for(var/i in 1 to family[cat_type]) - new cat_type(loc) - /mob/living/simple_animal/pet/cat/Runtime/proc/Write_Memory(dead) var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") if(dead) @@ -91,6 +80,13 @@ S["family"] << family memory_saved = 1 +/mob/living/simple_animal/pet/cat/Runtime/proc/Deploy_The_Cats() + cats_deployed = 1 + for(var/cat_type in family) + if(family[cat_type] > 0) + for(var/i in 1 to min(family[cat_type],100)) //Limits to about 500 cats, you wouldn't think this would be needed (BUT IT IS) + new cat_type(loc) + /mob/living/simple_animal/pet/cat/handle_automated_action() ..() @@ -107,6 +103,12 @@ //attempt to mate make_babies() +/mob/living/simple_animal/pet/cat/Runtime/make_babies() + var/mob/baby = ..() + if(baby) + children += baby + return baby + /mob/living/simple_animal/pet/cat/handle_automated_movement() ..() if(eats_mice && !incapacitated()) From 993db34b8f3518a7189b74da38ea7276ed55e31a Mon Sep 17 00:00:00 2001 From: Alffd Date: Sat, 13 May 2017 18:47:05 -0400 Subject: [PATCH 3/7] Fixes make_babies not returning the baby --- code/modules/mob/living/simple_animal/simple_animal.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 1aa6c82b4a8..f24068bf35d 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -592,7 +592,7 @@ alone = 0 continue if(alone && partner && children < 3) - new childtype(loc) + return new childtype(loc) /mob/living/simple_animal/say_quote(var/message) var/verb = "says" From cecea25fd3ac2a8300a38446d93631fac25fbea4 Mon Sep 17 00:00:00 2001 From: Alffd Date: Wed, 24 May 2017 18:11:46 -0400 Subject: [PATCH 4/7] Ports rest of TG Cat --- .../mob/living/simple_animal/friendly/cat.dm | 85 ++++++++++++------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 3b8808c1e2c..b20d492a829 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -38,7 +38,6 @@ gender = FEMALE gold_core_spawnable = CHEM_MOB_SPAWN_INVALID var/list/family = list() - var/lives = 9 var/memory_saved = 0 var/list/children = list() //Actual mob instances of children var/cats_deployed = 0 @@ -54,6 +53,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) @@ -62,21 +67,21 @@ /mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory() var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") S["family"] >> family + if(isnull(family)) family = list() /mob/living/simple_animal/pet/cat/Runtime/proc/Write_Memory(dead) var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") - if(dead) - S["lives"] << lives - 1 family = list() - for(var/mob/living/simple_animal/pet/cat/C in mob_list) - if(istype(C,type) || C.stat || !C.butcher_results || C.name == "SyndiCat") - continue - if(C.type in family) - family[C.type] += 1 - else - family[C.type] = 1 + if(!dead) + for(var/mob/living/simple_animal/pet/cat/kitten/C in children) + if(istype(C,type) || C.stat || !C.z || !C.butcher_results) + continue + if(C.type in family) + family[C.type] += 1 + else + family[C.type] = 1 S["family"] << family memory_saved = 1 @@ -87,31 +92,44 @@ for(var/i in 1 to min(family[cat_type],100)) //Limits to about 500 cats, you wouldn't think this would be needed (BUT IT IS) new cat_type(loc) -/mob/living/simple_animal/pet/cat/handle_automated_action() - ..() + +/mob/living/simple_animal/pet/cat/Life() + if(!stat && !buckled && !client) + if(prob(1)) + custom_emote(1, pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) + icon_state = "[icon_living]_rest" + resting = 1 + update_canmove() + else if (prob(1)) + custom_emote(1, pick("sits down.", "crouches on its hind legs.", "looks alert.")) + icon_state = "[icon_living]_sit" + resting = 1 + update_canmove() + else if (prob(1)) + if (resting) + custom_emote(1, pick("gets up and meows.", "walks around.", "stops resting.")) + icon_state = "[icon_living]" + resting = 0 + update_canmove() + else + custom_emote(1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) //MICE! - if(eats_mice && loc && isturf(loc) && !incapacitated()) - for(var/mob/living/simple_animal/mouse/M in view(1,src)) - if(!M.stat && Adjacent(M)) - custom_emote(1, "splats \the [M]!") - M.splat() - movement_target = null - stop_automated_movement = 0 - break + if((src.loc) && isturf(src.loc)) + if(!stat && !resting && !buckled) + for(var/mob/living/simple_animal/mouse/M in view(1,src)) + if(!M.stat && Adjacent(M)) + custom_emote(1, "splats \the [M]!") + M.splat() + movement_target = null + stop_automated_movement = 0 + break + + ..() - //attempt to mate make_babies() -/mob/living/simple_animal/pet/cat/Runtime/make_babies() - var/mob/baby = ..() - if(baby) - children += baby - return baby - -/mob/living/simple_animal/pet/cat/handle_automated_movement() - ..() - if(eats_mice && !incapacitated()) + if(!stat && !resting && !buckled) turns_since_scan++ if(turns_since_scan > 5) walk_to(src,0) @@ -130,6 +148,13 @@ stop_automated_movement = 1 walk_to(src,movement_target,0,3) + +/mob/living/simple_animal/pet/cat/Runtime/make_babies() + var/mob/baby = ..() + if(baby) + children += baby + return baby + /mob/living/simple_animal/pet/cat/Proc name = "Proc" From 7ab60d613fe3a07ffda22c99c2684248d07574af Mon Sep 17 00:00:00 2001 From: Alffd Date: Wed, 31 May 2017 20:50:20 -0500 Subject: [PATCH 5/7] Fox fixes --- .../mob/living/simple_animal/friendly/cat.dm | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index b20d492a829..fa911ee8b5a 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -93,29 +93,29 @@ new cat_type(loc) -/mob/living/simple_animal/pet/cat/Life() - if(!stat && !buckled && !client) - if(prob(1)) - custom_emote(1, pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) - icon_state = "[icon_living]_rest" - resting = 1 +/mob/living/simple_animal/pet/cat/handle_automated_action() + ..() + if(prob(1)) + custom_emote(1, pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) + icon_state = "[icon_living]_rest" + resting = 1 + update_canmove() + else if (prob(1)) + custom_emote(1, pick("sits down.", "crouches on its hind legs.", "looks alert.")) + icon_state = "[icon_living]_sit" + resting = 1 + update_canmove() + else if (prob(1)) + if (resting) + custom_emote(1, pick("gets up and meows.", "walks around.", "stops resting.")) + icon_state = "[icon_living]" + resting = 0 update_canmove() - else if (prob(1)) - custom_emote(1, pick("sits down.", "crouches on its hind legs.", "looks alert.")) - icon_state = "[icon_living]_sit" - resting = 1 - update_canmove() - else if (prob(1)) - if (resting) - custom_emote(1, pick("gets up and meows.", "walks around.", "stops resting.")) - icon_state = "[icon_living]" - resting = 0 - update_canmove() - else - custom_emote(1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) + else + custom_emote(1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) //MICE! - if((src.loc) && isturf(src.loc)) + if(eats_mice && loc && isturf(loc) && !incapacitated()) if(!stat && !resting && !buckled) for(var/mob/living/simple_animal/mouse/M in view(1,src)) if(!M.stat && Adjacent(M)) @@ -124,11 +124,10 @@ movement_target = null stop_automated_movement = 0 break - - ..() - make_babies() +/mob/living/simple_animal/pet/cat/handle_automated_movement() + ..() if(!stat && !resting && !buckled) turns_since_scan++ if(turns_since_scan > 5) From 1176929d44017d6bfae28f37fbedc97ff92a7851 Mon Sep 17 00:00:00 2001 From: Alffd Date: Thu, 1 Jun 2017 17:16:53 -0500 Subject: [PATCH 6/7] More fixes --- .../mob/living/simple_animal/friendly/cat.dm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index fa911ee8b5a..aa23cad4a25 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -115,15 +115,14 @@ custom_emote(1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) //MICE! - if(eats_mice && loc && isturf(loc) && !incapacitated()) - if(!stat && !resting && !buckled) - for(var/mob/living/simple_animal/mouse/M in view(1,src)) - if(!M.stat && Adjacent(M)) - custom_emote(1, "splats \the [M]!") - M.splat() - movement_target = null - stop_automated_movement = 0 - break + if(eats_mice && isturf(loc) && !incapacitated()) + for(var/mob/living/simple_animal/mouse/M in view(1,src)) + if(!M.stat && Adjacent(M)) + custom_emote(1, "splats \the [M]!") + M.splat() + movement_target = null + stop_automated_movement = 0 + break make_babies() /mob/living/simple_animal/pet/cat/handle_automated_movement() From d5fe3391d48cf026916488113cfd59dc60d43b13 Mon Sep 17 00:00:00 2001 From: Alffd Date: Fri, 9 Jun 2017 22:57:16 -0400 Subject: [PATCH 7/7] Well, that was dumb --- code/modules/mob/living/simple_animal/friendly/cat.dm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index aa23cad4a25..5f977bfd508 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -147,12 +147,6 @@ walk_to(src,movement_target,0,3) -/mob/living/simple_animal/pet/cat/Runtime/make_babies() - var/mob/baby = ..() - if(baby) - children += baby - return baby - /mob/living/simple_animal/pet/cat/Proc name = "Proc" @@ -180,4 +174,4 @@ gold_core_spawnable = CHEM_MOB_SPAWN_INVALID eats_mice = 0 atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) - minbodytemp = 0 \ No newline at end of file + minbodytemp = 0