Skip to content

SeatAI ​

Inherits: Resource

Inherited by: DriverSeatAI, TurretSeatAI

What acts for a seat when the player does not: a companion or an NPC that sits in it, or nobody (a tank crewed by AI). Every physics frame the AI is asked for the move input of the seat, the same x (right) and y (forward) that the keys of the player give, and it can do other things with the helpers of the ride (aim a turret, cast an ability). A DriverSeat's input goes to the drive logic of the mount, so an AI tank turns like a tank that a player drives. A script that extends SeatAI in the folder data_classes/mount/seat_ai/ is found by the Mounts editor and can be chosen there; its exported variables appear in the editor.

Description ​

The AI is active when the seat is not controlled by the player: the character in control sitting in the seat takes it over, and the AI takes it back when that character gets up or another character is put in control.

Variables ​

MountSessionsession

Methods ​

Stringget_ai_type_name()
Stringget_ai_type_description()
Dictionaryget_field_descriptions()
voidbegin( p_session: MountSession )
Vector2think( _delta: float )
voidend()

Variable descriptions ​

MountSession session ​

The ride this AI belongs to (set when it starts)

Method descriptions ​

String get_ai_type_name() ​

What this AI is called in the editor list

String get_ai_type_description() ​

A sentence about what this AI does, for the editor

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)

void begin( p_session: MountSession ) ​

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

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

void end() ​

The AI stops (the rider gets up, a player takes the seat). Override to clean up