From e831563083475d91fea2594bf70a973a0d5006be Mon Sep 17 00:00:00 2001 From: Amylizzlep Date: Wed, 18 Oct 2023 22:56:27 +0100 Subject: [PATCH] capybaby --- code/area.dm | 4 +++- code/mob/living/critter/ai/capybara.dm | 31 ++++++++++++++++++++++++-- code/mob/living/critter/capybara.dm | 6 +++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/code/area.dm b/code/area.dm index 1bb3245153830..8f16a314f2589 100644 --- a/code/area.dm +++ b/code/area.dm @@ -2570,7 +2570,9 @@ ABSTRACT_TYPE(/area/station/crew_quarters/radio) if(!length(capyturfs)) capyturfs = get_area_turfs(/area/station/crew_quarters, floors_only=TRUE) if(length(capyturfs)) - new /mob/living/critter/small_animal/capybara(pick(capyturfs)) + var/turf/spawnloc = pick(capyturfs) + new /mob/living/critter/small_animal/capybara(spawnloc) + new /mob/living/critter/small_animal/capybara/baby(spawnloc) /area/station/crew_quarters/observatory name = "Observatory" diff --git a/code/mob/living/critter/ai/capybara.dm b/code/mob/living/critter/ai/capybara.dm index a5970743282c7..d109defaf8503 100644 --- a/code/mob/living/critter/ai/capybara.dm +++ b/code/mob/living/critter/ai/capybara.dm @@ -3,15 +3,23 @@ ..() default_task = get_instance(/datum/aiTask/prioritizer/critter/capybara, list(src)) +/datum/aiHolder/capybaby + New() + ..() + default_task = get_instance(/datum/aiTask/prioritizer/critter/capybara/baby, list(src)) + + /datum/aiTask/prioritizer/critter/capybara/New() ..() transition_tasks += holder.get_instance(/datum/aiTask/timed/sitting, list(holder, src)) transition_tasks += holder.get_instance(/datum/aiTask/timed/wander, list(holder, src)) + +/datum/aiTask/prioritizer/critter/capybara/baby/New() + ..() + transition_tasks += holder.get_instance(/datum/aiTask/sequence/goalbased/to_capy_adult, list(holder, src)) //--------------------------------------------------------------------------------------------------------------------------------------------------// // have a little sit down - - /datum/aiTask/timed/sitting name = "sitting" minimum_task_ticks = 5 @@ -31,3 +39,22 @@ . = ..() if(.) holder.owner.icon_state = "capybara" + +//--------------------------------------------------------------------------------------------------------------------------------------------------// +// keep close to an adult capy +/datum/aiTask/sequence/goalbased/to_capy_adult + weight = -10 //high value so it always keeps close + +/datum/aiTask/sequence/goalbased/to_capy_adult/precondition() + . = TRUE + for(var/mob/living/critter/small_animal/capybara/adult in range(src.holder.owner, 3)) + if(!istype(adult, /mob/living/critter/small_animal/capybara/baby)) + return FALSE + +/datum/aiTask/sequence/goalbased/to_capy_adult/get_targets() + . = ..() + for(var/mob/living/critter/small_animal/capybara/adult in range(src.holder.owner, 8)) + if(!istype(adult, /mob/living/critter/small_animal/capybara/baby)) + . += adult + + diff --git a/code/mob/living/critter/capybara.dm b/code/mob/living/critter/capybara.dm index 9466ad619e7dc..367208e27a6d9 100644 --- a/code/mob/living/critter/capybara.dm +++ b/code/mob/living/critter/capybara.dm @@ -6,3 +6,9 @@ is_npc = TRUE ai_type = /datum/aiHolder/capybara butcherable = BUTCHER_YOU_MONSTER //2 makes butchering this creature an abominable act. Which it is. You monsters. + +/mob/living/critter/small_animal/capybara/baby + name = "capybaby" + desc = "Baby coconut doggo!" + ai_type = /datum/aiHolder/capybaby + transform = matrix(0.5, 0, 0, 0, 0.5, 0)