Lunarthrall Plant Gestalt Brain
Based on game build 722832 | Last updated: 2026-04-21
Overview
LunarThrall_Plant_Gestalt_Brain defines the behavior tree for Lunar Thrall Gestalt entities. It manages movement toward valid Lunar Thrall plants for infestation, handles offscreen teleportation when players are nearby, and coordinates with the lunarthrall_plantspawner world component to find suitable plant targets. The brain operates on a 0.25 second update rate and prioritizes plant attachment when within range.
Usage example
local inst = SpawnPrefab("lunarthrall_plant_gestalt")
local brain = require("brains/lunarthrall_plant_gestalt_brain")
RunBrain(inst, brain)
-- The brain automatically starts and manages:
-- 1. Movement toward infestable plants
-- 2. Offscreen teleportation when players are in range
-- 3. State transitions to "infest" when attached to a plant
Dependencies & tags
External dependencies:
behaviours/follow-- required for follow behavior node definitionsbehaviours/wander-- required for wander behavior node definitionsbehaviours/standstill-- required for standstill behavior node definitionsbehaviours/faceentity-- required for face entity behavior node definitionsbrains/braincommon-- providesPossessChassisNodefor chassis possession logic
Components used:
stategraph-- checks for "idle" state tag, transitions to "infest" statetransform-- gets and sets entity position for movement and teleportationtimer-- checks for "justspawned" timer existence to control movement logiclunarthrall_plantspawner(world component) -- finds valid plants and moves gestalt offscreen
Tags:
idle-- checked via stategraph to determine if movement should occurinfest-- state tag entered when gestalt attaches to a plant
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
bt | BehaviorTree | nil | The behavior tree instance created in OnStart. |
inst | Entity | nil | The entity instance this brain controls (set by Brain._ctor). |
Main functions
OnStart()
- Description: Initializes the behavior tree with a priority node structure that checks for idle state, attempts chassis possession, and executes movement actions. Sets
self.btto the created behavior tree. - Parameters: None
- Returns: None
- Error states: Errors if
self.instis nil when accessingself.inst.sgorself.inst.Transform— no nil guard present in the node functions.
MoveToPointAction(inst)
- Description: Local helper function that generates a
BufferedActionfor walking to a target position. Handles plant target validation, distance checks, offscreen teleportation logic, and random direction movement when no plant target is available. Callsinst:Remove()when plant target is invalid andlunarthrall_plantspawnerworld component is nil (expected conditional behavior, not an error). - Parameters:
inst-- the gestalt entity instance - Returns:
BufferedActionfor WALKTO action, ornilif no valid position found - Error states: Errors if
instlackstimercomponent (no nil guard beforeinst.components.timer:TimerExistsaccess — causes nil dereference crash).
Events & listeners
None identified. This brain uses behavior tree nodes rather than direct event listening.