Files
Bubberstation/code/modules/mob/living/basic/turtle/turtle_ai.dm
Ben10Omintrix 7d9386bdce Turtles (#87493)
## About The Pull Request
adds turtles to the game! but these aren't your typical turtles. 

![turtlestates](https://github.com/user-attachments/assets/b9d35a32-5f04-4255-bbac-d1ed57b2abb1)

these are flora-turtles, with giant trees growing on their shells. These
trees can emit fields which affects nearby hydroponic plants. Initially,
the trees start out as young buds, from there the tree can evolve into
different types depending on what you feed the turtle.

Feeding them pesticides causes the tree to blossom to be purple. this
tree's fields will help kill some pests and weeds in nearby plants.

Feeding them nutrients gives you the green tree, the fields will heal
nearby plants

Feeding them mutators like uranium or left 4 zed gives you the yellow
tree. the fields increase instability of plants

The turtle will emit these fields every once in a while, ONLY when its
feeling happy. therefore you'll have to pet it, clean it and feed it
every once in a while to keep it satisfied. You can view the turtle's
happiness by shift clicking it.


https://github.com/user-attachments/assets/a47136a1-06a1-419e-acc2-2f6f4468e296

The turtle only eats seeds. after eating a seed, itll process it and
spit out its corresponding fruit! (for example, feeding it an apple seed
gives you an apple). itll also sometimes playfully headbutt your legs
and it loves going around smelling the scent from nearby plants

you can get these turtles by fishing the hydroponics tray or by ordering
them through cargo.

## Why It's Good For The Game
adds a new fun way for botanists to take care of their plants. While
these turtles alone arent enough to fully replace plant dedicated
nutrients, they add small extra support.

## Changelog
🆑
add: adds flora-turtles. obtainable through cargo or by fishing from the
hydroponics tray
/🆑
2024-12-23 00:35:45 +01:00

93 lines
3.4 KiB
Plaintext

/datum/ai_controller/basic_controller/turtle
blackboard = list(
BB_HAPPY_EMOTIONS = list(
"wiggles its tree in excitement!",
"raises its head up high!",
"wags its tail enthusiastically!",
),
BB_MODERATE_EMOTIONS = list(
"keeps its head level, eyes half-closed.",
"basks in the light peacefully.",
),
BB_SAD_EMOTIONS = list(
"looks towards the floor in dissapointment...",
"the leaves on its tree droop...",
),
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk/less_walking
planning_subtrees = list(
/datum/ai_planning_subtree/find_food,
/datum/ai_planning_subtree/express_happiness,
/datum/ai_planning_subtree/use_mob_ability/turtle_tree,
/datum/ai_planning_subtree/find_and_hunt_target/headbutt_people, //playfully headbutt people's legs
/datum/ai_planning_subtree/find_and_hunt_target/sniff_flora, //mmm the aroma
)
/datum/ai_planning_subtree/use_mob_ability/turtle_tree
ability_key = BB_TURTLE_TREE_ABILITY
/datum/ai_planning_subtree/use_mob_ability/turtle_tree/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
var/happiness_count = controller.blackboard[BB_BASIC_HAPPINESS] * 100
if(happiness_count > 75)
return ..()
if(!SPT_PROB(happiness_count / 50, seconds_per_tick))
return
return ..()
/datum/ai_planning_subtree/find_and_hunt_target/sniff_flora
target_key = BB_TURTLE_FLORA_TARGET
finding_behavior = /datum/ai_behavior/find_hunt_target/sniff_flora
hunting_behavior = /datum/ai_behavior/hunt_target/sniff_flora
hunt_targets = list(
/obj/machinery/hydroponics,
/obj/item/kirbyplants,
)
hunt_range = 5
hunt_chance = 45
/datum/ai_behavior/find_hunt_target/sniff_flora
action_cooldown = 1 MINUTES
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/find_hunt_target/sniff_flora/valid_dinner(mob/living/source, obj/machinery/hydroponics/dinner, radius, datum/ai_controller/controller, seconds_per_tick)
if(!istype(dinner))
return TRUE
if(isnull(dinner.myseed))
return FALSE
if(dinner.weedlevel > 5 || dinner.pestlevel > 5) //too smelly
return FALSE
return can_see(source, dinner, radius)
/datum/ai_behavior/hunt_target/sniff_flora
always_reset_target = TRUE
/datum/ai_behavior/hunt_target/sniff_flora/target_caught(mob/living/hunter, atom/hunted)
hunter.manual_emote("Enjoys the sweet scent eminating from [hunted::name]!")
/datum/ai_planning_subtree/find_and_hunt_target/headbutt_people
target_key = BB_TURTLE_HEADBUTT_VICTIM
finding_behavior = /datum/ai_behavior/find_hunt_target/human_to_headbutt
hunting_behavior = /datum/ai_behavior/hunt_target/headbutt_leg
hunt_targets = list(/mob/living/carbon/human)
hunt_range = 4
hunt_chance = 45
/datum/ai_behavior/find_hunt_target/human_to_headbutt
action_cooldown = 2 MINUTES
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/find_hunt_target/human_to_headbutt/valid_dinner(mob/living/source, mob/living/carbon/human/dinner, radius, datum/ai_controller/controller, seconds_per_tick)
if(dinner.stat != CONSCIOUS)
return FALSE
if(isnull(dinner.get_bodypart(BODY_ZONE_R_LEG)) && isnull(dinner.get_bodypart(BODY_ZONE_L_LEG))) //no legs to headbutt!
return FALSE
return can_see(source, dinner, radius)
/datum/ai_behavior/hunt_target/headbutt_leg
always_reset_target = TRUE
/datum/ai_behavior/hunt_target/headbutt_leg/target_caught(mob/living/hunter, atom/hunted)
hunter.manual_emote("playfully headbutts [hunted]'s legs!")