Houndbrain
Based on game build 714014 | Last updated: 2026-03-03
Overview
HoundBrain is a brain component responsible for orchestrating hound AI behavior through a behavior tree. It handles core tasks such as following or hunting players, eating corpse food (non-mutated hounds), attacking walls when leaderless, returning to home base, and entering/remaining in statue form for clay hounds or abandoned pets. The behavior differs significantly between pet_hound, clay hounds, and mutated (lunar_aligned) hounds, and it integrates with components like combat, follower, homeseeker, eater, and burnable to make context-aware decisions.
Usage example
local inst = CreateEntity()
inst:AddTag("hound")
inst:AddComponent("brain")
inst.components.brain:SetBrain("houndbrain")
-- Behavior will activate automatically upon stategraph entry
Dependencies & tags
Components used: combat, follower, homeseeker, eater, burnable
Tags: Checks pet_hound, clay, lunar_aligned; uses INLIMBO, outofreach, NOCLICK, fire, creaturecorpse, statue
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
carcass | Entity or nil | nil | Stores the currently selected valid carcass entity for consumption. |
reanimatetime | number?, true, or nil | nil | Internal timer used to delay and trigger reanimation for clay hounds or abandoned pets (value true indicates ready to reanimate). |
Main functions
SelectCarcass()
- Description: Finds and selects a valid non-mutating creature corpse within
SEE_DIST(30 units) for consumption. Used for non-mutated hounds. - Parameters: None.
- Returns:
boolean—trueif a valid carcass is found and stored inself.carcass;falseotherwise.
CheckCarcass()
- Description: Validates that the currently stored
self.carcassis still usable: not burning, still valid, tagged ascreaturecorpse, and not mutating. - Parameters: None.
- Returns:
boolean—trueifself.carcasspasses all checks.
GetCarcassPos()
- Description: Returns the world position of the validated carcass, or
nilif the carcass is invalid or unready. - Parameters: None.
- Returns:
Vector3?— World position of the carcass if valid; otherwisenil.
OnStart()
- Description: Initializes and assigns the root behavior tree node based on hound type (
clayvs. standard vs. mutated). It constructs complexPriorityNode/WhileNode/ChaseAndAttack/Leash/Wandertrees tailored to the hound's state and tags. - Parameters: None.
- Returns: Nothing. Sets
self.btwith the constructedBTinstance.
Events & listeners
- Listens to: None directly (behavior tree handles state transitions via nodes).
- Pushes:
becomestatue,reanimate,chomp— conditionally triggered during statue transitions, reanimation, and carcass eating, respectively.