Files
Bubberstation/code/datums/ai/basic_mobs/basic_subtrees/find_food.dm
Jacquerel 940e2d31cf tgstation is back online and you are a horrible goose (#89204)
## About The Pull Request

Converts geese to basic mobs.
Nobody else did this one because two separate other developers have said
they started and then examining what the goose does made them feel
mildly ill, but I am stronger.

I will admit though I wasn't 100% committed to making it work exactly
the same way, I rewrote the entire system to use interfaces I like more
(read: I put all this shit in a status effect which means any mob can be
given the ability to vomit out everything in its contents) and if that
means the behaviour is only "inspired by" that didn't bother me that
much.

**Geese:**
- Wander randomly around.
- Peck people who attack them.
- Occasionally start pecking other nearby animals for absolutely no
reason.
- Eat any food they randomly wander within one tile of, but don't seek
it out further than that.
- Eat anything made of plastic that they randomly wander within one tile
of.
- Choke to death over 30 seconds if they eat anything made of plastic.
- Vomit out whatever it was that they choked on when they die.
- Honk (this is new).

The more famous subtype of goose is Birdboat. Birdboat is a unique goose
present on several maps with some additional behaviour.

**Birdboat:**
- Is chill and doesn't start pecking people for no reason.
- Is occasionally possessed by ghosts.
- Builds up an internal vomit-meter as he eats things. Moving around and
just sort of generally hanging will start rolling dice to find out when
Birdboat's tummy gets upset.
- May start vomiting instead of choking to death on plastic, thereby
saving his own life.
- Vomits out everything that he just ate while running around, making a
mess of the floor.
- Starts eating everything he just vomited out again.

Unlike regular geese who just eat your food and it's gone, Birdboat's
miraculous digestion preserves all of the food he eats so if he consumes
the entire kitchen counter it will eventually come back out again the
way it went in. Although you might not want to eat it any more.

The precise way in which this manifests may be slightly different, but
largely this is also what these animals did before.

Other stuff:

I noticed a bunch of find/set behaviours were not setting a search
range? I think that means they were never finding anything?
I did not actually test any of them to see if they were broken, but it's
possible that a bunch of broken AI behaviours like "climbing trees" may
now actually start triggering because they have a search radius greater
than an orange of 0.

I added "keep this in contents instead of deleting it" as a parameter
for generic eating and slapped it on the goldgrub, as it is used in two
places and may end up being used in more.

## Why It's Good For The Game

This kills off the last user of the `retaliate` subtype and makes our
list so so much closer to finish.
It's like... a couple of bots, a handful of oddballs (I'll probably
handle these soon), and then just the mining bosses and minibosses to
go.

If you give a human the vomit goose ability (now that I made it work on
any mob) they will eject all their organs and body parts via the mouth
until they die, if you don't do the brain or heart first you can vomit
your own head off.

## Changelog

🆑
refactor: Geese have been moved to the basic mob subsystem, please
report any unusual behaviour.
/🆑

---------

Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
2025-01-27 14:54:34 +02:00

44 lines
1.8 KiB
Plaintext

/// similar to finding a target but looks for food types in the // the what?
/datum/ai_planning_subtree/find_food
///behavior we use to find the food
var/datum/ai_behavior/finding_behavior = /datum/ai_behavior/find_and_set/in_list
///key of foods list
var/food_list_key = BB_BASIC_FOODS
///key where we store our food
var/found_food_key = BB_TARGET_FOOD
///key holding any emotes we play after eating food
var/emotes_blackboard_list = BB_EAT_EMOTES
///key where we store our search range
var/search_range = BB_SEARCH_RANGE
/datum/ai_planning_subtree/find_food/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
var/list/foods_list = controller.blackboard[food_list_key]
if(!length(foods_list))
CRASH("the types of food has not been supplied in the [food_list_key] key!")
if(controller.blackboard[BB_NEXT_FOOD_EAT] > world.time)
return
if(!controller.blackboard_key_exists(found_food_key))
controller.queue_behavior(finding_behavior, found_food_key, foods_list, controller.blackboard[BB_SEARCH_RANGE])
return
controller.queue_behavior(/datum/ai_behavior/interact_with_target/eat_food, found_food_key, emotes_blackboard_list)
return SUBTREE_RETURN_FINISH_PLANNING
/datum/ai_behavior/interact_with_target/eat_food
///default list of actions we take after eating
var/list/food_actions = list(
"eats up happily!",
"chomps with glee!",
)
/datum/ai_behavior/interact_with_target/eat_food/perform(seconds_per_tick, datum/ai_controller/controller, target_key, emotes_blackboard_list)
. = ..()
if(. & AI_BEHAVIOR_FAILED)
return
var/list/emotes_to_pick = controller.blackboard[emotes_blackboard_list] || food_actions
if(!length(emotes_to_pick))
return
var/mob/living/living_pawn = controller.pawn
living_pawn.manual_emote(pick(emotes_to_pick))