Eyeturretbrain
Based on game build 714014 | Last updated: 2026-02-27
Overview
This component defines the AI behavior for the Eye Turret entity. It inherits from Brain and constructs a behavior tree (BT) upon initialization. The behavior tree prioritizes two key actions: engaging in combat via StandAndAttack, and rotating to face the nearest valid target within a specified radius using FaceEntity. The component is responsible for initializing the behavior tree root node and does not define additional state management logic beyond this setup.
Dependencies & Tags
- Components used: None identified.
- Tags: Checks for the
notargettag on potential targets (viatarget:HasTag("notarget")). Turrets ignore targets bearing this tag.
Properties
self.inst|Entity| assigned by Brain base class | Reference to the Eye Turret entity instance owning this brain component.self.bt|BT|niluntilOnStart()is called | The behavior tree instance controlling the entity’s behavior.
Main Functions
EyeTurretBrain:OnStart()
- Description: Initializes and assigns the behavior tree (
self.bt) for the Eye Turret. It constructs a root priority node that sequentially evaluates and executes eitherStandAndAttackorFaceEntity. The priority is.25, meaning child behaviors are re-evaluated every 0.25 seconds. - Parameters: None.
- Returns:
nil.
Events & Listeners
- Listens to: None.
- Pushes: None.
Note:
GetFaceTargetFnandKeepFaceTargetFnare helper functions defined in the local scope.GetFaceTargetFnlocates the nearest player withinSTART_FACE_DIST(10 units) who lacks thenotargettag.KeepFaceTargetFnconfirms that the current target remains withinKEEP_FACE_DIST(15 units) and still lacks thenotargettag. These functions are passed as callbacks to theFaceEntitybehavior and are not methods of theEyeTurretBrainclass.