Gestalt Guard Evolvedbrain
Based on game build 714014 | Last updated: 2026-02-27
Overview
This component defines the decision-making logic for the evolved Gestalt Guard entity. It constructs and manages a behavior tree (self.bt) that orchestrates the entity’s actions in combat. The brain dynamically evaluates the distance to its combat target and executes the appropriate attack sequence—such as teleporting to close distance, evading, or performing melee strikes at close, mid, or far ranges—while respecting busy state constraints.
The brain depends on the combat component to identify the current target and coordinates movement and attack actions using utility functions (GetTarget, GetTargetPos, IsTarget) to abstract target state. It imports and utilizes the standstill behavior for fallback non-combat states.
Dependencies & Tags
- Components used:
combat(inst.components.combat) — for accessing and validating the current combat target.
- Tags:
- None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | nil (inherited) | The entity instance this brain controls, passed to the constructor and stored as self.inst. |
bt | BT | nil (assigned in OnStart) | The behavior tree instance created during OnStart. |
Note: The constructor does not declare additional public properties beyond those initialized in the base Brain class.
Main Functions
OnStart()
- Description: Initializes the behavior tree by constructing the root node tree. This method is called when the brain begins executing (i.e., when the entity’s state graph enters the brain’s active state). It sets up a hierarchy that prioritizes handling non-busy states, computes distance to the target, and selects attack actions conditionally based on range thresholds from
TUNING. - Parameters: None.
- Returns: None.
Internal logic (not directly callable):
GetTarget(inst)— Returnsinst.components.combat.target, the current combat target entity.GetTargetPos(inst)— Returns the world position of the target, ornilif no valid target exists.IsTarget(inst, target)— Returnstrueiftargetmatches the currentcombat.targetusingCombat:TargetIs.calculatedistancetotarget()— Computes Euclidean distance to the current target usingGetDistanceSqToInstand stores it in the localdistancetotargetvariable; sets it tonilif the target is invalid.startcombatphase()— Faces the target, attempts teleport-based approach (if_should_teleportis true), and if successful, teleports the entity closer. Then attempts evasion via teleport. Returnstrueif a teleport action was taken, elsefalse.hastarget()— Helper returningtrueifdistancetotargetis non-nil.
Behavior Tree structure:
- Root:
PriorityNode(weight0.5)- Child 1 (Priority):
WhileNode(executes only while the entity’s state graph lacks the"busy"tag)FailIfSuccessDecorator(ActionNode(calculatedistancetotarget))IfNode(hastarget, "Combat", ...)ConditionNode(startcombatphase)- Nested range checks:
"Range: Close": executesTryAttack_Close()ifdistancetotarget < TUNING.GESTALT_EVOLVED_CLOSE_RANGE"Range: Mid": executesTryAttack_Mid()ifdistancetotarget < TUNING.GESTALT_EVOLVED_MID_RANGE"Range: Far": executesTryAttack_Far()ifdistancetotarget < TUNING.GESTALT_EVOLVED_FAR_RANGE"Fallback": executesTryAttack_Teleport_GetCloser()if none of the above matched
StandStill(self.inst)— fallback action when not in combat.
- Child 2 (Fallback):
StandStill(self.inst)— executed while in"busy"state.
- Child 1 (Priority):
Events & Listeners
- None identified.