Friendlyfruitflybrain
Based on game build 714014 | Last updated: 2026-02-27
Overview
This brain component defines the behavioral logic for friendly fruit flies in the game. It constructs and runs a behavior tree (BT) that prioritizes responses to danger (panic triggers), foraging for farm plants, following their leader within defined distance bounds, maintaining orientation toward the leader, and wandering when no higher-priority task is active. It relies on common behavior types from the behaviours/ directory and integrates with the follower component to determine the current leader via GetLeader().
Dependencies & Tags
- Components used:
follower(accessed viainst.components.follower:GetLeader()) - Tags: None identified.
Properties
No public properties are initialized directly in the constructor. The component inherits from Brain and initializes a private behavior tree (self.bt) during OnStart().
Main Functions
FriendlyFruitFlyBrain:OnStart()
- Description: Initializes and starts the behavior tree. This method is called automatically when the brain component begins managing the entity. It sets up a priority-based behavior tree with the following tasks, evaluated in order:
PanicTriggerandElectricFencePanicTrigger: Immediate reaction to danger.FindFarmPlant: Forages for interactable farm plants usingGetFollowPosas the reference position.Follow: Moves toward the leader to maintain a target distance range of 0–10 units, with a preferred distance of 5.FaceEntity: Rotates the entity to face the leader.Wander: Moves randomly within a 20-unit radius around the leader's position.
- Parameters: None.
- Returns: None.
Events & Listeners
None. This component does not register or fire any events directly.