Friendlyfruitflybrain
Based on game build 714014 | Last updated: 2026-03-03
Overview
FriendlyFruitFlyBrain defines the behavior tree for friendly fruit fly entities. It inherits from Brain and orchestrates high-level behaviors such as following a leader (via the follower component), wandering within a radius, facing the leader, and seeking out farm plants to interact with. It relies on reusable behavior nodes from behaviours/ and common AI utilities from brains/braincommon.lua.
Usage example
local inst = CreateEntity()
-- Ensure 'follower' component is present for leader tracking
inst:AddComponent("follower")
inst:AddBrain("friendlyfruitflybrain")
Dependencies & tags
Components used: follower
Tags: None identified.
Properties
No public properties.
Main functions
OnStart()
- Description: Initializes the behavior tree root node, defining the priority-ordered behavior sequence for the entity.
- Parameters: None.
- Returns: Nothing.
- Error states: May behave unpredictably if required components (e.g.,
follower) are absent;GetLeader()returnsnilin such cases, causing fallback behavior.
Events & listeners
- Listens to: None identified.
- Pushes: None identified.