Skip to content

Seat ​

Inherits: Resource

Inherited by: DriverSeat, PassengerSeat, TurretSeat

A place on a mount or a vehicle where one rider sits: where it is, how the rider sits, what it may do from there, and which abilities the action bar shows while it sits. This is the base: use DriverSeat (steers the mount) and PassengerSeat (only rides), or make your own by extending this class (a TurretSeat that aims a gun). A script that extends Seat in the folder data_classes/mount/seats/ is found by the Mounts editor and can be chosen there; its exported variables appear in the editor.

Description ​

Override on_enter, on_exit and process for what your seat does. The seat belongs to one ride (a copy is made when a rider sits), so it can keep a state.

Properties ​

Stringdisplay_name"Seat"
Stringmarker_name""
Vector3seat_offsetVector3(0.0, 1.0, 0.0)
Stringpose_name""
boolcontrols_movementfalse
SeatAIainull
boolai_runs_when_emptyfalse
Array[SeatAbilitySlot]ability_slots[]
boolclears_other_slotsfalse

Variables ​

MountSessionsession

Methods ​

Dictionaryget_field_descriptions()
Stringget_seat_type_name()
Stringget_seat_type_description()
Dictionarysave_state()
voidload_state( state: Dictionary )
boolcan_enter( _rider: Entity )
voidon_enter( p_session: MountSession )
voidon_exit()
voidprocess( _input: Vector2, _delta: float )
Array[String]validate()

Property descriptions ​

String display_name = "Seat" ​

What the seat is called in the editor

String marker_name = "" ​

The node of the mount model where the rider sits (a Marker3D or any Node3D, found by its name under the model). Empty: the first seat uses the mount seat of the skeleton and the others the Seat offset

Vector3 seat_offset = Vector3(0.0, 1.0, 0.0) ​

Where the rider sits compared with the mount when the model has no marker for this seat (in the space of the mount)

String pose_name = "" ​

The pose of the rider: the name of a status animation folder (its _loop animation plays while the rider sits). Empty = none

bool controls_movement = false ​

The rider of this seat steers the mount (the keys go to the drive logic). Only one seat at a time should

AI

SeatAI ai = null ​

What acts for this seat when the rider is not the player (a companion, an NPC) or when nobody sits: a SeatAI (a DriverSeatAI follows where the mount is sent, a TurretSeatAI aims and fires). The seat is player controlled when the character in control sits in it. Empty = nothing acts

bool ai_runs_when_empty = false ​

The AI acts when nobody sits in the seat (a tank crewed by AI). Only for a mount that is an NPC with a Mount interaction, and only while no player rides it

Action bar

Array[SeatAbilitySlot] ability_slots = [] ​

The slots of the action bar that this seat takes over while the rider sits

bool clears_other_slots = false ​

All the other slots are emptied while the rider sits (the seat has the whole bar), instead of staying as the player has them

Variable descriptions ​

MountSession session ​

The ride this seat is in (set when a rider sits, empty otherwise)

Method descriptions ​

Dictionary get_field_descriptions() ​

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

String get_seat_type_name() ​

What this kind of seat is called in the editor list

String get_seat_type_description() ​

A sentence about what this kind of seat does, for the editor

Dictionary save_state() ​

What the seat keeps for a save (a game that is loaded while a rider sits puts it back before the rider sits down): the abilities it granted, and what your own seat adds. Override it (call super and merge) to keep a state of your own, and load_state to read it

void load_state( state: Dictionary ) ​

Reads what save_state gave. Called before on_enter when a game is loaded

bool can_enter( _rider: Entity ) ​

Can this entity sit here? Override to refuse (a seat only for a class, for someone with a key)

void on_enter( p_session: MountSession ) ​

A rider sat down. Override for your own setup and call super

void on_exit() ​

The rider got up. Override for your own cleanup and call super

void process( _input: Vector2, _delta: float ) ​

Every physics frame while the rider sits. input is the move keys (x right, y forward) of the player that controls the rider, zero when it does not. Override for a turret that follows the camera, a seat that drains a resource, and so on

Array[String] validate() ​

Problems with the settings of the seat (empty when it is fine), for the editor