Skip to content

TurretSeatAI ​

Inherits: SeatAI < Resource

Aims the turret of its seat at the target and fires the abilities the seat lists. The target is the one of the rider (a companion's target) or, with nobody sitting, the one of the mount (the target its behavior picked). The abilities are cast by the rider, or by the mount when nobody sits, so they must be on that entity's abilities (a seat grants them to a rider; an NPC has them in its definition). Use it on a TurretSeat.

Properties ​

floatfire_range30.0
floataim_tolerance_degrees8.0
floatfire_interval0.5

Variables ​

intattempts0
intsuccesses0

Methods ​

Stringget_ai_type_name()
Stringget_ai_type_description()
Dictionaryget_field_descriptions()
voidbegin( p_session: MountSession )
Vector2think( delta: float )

Property descriptions ​

float fire_range = 30.0 ​

It fires only at targets nearer than this (units)

float aim_tolerance_degrees = 8.0 ​

It fires when the turret points within this many degrees of the target

float fire_interval = 0.5 ​

Seconds between two tries to fire (the abilities have their own cooldowns on top)

Variable descriptions ​

int attempts = 0 ​

How many times it tried to fire and how many times an ability was used (for tests and for your own code)

int successes = 0 ​

No description yet.

Method descriptions ​

String get_ai_type_name() ​

What this AI is called in the editor list (from SeatAI)

String get_ai_type_description() ​

A sentence about what this AI does, for the editor (from SeatAI)

Dictionary get_field_descriptions() ​

The sentences the editor shows as tooltips: {name of an exported variable: text}. An AI of your own adds its variables (call super and merge) (from SeatAI)

void begin( p_session: MountSession ) ​

The AI starts (the rider sits, or the crew takes the seat). Override to set up a state (from SeatAI)

Vector2 think( delta: float ) ​

Every physics frame while the AI acts. Return the move input of the seat (x right, y forward, each -1 to 1). Override this (from SeatAI)