Lunarthrall Plant Gestalt Brain
Based on game build 714014 | Last updated: 2026-02-27
Overview
This brain component governs the behavior of Lunarthrall Plant Gestalt entities — mobile entities that seek to infest specific plants. It implements a behavior tree (BT) that prioritizes movement logic based on plant proximity and player visibility. When a valid target plant exists and the gestalt is within close range, it triggers the "infest" state. If the target is too far or invalid, or no target is available, it generates randomized movement paths to stay offscreen while waiting for respawn opportunities. It relies on the lunarthrall_plantspawner component for plant validation and offscreen teleportation logic.
Dependencies & Tags
- Components used:
inst.components.timer— to check for the"justspawned"timer (viaTimerExists("justspawned"))TheWorld.components.lunarthrall_plantspawner— to:- call
FindPlant()for plant revalidation - call
MoveGestaltToPlant(inst)for offscreen positioning
- call
- Tags: None identified.
- Behaviors used:
follow,wander,standstill,faceentityare imported but not directly used in the current implementation.
Properties
The constructor does not define any explicit instance properties. All state is carried on inst, which is the entity instance to which the brain is attached.
| Property | Type | Default Value | Description |
|---|---|---|---|
inst.plant_target | Entity or nil | nil | Reference to the target plant the gestalt is moving toward. Set externally or updated in MoveToPointAction. |
inst.randomdirection | number (radians) | nil | Persisted random direction used for wandering; initialized on first use. |
inst.sg | StateGraph | — | Reference to the entity's state graph, accessed during action resolution. |
inst.bt | BT | — | Behavior tree root assigned in OnStart. |
Main Functions
MoveToPointAction(inst)
- Description: Helper function that computes a target position for the gestalt to move toward. It evaluates the entity's
plant_targetand current player visibility. It may cause the entity to infest a plant, move toward the plant, or generate a random position offscreen. - Parameters:
inst(Entity): The entity instance (typically the gestalt) requesting movement action.
- Returns:
BufferedActionornil: A buffered walk action toward the computedpos, ornilif no position was set.
LunarThrall_Plant_Gestalt_Brain:OnStart()
- Description: Initializes the brain's behavior tree on start. Sets up a root
PriorityNodethat continuously executesMoveToPointActionwhile the entity is in the"idle"state tag. - Parameters: None.
- Returns: None. Assigns
self.btto aBTinstance with a behavior tree rooted in aPriorityNode.
Events & Listeners
None identified.