Birchnutdrakebrain
Based on game build 714014 | Last updated: 2026-02-27
Overview
This component implements the behavior tree for the Birchnutdrake entity, an AI-controlled character in Don't Starve Together. It defines how the entity responds to threats (panic), navigates within a leashed range from its spawn point, pursues and attacks targets, and manages idle states. The component relies on common behavior utilities and integrates with the knownlocations component to track the entity's home position.
Dependencies & Tags
- Components used:
knownlocations(used viainst.components.knownlocationsforGetLocationandRememberLocation) - Tags: None identified
Properties
No public properties are initialized in the constructor. All state is encapsulated within the class methods.
Main Functions
BirchNutDrakeBrain:OnStart()
- Description: Initializes and assigns the entity's behavior tree. The behavior tree root is built using a priority sequence of behaviors: panic triggers (electric fence, general panic), leash logic, chase and attack, and a final fallback action to exit combat/idle.
- Parameters: None
- Returns: None
BirchNutDrakeBrain:OnInitializationComplete()
- Description: Records the entity's current position as the "spawnpoint" home location using the
knownlocationscomponent. This position is used later by the leashed behavior to determine how far the entity may wander. - Parameters: None
- Returns: None
GetHomePos(inst)
- Description: Helper function used by the leashed behavior to retrieve the stored spawn point location. Used to compute distance for leash enforcement.
- Parameters:
inst— The entity instance. Expected to have aknownlocationscomponent.
- Returns:
Vector3— The position stored under the key"spawnpoint".
Events & Listeners
- Listens to: None
- Pushes:
"exit"— Fired in the fallback action node of the behavior tree (used to signal the entity should stop active behaviors and enter an idle state). Payload includes{ force = true, idleanim = true }.
Notes
- Uses
PriorityNodewith timeout0.25for behavior evaluation. - The
ChaseAndAttackbehavior is configured with attack ranges12and21. - The
Leashbehavior allows wandering up to20units from home before pulling the entity back within5units.