gui¶
Source: api/tealdef/api/gui.d.tl
Contains all GUI functionality apart from react.
NinePatch¶
record global api/tealdef/api/gui.d.tl:6
global record NinePatch
Access: api.gui.NinePatch
Nine-patch image description.
Fields
Functions
new() : NinePatch api/tealdef/api/gui.d.tl:7
Call as api.gui.NinePatch.new(…)
Notes
Creates a new, empty NinePatch.
Returns NinePatch
StyleSheet¶
record global api/tealdef/api/gui.d.tl:20
global record StyleSheet
Access: api.gui.StyleSheet
Stylesheet used by GUI components.
Fields
| Name | Type | Description |
|---|---|---|
backgroundColor |
Vec4f |
Background colour (RGBA, components 0..1). |
backgroundColor1 |
Vec4f |
Colour of the first background layer; with backgroundImage1 it tints that image (base game pairs them, e.g. white for an untinted image). |
backgroundColor2 |
Vec4f |
Colour of the second background layer (pairs with backgroundImage2). |
backgroundImage1 |
NinePatch |
First background image layer, as a nine-patch. |
backgroundImage2 |
NinePatch |
Second background image layer, drawn in addition to the first (the base game uses it for overlays such as button glyphs and corner decorations). |
borderWidth |
Vec4f |
Border width in pixels, one value per side (CSS files write it as { 2, 2, 2, 2 }). |
borderColor |
Vec4f |
Colour of the border (RGBA, components 0..1). |
color |
Vec4f |
Foreground colour, used for text and to tint images (RGBA, components 0..1). |
size |
Vec2f |
Fixed size of the component in pixels (width, height). |
padding |
Vec4f |
Inner spacing in pixels, one value per side; the first value is the top. |
fontSize |
integer |
Font size in pixels. |
borderImage |
NinePatch |
Nine-patch image drawn as the border / contour of the component. |
anchorPoint |
Vec2f |
Point of the component that is placed at its position, as fractions of its size ({0.5, 0.5} = centre, {0, 0} = top-left corner). |
Functions
new() : StyleSheet api/tealdef/api/gui.d.tl:21
Call as api.gui.StyleSheet.new(…)
Notes
Creates a new, empty StyleSheet.
Returns StyleSheet
Gui¶
record global api/tealdef/api/gui.d.tl:45
global record Gui
Access: api.gui
Main GUI interface
Fields
| Name | Type | Description |
|---|---|---|
mouse |
Mouse |
Mouse input (Gui.Mouse). |
key |
Key |
Key input (Gui.Key). |
dnd |
DnD |
Drag and drop (Gui.DnD). |
inputAction |
InputAction |
Input actions / key bindings (Gui.InputAction). |
byId |
ById |
Access to GUI components by id or tag (Gui.ById). |
camera |
Camera |
Camera control (Gui.Camera). |
sound |
Sound |
Sound effects (Gui.Sound). |
musicPlayer |
MusicPlayer |
Music player (Gui.MusicPlayer). |
backend |
Backend |
Paradox account backend (Gui.Backend). |
voiceOverManager |
VoiceOverManager |
Voice-over playback (Gui.VoiceOverManager). |
byEntity |
ByEntity |
Visibility checks for entities (Gui.ByEntity). |
contextHelper |
ContextHelper |
Context help data (Gui.ContextHelper). |
construction |
Construction |
Construction-tool helpers (Gui.Construction). |
mission |
Mission |
Mission zones, markers and cutscenes (Gui.Mission). |
guide |
Guide |
Guide system (Gui.Guide). |
game |
Game |
Game-session helpers (Gui.Game). |
map |
Map |
Map and terrain editor (Gui.Map). |
benchMark |
BenchMark |
Timing data (Gui.BenchMark). |
rendering |
Rendering |
Rendering helpers (Gui.Rendering). |
debug |
Debug |
Debug helpers (Gui.Debug). |
achievements |
Achievements |
Achievements and player stats (Gui.Achievements). |
genericRep |
GenericRep |
GUI generic resources (Gui.GenericRep). used 606× in the base game |
StyleSheet |
StyleSheet |
The StyleSheet record, reached as api.gui.StyleSheet (use api.gui.StyleSheet.new()). |
NinePatch |
NinePatch |
The NinePatch record, reached as api.gui.NinePatch (use api.gui.NinePatch.new()). |
Functions
fireReactEvent(name : string, param : any) api/tealdef/api/gui.d.tl:49
Call as api.gui.fireReactEvent(…)
Fire a react event (same as react.fireEvent() but from outside of react)
| Parameter | Type | Description |
|---|---|---|
name |
string |
the event name |
param |
any |
the event parameter |
Used in the base game: 30 times in 19 files
base/content/game_mechanics/game_mechanics/celebrations/celebration_react_util.tl:118
base/content/game_mechanics/game_mechanics/celebrations/celebrations.script.tl:330
api.gui.fireReactEvent("celebration-add", { type = "ProductDeliveredToTown", entity = entityAndRev, value = v.counter, reputationEffect = v.reputationEffect })
base/content/game_mechanics/game_mechanics/notifications/notification_util.tl:451
base/content/game_mechanics/game_mechanics/notifications/types/line_station_warning.script.tl:145
base/content/game_mechanics/game_mechanics/notifications/types/line_warning.script.tl:199
base/content/game_mechanics/game_mechanics/notifications/types/town_warning.script.tl:44
… and 13 more files.
fireGuiScriptEvent(id : string, name : string, param : any) : any api/tealdef/api/gui.d.tl:57
Call as api.gui.fireGuiScriptEvent(…)
Fire a game gui script event. This event is meant to be handled by game scripts (guiHandleEvent), not by react.onEvent(). It differs from react.fireEvent in that it allows to return a value (like an error string to prevent the operation)
| Parameter | Type | Description |
|---|---|---|
id |
string |
the component id |
name |
string |
the event name |
param |
any |
event-specific parameters |
Returns any: the result from the event handler
Example
Used in the base game: 31 times in 13 files
base/content/gui/gui/construction/construction_react_util.tl:1531
base/content/gui/gui/construction/tools/marketing_campaign_tool.script.tl:83
base/content/gui/gui/entity_window/view_manager.tl:268
base/content/gui/gui/game_bar/game_bar_widgets.tl:449
base/content/gui/gui/layers/layer_terrain.tl:197
base/content/gui/gui/layers/layers_button_ridge.tl:332
… and 7 more files.
spawnEphemeralHudImage(iconPath : FilePath, entity : Engine.Entity, color? : Vec4f, position? : Vec3f, overrideDuration? : number, fadeIn? : boolean, fadeOut? : boolean, rev0? : integer) api/tealdef/api/gui.d.tl:89
Call as api.gui.spawnEphemeralHudImage(…)
Spawn a short-lived floating image as a hud-icon
| Parameter | Type | Description |
|---|---|---|
iconPath |
FilePath |
The icon to be used |
entity |
Engine.Entity |
Optional entity (if not used, you must specify position instead) |
color? |
Vec4f |
Optional color (if not used, the icon is expected to have color channels) |
position? |
Vec3f |
Optional position (if not used, position is obtained from the entity) |
overrideDuration? |
number |
Optional duration in seconds |
fadeIn? |
boolean |
Optional: Start invisible and fade in (default: false) |
fadeOut? |
boolean |
Optional: Slowly fade out at the end (default: true) |
rev0? |
integer |
Optional revision0 (if not used, defaults to api.engine.getRevision(entity).num[1]) |
Example
Used in the base game: 5 times in 4 files
base/content/gui/gui/hud/greenification_display.script.tl:151
api.gui.spawnEphemeralHudImage("::/gui/main/icons/symbol_emote_leaf_colored.tga", entity, nil, api.type.Vec3f.new(pos[1], pos[2], pos[3]), IconLifetime, true)
base/content/gui/gui/hud/happy_change_display.script.tl:85
base/content/gui/gui/hud/marketing_display.script.tl:158
base/content/gui/gui/line_vehicle_mgmt/vehicle_react_util.tl:405
spawnEphemeralHudImageOnPath(iconPath : FilePath, pos0 : Vec3f, pos1 : Vec3f, tan0 : Vec3f, tan1 : Vec3f, speed : number, scale : number, maxDistance : number) api/tealdef/api/gui.d.tl:100
Call as api.gui.spawnEphemeralHudImageOnPath(…)
Spawns a short icon that follows a path
| Parameter | Type | Description |
|---|---|---|
iconPath |
FilePath |
The icon to be used |
pos0 |
Vec3f |
The starting tangent of the icon |
pos1 |
Vec3f |
The end tangent of the icon |
tan0 |
Vec3f |
Start tangent of the path (the @param comments in the game file name it pos0 by mistake). |
tan1 |
Vec3f |
End tangent of the path. |
speed |
number |
The speed (in m/s) of the icon |
scale |
number |
A scaling factor for the size of the icon |
maxDistance |
number |
The maximal distance at which the icon will be rendered |
Example
closeAllWindows() api/tealdef/api/gui.d.tl:104
Call as api.gui.closeAllWindows(…)
Close all windows
Gui.HighlightStyle¶
record api/tealdef/api/gui.d.tl:59
record HighlightStyle
Notes
Shape of the highlight drawn around a GUI component by api.gui.byId.setHighlighted.
Example
Used in the base game: 1 time in 1 file
base/content/mission/mission/mission_sim.script.tl:1180
Fields
| Name | Type | Description |
|---|---|---|
Square |
HighlightStyle |
Square highlight around the component. used 1× in the base game |
Circle |
HighlightStyle |
Circular highlight (the default of setHighlighted). used 1× in the base game |
Mask |
HighlightStyle |
Highlight drawn as a mask of the component's shape. used 1× in the base game |
Gui.SpawnHudImageParams¶
record api/tealdef/api/gui.d.tl:66
record SpawnHudImageParams
Notes
Description of a floating HUD icon (icon path, optional tint colour, entity or position); the fields mirror the parameters of spawnEphemeralHudImage.
Fields
| Name | Type | Description |
|---|---|---|
iconPath |
FilePath |
Mandatory path to the icon |
color |
Vec4f |
Optional color. If set, the icon is expected to be grayscale. |
entity |
Engine.Entity |
Optional entity (if not used, specify position) |
position |
Vec3f |
Optional position (if not used, position of the entity is used) |
Gui.SelectionDetails¶
record userdata api/tealdef/api/gui.d.tl:107
record SelectionDetails
Access: api.gui.SelectionDetails
Carries details about selection event
Used in the base game: 18 times in 7 files
base/content/gui/gui/construction/construction_react_util.tl:1312
local onHoverCallback = function(entity : Engine.Entity, indices : {integer}, details : Gui.SelectionDetails)
base/content/gui/gui/construction/tools/marketing_campaign_tool.script.tl:34
onHover = function(__ : ConstructionCustomActionParams<string>, entity : Engine.Entity, __ : {integer}, __ : Gui.SelectionDetails) : SelectorBasedActionHoverRes
base/content/gui/gui/entity_window/double_slip_switch.tl:191
base/content/gui/gui/layers/layer_terrain.tl:184
onHover = function(entity : Engine.Entity, _indices : {integer}, _apiDetails : Gui.SelectionDetails)
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:382
line_util.convertDetails = function(entity : Engine.Entity, apiDetails : Gui.SelectionDetails) : LineUtil.SelectionDetails
base/content/gui/gui/main/selector_react_util.tl:101
… and 1 more files.
Fields
| Name | Type | Description |
|---|---|---|
data |
DataType |
variant: nil|Line|Station|Signal|Stop|Waypoint|TransportNetworkEdge|World|Marker|Town |
Functions
new() : SelectionDetails api/tealdef/api/gui.d.tl:109
Call as api.gui.SelectionDetails.new(…)
Notes
Creates a new, empty SelectionDetails.
Returns SelectionDetails
new(copy : SelectionDetails) : SelectionDetails api/tealdef/api/gui.d.tl:110
Call as api.gui.SelectionDetails.new(…)
Notes
Creates a new, empty SelectionDetails.
Returns SelectionDetails
Gui.SelectionDetails.Type¶
record api/tealdef/api/gui.d.tl:112
record Type
Access: api.gui.SelectionDetails.Type
Notes
Kind of object under the cursor / selected; the value of SelectionDetails.data.kind.
Details
Check data.kind first, then cast data to the matching Gui.SelectionDetails.* record.
Used in the base game: 9 times in 1 file
base/content/gui/gui/hud/hud_react_util.tl:36
Fields
| Name | Type | Description |
|---|---|---|
None |
Type |
Nothing specific selected (data carries no details). |
Line |
Type |
A line segment; data is a SelectionDetails.Line. used 2× in the base game |
Station |
Type |
A station group, station or terminal; data is a SelectionDetails.Station. used 8× in the base game |
Signal |
Type |
A signal; data is a SelectionDetails.Signal. used 1× in the base game |
Stop |
Type |
A stop of a line; data is a SelectionDetails.Stop. used 1× in the base game |
Waypoint |
Type |
A waypoint of a line; data is a SelectionDetails.Waypoint. used 1× in the base game |
TransportNetworkEdge |
Type |
A point on a transport-network edge (track, street, ...); data is a SelectionDetails.TransportNetworkEdge. used 1× in the base game |
World |
Type |
A position in the world (terrain or water); data is a SelectionDetails.World. used 2× in the base game |
Marker |
Type |
A mission marker; data is a SelectionDetails.Marker. used 2× in the base game |
Town |
Type |
A town or one of its districts; data is a SelectionDetails.Town. used 9× in the base game |
Gui.SelectionDetails.DataType¶
interface api/tealdef/api/gui.d.tl:125
interface DataType is userdata
Access: api.gui.SelectionDetails.DataType
Notes
Common base of all selection detail records; kind tells which one it is.
Example
-- in a builtin.Selector onSelect / onHover callback (gui/line_vehicle_mgmt/line_util.tl)
onSelect = function(entity, indices, apiDetails)
if apiDetails and apiDetails.data then
if apiDetails.data.kind == api.gui.SelectionDetails.Type.Station then
local st = apiDetails.data -- Gui.SelectionDetails.Station
print(st.stationGroup, st.stationTerminal.station, st.stationTerminal.terminal)
elseif apiDetails.data.kind == api.gui.SelectionDetails.Type.World then
local w = apiDetails.data -- Gui.SelectionDetails.World
print(w.pos.x, w.pos.y, w.pos.z, w.water)
end
end
return true
end
Fields
| Name | Type | Description |
|---|---|---|
kind |
Type |
Which kind of details this is; selects the record to cast data to. |
Gui.SelectionDetails.Line¶
record api/tealdef/api/gui.d.tl:131
record Line is DataType
Access: api.gui.SelectionDetails.Line
Carries details about selection event for a Line.
Used in the base game: 2 times in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:314
Fields
| Name | Type | Description |
|---|---|---|
line |
Engine.Entity |
The line entity |
stop |
integer |
Stop index where the selected line segment starts |
waypoint |
integer |
Waypoint index identifying the selected subsegment (-1: no waypoints, 0 = begins at stop, numWaypoints = ends at next stop) |
Gui.SelectionDetails.Station¶
record api/tealdef/api/gui.d.tl:141
record Station is DataType
Access: api.gui.SelectionDetails.Station
Carries details about selection event for a Station, StationGroup or Terminal
Used in the base game: 7 times in 4 files
base/content/gui/gui/layers/layer_public_transport.tl:106
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:323
local function convertStationDetails(apiDetails : Gui.SelectionDetails.Station) : LineUtil.StationSelectionDetails
base/content/gui/gui/main/hud_icon_toolbox.tl:218
base/content/gui/gui/statistics/statistics.tl:372
Fields
| Name | Type | Description |
|---|---|---|
stationGroup |
Engine.Entity |
The station group entity |
flatStationTerminalIndex |
integer |
Index in the the StationGroup's flattened list of station/terminals |
stationTerminal |
StationTerminal |
Station and terminal indices (zero-based) inside the station group; an index is -1 when only the group or station, not a terminal, is selected. |
Functions
new() : Station api/tealdef/api/gui.d.tl:142
Call as api.gui.SelectionDetails.Station.new(…)
Notes
Creates a new, empty Station.
Returns Station
Gui.SelectionDetails.Signal¶
record api/tealdef/api/gui.d.tl:153
record Signal is DataType
Access: api.gui.SelectionDetails.Signal
Carries details about selection event for a Signal
Used in the base game: 2 times in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:350
Fields
| Name | Type | Description |
|---|---|---|
signalList |
Engine.Entity |
The signalList entity |
signalIndex |
integer |
Index of the actual signal in the the SignalList |
Gui.SelectionDetails.Stop¶
record api/tealdef/api/gui.d.tl:161
record Stop is DataType
Access: api.gui.SelectionDetails.Stop
Carries details about selection event for a Stop (terminal) inside a line
Used in the base game: 2 times in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:357
Fields
| Name | Type | Description |
|---|---|---|
station |
SelectionDetails.Station |
The station / terminal |
line |
Engine.Entity |
The line entity |
stopIndex |
integer |
Index of the stop in the line |
Functions
new() : Stop api/tealdef/api/gui.d.tl:162
Call as api.gui.SelectionDetails.Stop.new(…)
Notes
Creates a new, empty Stop.
Returns Stop
Gui.SelectionDetails.Waypoint¶
record api/tealdef/api/gui.d.tl:173
record Waypoint is DataType
Access: api.gui.SelectionDetails.Waypoint
Carries details about selection event for a waypoint inside a line
Used in the base game: 2 times in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:366
Fields
| Name | Type | Description |
|---|---|---|
line |
Engine.Entity |
The line entity |
stopIndex |
integer |
Index of the stop in the line |
waypointIndex |
integer |
Index of the waypoint in the line (index in stop.waypoints) |
tag |
integer |
Tag of the waypoint; match it against tag of the entries in the line stop's waypoints to find the waypoint index (line_util.computeWaypointIndex0FromTag). |
Gui.SelectionDetails.TransportNetworkEdge¶
record api/tealdef/api/gui.d.tl:185
record TransportNetworkEdge is DataType
Access: api.gui.SelectionDetails.TransportNetworkEdge
Carries details about selection event for a Transport Network Edge
Used in the base game: 2 times in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:376
Fields
| Name | Type | Description |
|---|---|---|
snap |
EdgePos |
Position on the edge closest to the cursor (edge id and parameter along it). |
Functions
new() : TransportNetworkEdge api/tealdef/api/gui.d.tl:186
Call as api.gui.SelectionDetails.TransportNetworkEdge.new(…)
Notes
Creates a new, empty TransportNetworkEdge.
Returns TransportNetworkEdge
Gui.SelectionDetails.World¶
record api/tealdef/api/gui.d.tl:192
record World is DataType
Access: api.gui.SelectionDetails.World
Carries details about the cursor location in the world.
Used in the base game: 2 times in 2 files
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:397
base/content/gui/gui/main/selector_react_util.tl:111
Fields
| Name | Type | Description |
|---|---|---|
pos |
Vec3f |
Position in world coordinates. |
water |
boolean |
Whether the position is on water. |
Functions
new() : World api/tealdef/api/gui.d.tl:193
Call as api.gui.SelectionDetails.World.new(…)
Notes
Creates a new, empty World.
Returns World
Gui.SelectionDetails.Marker¶
record api/tealdef/api/gui.d.tl:200
record Marker is DataType
Access: api.gui.SelectionDetails.Marker
Carries details about selection event for a Marker.
Used in the base game: 3 times in 2 files
base/content/gui/gui/layers/layer_terrain.tl:200
react.fireEvent(param.toolParam.gameCtx.rendererComponent, "selectMarker", (apiDetails.data as Gui.SelectionDetails.Marker).marker)
base/content/gui/gui/main/selector_react_util.tl:119
Fields
| Name | Type | Description |
|---|---|---|
marker |
string |
Key of the marker (as given to api.gui.mission.setMarkerAtPosition / setMarkerAtEntity). |
fireSelectEntity |
boolean |
If true, select the underlying entity of the marker (default = true) |
pos |
Vec3f |
Get the marker position (if it is a position marker) |
entity |
Engine.Entity |
Get the marked entity (if it is an entity marker) |
Functions
new() : Marker api/tealdef/api/gui.d.tl:201
Call as api.gui.SelectionDetails.Marker.new(…)
Notes
Creates a new, empty Marker.
Returns Marker
Gui.SelectionDetails.Town¶
record api/tealdef/api/gui.d.tl:213
record Town is DataType
Access: api.gui.SelectionDetails.Town
Carries details about selection event for a Town.
Used in the base game: 5 times in 3 files
base/content/gui/gui/construction/constructionHudIconMaster.tl:145
base/content/gui/gui/layers/layer_cargo_flow.tl:69
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:399
Fields
| Name | Type | Description |
|---|---|---|
townEntity |
Engine.Entity |
Entity of the town. |
districtType |
LandUseType |
Land use type of the selected district; nil when the town as a whole is selected. |
districtCenter |
Vec3f |
Centre position of the selected district (world coordinates). |
Functions
new() : Town api/tealdef/api/gui.d.tl:214
Call as api.gui.SelectionDetails.Town.new(…)
Notes
Creates a new, empty Town.
Returns Town
Gui.WorldEvent¶
record api/tealdef/api/gui.d.tl:224
record WorldEvent
Notes
Parameter of the select-world GUI script event, fired when the player clicks a position in the world.
Example
Used in the base game: 1 time in 1 file
mods/release/urbangames_campaign_mission_05/content/mission/mission/tasks/drilling/send_vehicle.tl:210
Fields
| Name | Type | Description |
|---|---|---|
pos |
{number, number, number} |
Clicked position as {x, y, z} in world coordinates. |
water |
boolean |
Whether the clicked position is on water. |
Gui.Mouse¶
record api/tealdef/api/gui.d.tl:229
record Mouse
Access: api.gui.mouse
Notes
Mouse input, reached as api.gui.mouse.
Example
Functions
getTerrainPosition() : Vec3f api/tealdef/api/gui.d.tl:262
Call as api.gui.mouse.getTerrainPosition(…)
Gets the last valid terrain position pointed by the mouse.
Returns Vec3f: coordinates of the terrain position
hasTerrainPosition() : boolean api/tealdef/api/gui.d.tl:265
Call as api.gui.mouse.hasTerrainPosition(…)
Returns whether a valid terrain position is currently available.
Returns boolean: boolean true if the mouse is pointing at the terrain
Gui.Mouse.Event¶
record api/tealdef/api/gui.d.tl:231
record Event
Represents a mouse event
Used in the base game: 32 times in 21 files
base/content/game_mechanics/game_mechanics/celebrations/celebration_react_util.tl:80
base/content/game_mechanics/game_mechanics/finance/finances_react_util.tl:102
base/content/game_mechanics/game_mechanics/notifications/gui/notification_log.tl:125
base/content/game_mechanics/game_mechanics/notifications/gui/notification_popups.tl:116
base/content/gui/gui/construction/construction.tl:2896
base/content/gui/gui/line_vehicle_mgmt/cargofilter_window.tl:130
… and 15 more files.
Fields
| Name | Type | Description |
|---|---|---|
type |
Type |
Event type. |
button |
integer |
Mouse button: 0 = left, 1 = middle, 2 = right. |
x |
integer |
Horizontal position of the mouse when event was triggered |
y |
integer |
Vertical position of the mouse when event was triggered |
xrel |
integer |
Relative horizontal movement. |
yrel |
integer |
Relative vertical movement. |
handled |
boolean |
Whether the event was already handled by a child component. |
Gui.Mouse.Event.Type¶
record api/tealdef/api/gui.d.tl:232
record Type
Notes
Kind of mouse event (Gui.Mouse.Event.type).
Fields
| Name | Type | Description |
|---|---|---|
Pressed |
Type |
A mouse button was pressed over the component. used 14× in the base game |
Released |
Type |
A mouse button was released. used 15× in the base game |
Clicked |
Type |
A mouse button was clicked (pressed and released) on the component. used 6× in the base game |
Entered |
Type |
The cursor entered the component (base game uses it for hover states). used 11× in the base game |
Exited |
Type |
The cursor left the component. used 8× in the base game |
Moved |
Type |
The cursor moved over the component. used 1× in the base game |
Wheel |
Type |
The mouse wheel was turned. used 1× in the base game |
DoubleClicked |
Type |
A mouse button was double-clicked. |
PressedOutside |
Type |
A mouse button was pressed outside the component; used to close popups and dialogs. used 6× in the base game |
Gui.Key¶
record api/tealdef/api/gui.d.tl:268
record Key
Access: api.gui.key
Notes
Keyboard / gamepad key input, reached as api.gui.key.
Gui.Key.State¶
record api/tealdef/api/gui.d.tl:269
record State
Notes
Direction of a key event (InputEvent.dir).
Fields
| Name | Type | Description |
|---|---|---|
Up |
State |
The key was released. used 1× in the base game |
Pressed |
State |
The key was pressed. used 1× in the base game |
Gui.Key.InputEvent¶
record api/tealdef/api/gui.d.tl:274
record InputEvent
Notes
Raw input event data of a key event.
Fields
| Name | Type | Description |
|---|---|---|
dir |
State |
Whether the key was pressed or released. |
repeated |
boolean |
Whether the event is an automatic key repeat. |
Functions
isGamepadEvent(InputEvent) : boolean api/tealdef/api/gui.d.tl:278
Returns whether this is a gamepad event.
Returns boolean
isKeyboardEvent(InputEvent) : boolean api/tealdef/api/gui.d.tl:280
Returns whether this is a keyboard event.
Returns boolean
Gui.Key.Event¶
record api/tealdef/api/gui.d.tl:288
record Event
Represents a key press event.
Used in the base game: 1 time in 1 file
base/content/gui/gui/menu/settings_page.tl:271
Fields
| Name | Type | Description |
|---|---|---|
data |
InputEvent |
Input data of the key event (direction, key code, modifiers). |
Functions
isPressed(Event) : boolean api/tealdef/api/gui.d.tl:291
Returns whether the key is pressed.
Returns boolean
Gui.DataTransferItem¶
record api/tealdef/api/gui.d.tl:295
record DataTransferItem
Access: api.gui.DataTransferItem
Notes
One item carried by a drag and drop operation, a type resource name plus serializable data.
Example
Used in the base game: 4 times in 2 files
base/content/gui/gui/line_vehicle_mgmt/line_manager_panel.tl:502
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:2946
Fields
| Name | Type | Description |
|---|---|---|
type |
ResName |
Resource name that identifies the kind of item; drop targets filter on it. |
data |
any |
type-specific data. Note that this needs to be serializable. |
Functions
new(ResName, any) : DataTransferItem api/tealdef/api/gui.d.tl:296
Call as api.gui.DataTransferItem.new(…)
Notes
Creates a transfer item.
| Parameter | Type | Description |
|---|---|---|
#1 |
ResName |
Resource name that identifies the item type, e.g. "::/gui/line_vehicle_mgmt/dnd_line_stop.res" (a .res.lua file with type = "drag_and_drop"). |
#2 |
any |
Payload; must be serializable (plain tables, numbers, strings). |
Returns DataTransferItem: The new item.
Gui.DnD¶
record api/tealdef/api/gui.d.tl:303
record DnD
Access: api.gui.dnd
Notes
Drag and drop, reached as api.gui.dnd.
Details
React code normally does not call it directly but registers handlers with
react.onDragAndDrop{ grab = ..., filter = ..., drop = ... }; the base game's
gui/main/react.lua translates the api.gui.dnd events into those callbacks.
Example
Functions
setCursor(cursor : integer) api/tealdef/api/gui.d.tl:319
Call as api.gui.dnd.setCursor(…)
Set cursor while dragging (will get reset when a new drag starts).
| Parameter | Type | Description |
|---|---|---|
cursor |
integer |
the cursor id |
addTransferData(dragStartEvent : Event, item : DataTransferItem) api/tealdef/api/gui.d.tl:324
Call as api.gui.dnd.addTransferData(…)
Add transfer data to the current drag & drop operation.
| Parameter | Type | Description |
|---|---|---|
dragStartEvent |
Event |
drag start event (must be Event.Type.DragStarted) |
item |
DataTransferItem |
transferable item |
getAllTransferData() : {DataTransferItem} api/tealdef/api/gui.d.tl:328
Call as api.gui.dnd.getAllTransferData(…)
Get current drag & drop data.
Returns {DataTransferItem}: current transfer data list
Gui.DnD.Event¶
record api/tealdef/api/gui.d.tl:305
record Event
Represents drag & drop event
Fields
| Name | Type | Description |
|---|---|---|
type |
Type |
Event type. |
Gui.DnD.Event.Type¶
record api/tealdef/api/gui.d.tl:306
record Type
Notes
Kind of drag and drop event.
Fields
| Name | Type | Description |
|---|---|---|
Drop |
Type |
Items were dropped on the component. used 1× in the base game |
DragStarted |
Type |
A drag starts on the component; add the dragged items with addTransferData. used 1× in the base game |
DragEntered |
Type |
A drag entered the component. used 1× in the base game |
DragExited |
Type |
A drag left the component. used 1× in the base game |
Gui.InputAction¶
record api/tealdef/api/gui.d.tl:331
record InputAction
Access: api.gui.inputAction
Notes
Input actions (key bindings such as IA_OPTION2), reached as api.gui.inputAction.
Functions
modifierOnlyActionIsActive(inputActionId : string) : boolean api/tealdef/api/gui.d.tl:358
Call as api.gui.inputAction.modifierOnlyActionIsActive(…)
Checks if a modifier-only action is currently active.
| Parameter | Type | Description |
|---|---|---|
inputActionId |
string |
the input action identifier |
Returns boolean: True if active.
Used in the base game: 5 times in 2 files
base/content/gui/gui/construction/construction_react_util.tl:1916
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:537
resetModifierOnlyActionStates() api/tealdef/api/gui.d.tl:360
Call as api.gui.inputAction.resetModifierOnlyActionStates(…)
Resets all modifier-only action states to false
hasConflicts(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef) : string api/tealdef/api/gui.d.tl:366
Call as api.gui.inputAction.hasConflicts(…)
Checks for key binding conflicts.
| Parameter | Type | Description |
|---|---|---|
keyCmdDefinitions |
{string : {KeyComboDef}} |
Key command definitions. |
inputActionId |
string |
Input action id. |
keyComboDef |
KeyComboDef |
Key combo definition. |
Returns string: Conflict description (empty if no conflict).
findDuplicatesOf(inputActionId : string) : {string} api/tealdef/api/gui.d.tl:370
Call as api.gui.inputAction.findDuplicatesOf(…)
Recursively find list of all IAs that should are duplicates of this one (i.e. duplicateOf == inputActionId and duplicatedKeybindings == true)
| Parameter | Type | Description |
|---|---|---|
inputActionId |
string |
Input action id. |
Returns {string}: Duplications of the IA
getFixedKeyCmdDefs(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef) : {string : {KeyComboDef}} api/tealdef/api/gui.d.tl:376
Call as api.gui.inputAction.getFixedKeyCmdDefs(…)
Resolves key binding conflicts and returns updated key command definitions.
| Parameter | Type | Description |
|---|---|---|
keyCmdDefinitions |
{string : {KeyComboDef}} |
Key command definitions. |
inputActionId |
string |
Input action id. |
keyComboDef |
KeyComboDef |
Key combo definition. |
Returns {string : {KeyComboDef}}: Fixed key command definitions or empty table if change not allowed.
Gui.InputAction.InputActionState¶
record api/tealdef/api/gui.d.tl:332
record InputActionState
Notes
Enabled state of an input action, returned by the isEnabled callback of react.iaHandler.
Example
Used in the base game: 7 times in 5 files
base/content/game_mechanics/game_mechanics/company/company.tl:803
base/content/gui/gui/construction/construction.tl:2417
base/content/gui/gui/main/collapsible_checkbox_list.tl:150
base/content/gui/gui/main/game.tl:243
base/content/gui/gui/main/menu_category_util.tl:79
Fields
| Name | Type | Description |
|---|---|---|
Disabled |
InputActionState |
disabled, action will not be triggered and no hints or prompts are shown, leaving the keys for other actions used 7× in the base game |
Inactive |
InputActionState |
action will not be triggered, but hints and button prompts are generated used 1× in the base game |
Enabled |
InputActionState |
fully enabled, hints and prompts shown (except if disabled/invisible due to hierarchy) used 9× in the base game |
Gui.InputAction.InvokeData¶
record userdata api/tealdef/api/gui.d.tl:339
record InvokeData
Additional info about the invocation of an input action event
Used in the base game: 9 times in 7 files
base/content/game_mechanics/game_mechanics/finance/finances_charts.tl:81
react.useInputAction("IA_OPTION2", react.iaHandlerExtended(function(data : Gui.InputAction.InvokeData)
base/content/gui/gui/entity_window/town/town_eow.script.tl:170
react.useInputAction("IA_OPTION2", react.iaHandlerExtended(function(data : Gui.InputAction.InvokeData)
base/content/gui/gui/line_vehicle_mgmt/line_manager_panel.tl:553
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:877
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:544
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:1306
… and 1 more files.
Fields
| Name | Type | Description |
|---|---|---|
status |
Status |
status of the action. |
Gui.InputAction.InvokeData.Status¶
record api/tealdef/api/gui.d.tl:343
record Status
Status type of the InputActionInvokeData
Fields
| Name | Type | Description |
|---|---|---|
Triggered |
Status |
Start event: when an event key combo first is fully pressed, or when axis values change used 8× in the base game |
Repeat |
Status |
When the system reports a repeated key press for this action used 3× in the base game |
PressedStep |
Status |
Invoked every game step, as long as the active is active = pressed used 1× in the base game |
EndReleased |
Status |
"Good" end event: due to a key/button release there no longer is a action combo active used 8× in the base game |
EndAborted |
Status |
Component/action became disabled, or another action with higher priority has started used 8× in the base game |
Gui.ById¶
record api/tealdef/api/gui.d.tl:379
record ById
Access: api.gui.byId
Notes
Functions that address GUI components by id or tag, reached as api.gui.byId.
Example
Functions
setVisibilityByClass(idOrTag : string, visible : boolean, idOnly? : boolean) api/tealdef/api/gui.d.tl:384
Call as api.gui.byId.setVisibilityByClass(…)
Shows or hides a component.
visible: nil removes visibility override
| Parameter | Type | Description |
|---|---|---|
idOrTag |
string |
the component identifier or a tag |
visible |
boolean |
whether visible or not (nil to reset the rule |
idOnly? |
boolean |
idOnly -> do not consider tags |
setEnabled(idOrTag : string, enabled : boolean, idOnly? : boolean) api/tealdef/api/gui.d.tl:389
Call as api.gui.byId.setEnabled(…)
Enables or disables a component.
enable: nil re-enables it (and removes the rule)
| Parameter | Type | Description |
|---|---|---|
idOrTag |
string |
the component identifier or a tag |
enabled |
boolean |
whether enabled or not (nil sets to enabled and removes the rule) |
idOnly? |
boolean |
idOnly -> do not consider tags |
setHighlighted(idOrTag : string, highlighted? : boolean, style? : HighlightStyle, color? : Vec3f, idOnly? : boolean) api/tealdef/api/gui.d.tl:396
Call as api.gui.byId.setHighlighted(…)
Sets the highlighted state of a component.
| Parameter | Type | Description |
|---|---|---|
idOrTag |
string |
the component identifier or a tag |
highlighted? |
boolean |
whether highlighted or not (nil sets to not highlighted and removes the rule) |
style? |
HighlightStyle |
defaults to HighlightStyle::Circle |
color? |
Vec3f |
the color of the highlight, defaults to yellow |
idOnly? |
boolean |
idOnly -> do not consider tags |
isVisible(id : string) : boolean api/tealdef/api/gui.d.tl:407
Call as api.gui.byId.isVisible(…)
Checks if a UI component is visible by its id.
| Parameter | Type | Description |
|---|---|---|
id |
string |
the component identifier |
Returns boolean: true if the component is visible
isVisibleRecursive(id : string) : boolean api/tealdef/api/gui.d.tl:411
Call as api.gui.byId.isVisibleRecursive(…)
Checks if a UI component and all its parents are visible by id.
| Parameter | Type | Description |
|---|---|---|
id |
string |
the component identifier |
Returns boolean: true if the component and all parents are visible
Used in the base game: 6 times in 5 files
base/content/gui/gui/game_bar/game_bar_widgets.tl:139
base/content/mission/mission/guide_system/guide_system_react.tl:68
base/content/mission/mission/guide_system/main/guide_system_story.tl:59
base/content/mission/mission/mission_framework/mission_framework_react.tl:947
base/content/mission/mission/tasks/guide/guide_collect_entity.tl:43
setVisible(id : string, visible : boolean) api/tealdef/api/gui.d.tl:415
Call as api.gui.byId.setVisible(…)
Sets the visibility of a UI component by its ID.
| Parameter | Type | Description |
|---|---|---|
id |
string |
the component identifier |
visible |
boolean |
if the component should be visible |
Used in the base game: 26 times in 8 files
base/content/gui/gui/construction/construction.tl:1700
base/content/gui/gui/entity_window/view_manager.tl:335
base/content/gui/gui/game_bar/game_bar.tl:616
base/content/gui/gui/game_bar/game_bar_widgets.tl:116
base/content/gui/gui/layers/layers_button_ridge.tl:126
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:8309
… and 2 more files.
resetMovedWindowPosition(id : string) api/tealdef/api/gui.d.tl:419
Call as api.gui.byId.resetMovedWindowPosition(…)
Resets a window to its original position if it was moved by the user.
| Parameter | Type | Description |
|---|---|---|
id |
string |
string id the window identifier |
getSize(id : string) : Vec2f api/tealdef/api/gui.d.tl:423
Call as api.gui.byId.getSize(…)
Get width and height of UI component
| Parameter | Type | Description |
|---|---|---|
id |
string |
string id the window identifier |
Returns Vec2f: width and height
Gui.Camera¶
record api/tealdef/api/gui.d.tl:426
record Camera
Access: api.gui.camera
Notes
Camera control, reached as api.gui.camera.
Example
Functions
setManualCamera(center : Vec2f, distance : number) api/tealdef/api/gui.d.tl:430
Call as api.gui.camera.setManualCamera(…)
Sets camera to a given position/orientation.
| Parameter | Type | Description |
|---|---|---|
center |
Vec2f |
position on the map where the camera should point to |
distance |
number |
the distance from the position |
getCameraData() : Vec5f api/tealdef/api/gui.d.tl:434
Call as api.gui.camera.getCameraData(…)
Obtains the current camera data.
Returns Vec5f: the current camera data as a Vec5f {center.x, center.y, distance, angle, pitch}
Used in the base game: 9 times in 9 files
base/content/mission/mission/tutorial/tasks/camera_movement.tl:120
mods/release/urbangames_campaign_mission_01/content/mission/mission/tasks/everything/everything.tl:8
mods/release/urbangames_campaign_mission_02/content/mission/mission/tasks/everything/everything.tl:9
mods/release/urbangames_campaign_mission_03/content/mission/mission/tasks/everything/everything.tl:10
mods/release/urbangames_campaign_mission_04/content/mission/mission/tasks/everything/everything.tl:16
mods/release/urbangames_campaign_mission_05/content/mission/mission/tasks/everything/everything.tl:9
… and 3 more files.
setCameraData(Vec5f) api/tealdef/api/gui.d.tl:438
Call as api.gui.camera.setCameraData(…)
Set the camera data.
| Parameter | Type | Description |
|---|---|---|
#1 (Vec5f) |
Vec5f |
set the camera data as a Vec5f |
Used in the base game: 4 times in 4 files
mods/release/urbangames_campaign_mission_01/content/mission/mission/tasks/everything/everything.tl:85
mods/release/urbangames_campaign_mission_02/content/mission/mission/tasks/everything/everything.tl:77
mods/release/urbangames_campaign_mission_03/content/mission/mission/tasks/everything/everything.tl:75
mods/release/urbangames_campaign_mission_05/content/mission/mission/tasks/everything/everything.tl:75
getHeightAboveTerrain() : number api/tealdef/api/gui.d.tl:442
Call as api.gui.camera.getHeightAboveTerrain(…)
Obtains the current height above terrain.
Returns number: the height of the camera above the terrain
focusEntity(entity : Engine.Entity) api/tealdef/api/gui.d.tl:446
Call as api.gui.camera.focusEntity(…)
Focuses the camera on an entity.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
the id of the entity that should be focused on |
Used in the base game: 14 times in 13 files
base/content/game_mechanics/game_mechanics/celebrations/celebration_react_util.tl:116
base/content/game_mechanics/game_mechanics/notifications/notification_util.tl:450
base/content/game_mechanics/game_mechanics/notifications/types/line_station_warning.script.tl:144
base/content/game_mechanics/game_mechanics/notifications/types/line_warning.script.tl:196
base/content/game_mechanics/game_mechanics/notifications/types/subvention.script.tl:70
base/content/game_mechanics/game_mechanics/notifications/types/subvention_notification.script.tl:93
… and 7 more files.
focusPosition(position : Vec3f, distance : number) api/tealdef/api/gui.d.tl:451
Call as api.gui.camera.focusPosition(…)
Focuses the camera on a position.
| Parameter | Type | Description |
|---|---|---|
position |
Vec3f |
the position that should be focused |
distance |
number |
the distance of the camera from the target |
Used in the base game: 5 times in 3 files
base/content/game_mechanics/game_mechanics/notifications/types/line_warning.script.tl:194
api.gui.camera.focusPosition(api.type.Vec3f.new(locationOverride[1], locationOverride[2], locationOverride[3]), 15)
base/content/gui/gui/line_vehicle_mgmt/line_manager_panel.tl:1113
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:224
takeScreenshot(scale : integer) api/tealdef/api/gui.d.tl:455
Call as api.gui.camera.takeScreenshot(…)
Takes a screenshot and stores it in userdata folder
| Parameter | Type | Description |
|---|---|---|
scale |
integer |
image resolution |
getFollowEntity() : {Engine.Entity, Engine.Revision} api/tealdef/api/gui.d.tl:459
Call as api.gui.camera.getFollowEntity(…)
Gets the entity currently being followed.
Returns {Engine.Entity, Engine.Revision}: the entity being followed (and the entity revision)
followEntity(entity : Engine.Entity, jump : boolean) api/tealdef/api/gui.d.tl:464
Call as api.gui.camera.followEntity(…)
Sets camera to follow an Entity.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
the id of the entity that should be followed |
jump |
boolean |
true if the camera should directly jump to the entity and not slide there |
Used in the base game: 13 times in 4 files
base/content/gui/gui/entity_window/view_manager.tl:269
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:222
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:1402
base/content/gui/gui/line_vehicle_mgmt/vehicle_list_react_util.tl:115
enterFollowCameraCockpit(entity : Engine.Entity) api/tealdef/api/gui.d.tl:468
Call as api.gui.camera.enterFollowCameraCockpit(…)
Enters the cockpit of an entity.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
entity of the object to enter |
leaveFollowCameraCockpit() api/tealdef/api/gui.d.tl:471
Call as api.gui.camera.leaveFollowCameraCockpit(…)
Leave the cockpit of an entity.
isFreeCameraMouseAttached() : boolean api/tealdef/api/gui.d.tl:475
Call as api.gui.camera.isFreeCameraMouseAttached(…)
Tells if mouse is attached to free cam or not
Returns boolean: if mouse is attached (true) or not (false)
toggleFreeCameraMouseAttachment() api/tealdef/api/gui.d.tl:478
Call as api.gui.camera.toggleFreeCameraMouseAttachment(…)
Toggles mouse attachment
toggleFreeCamera() api/tealdef/api/gui.d.tl:481
Call as api.gui.camera.toggleFreeCamera(…)
Toggles free camera
world2Screen(Vec3f) : Vec2i api/tealdef/api/gui.d.tl:484
Call as api.gui.camera.world2Screen(…)
Convert a 3D World position into a position on screen (in pixels)
Returns Vec2i
screen2World(Vec3f) : Vec3f api/tealdef/api/gui.d.tl:487
Call as api.gui.camera.screen2World(…)
Convert a position on the screen (in pixels) (with depth [0, 1]) into a 3D World position
Returns Vec3f
getEye() : Vec3f api/tealdef/api/gui.d.tl:490
Call as api.gui.camera.getEye(…)
Get camera origin in world coordinates
Returns Vec3f
getCenter() : Vec3f api/tealdef/api/gui.d.tl:493
Call as api.gui.camera.getCenter(…)
Get camera center ("look-at" pos) in world coordinates
Returns Vec3f
getNearFar() : Vec2f api/tealdef/api/gui.d.tl:496
Call as api.gui.camera.getNearFar(…)
Get near and far distances of camera in x and y coordinates repsectively
Returns Vec2f
getSize() : Vec2i api/tealdef/api/gui.d.tl:499
Call as api.gui.camera.getSize(…)
Width and height of the viewport, in pixels
Returns Vec2i
traceToTerrain(worldPos : Vec3f, farPos : Vec3f, zOffset : number, numSteps : integer) : Vec3f | nil api/tealdef/api/gui.d.tl:506
Call as api.gui.camera.traceToTerrain(…)
Trace a ray from worldPos to farPos, and find the intersection (if any) with the terrain, offsetted at zOffset
| Parameter | Type | Description |
|---|---|---|
worldPos |
Vec3f |
world position of starting point of ray |
farPos |
Vec3f |
world position of end point of ray |
zOffset |
number |
offset to shift the terrain for intersection |
numSteps |
integer |
number of steps to perform for finding an intersection. more steps are more precise but cost more, 30 is a good compromise |
Returns Vec3f | nil
Gui.Sound¶
record api/tealdef/api/gui.d.tl:509
record Sound
Access: api.gui.sound
Notes
Sound effects, reached as api.gui.sound.
Functions
letVehicleHorn(vehicleEntity : Engine.Entity) api/tealdef/api/gui.d.tl:512
Call as api.gui.sound.letVehicleHorn(…)
Sounds the vehicle horn.
| Parameter | Type | Description |
|---|---|---|
vehicleEntity |
Engine.Entity |
the vehicle to sound the horn |
playRandomSoundEffect(paths : {FilePath}) api/tealdef/api/gui.d.tl:516
Call as api.gui.sound.playRandomSoundEffect(…)
Plays a single sound effect randomly selected of the provided selection.
| Parameter | Type | Description |
|---|---|---|
paths |
{FilePath} |
vector of strings paths of sound effects |
Used in the base game: 42 times in 15 files
base/content/game_mechanics/game_mechanics/celebrations/celebration_react_util.tl:213
base/content/game_mechanics/game_mechanics/company/company.tl:71
base/content/game_mechanics/game_mechanics/company/explorations/exploration_plane.script.tl:296
base/content/game_mechanics/game_mechanics/notifications/gui/notification_popups.tl:102
base/content/gui/gui/entity_window/view_manager.tl:251
base/content/gui/gui/hud/greenification_display.script.tl:137
… and 9 more files.
Gui.MusicPlayer¶
record api/tealdef/api/gui.d.tl:519
record MusicPlayer
Access: api.gui.musicPlayer
Notes
Music playback, reached as api.gui.musicPlayer.
Functions
goBack() api/tealdef/api/gui.d.tl:521
Call as api.gui.musicPlayer.goBack(…)
Goes back to the previous track in the music player.
goForward() api/tealdef/api/gui.d.tl:524
Call as api.gui.musicPlayer.goForward(…)
Goes forward to the next track in the music player.
togglePause() api/tealdef/api/gui.d.tl:527
Call as api.gui.musicPlayer.togglePause(…)
Toggles pause/play state of the music player.
getTitle() : string api/tealdef/api/gui.d.tl:531
Call as api.gui.musicPlayer.getTitle(…)
Gets the title of the currently playing track.
Returns string: the track title
getArtist() : string api/tealdef/api/gui.d.tl:535
Call as api.gui.musicPlayer.getArtist(…)
Gets the artist of the currently playing track.
Returns string: the track artist
hasPlaylist() : boolean api/tealdef/api/gui.d.tl:539
Call as api.gui.musicPlayer.hasPlaylist(…)
Checks if the music player has tracks loaded.
Returns boolean: true if the music player has tracks
getPlaylistIndex() : integer api/tealdef/api/gui.d.tl:543
Call as api.gui.musicPlayer.getPlaylistIndex(…)
Gets the current track index (1-based).
Returns integer: the current track index
setTrackListFromPlayList(playlist : string, startPaused : boolean, offset? : number) api/tealdef/api/gui.d.tl:550
Call as api.gui.musicPlayer.setTrackListFromPlayList(…)
Sets the current playlist.
The current track will only start after the current track ends. To trigger the new playlist immediately, call goForward() right after this call.
| Parameter | Type | Description |
|---|---|---|
playlist |
string |
the playlist resource name |
startPaused |
boolean |
if set, does not play the playlist, just prepares it |
offset? |
number |
playback offset in seconds (optional) |
setPlaylist(playlist : string) api/tealdef/api/gui.d.tl:555
Call as api.gui.musicPlayer.setPlaylist(…)
Sets the current playlist. Only available while in-game.
The current track will only start after the current track ends. To trigger the new playlist immediately, call goForward() right after this call.
| Parameter | Type | Description |
|---|---|---|
playlist |
string |
the playlist resource name |
getPlaylist() : string api/tealdef/api/gui.d.tl:559
Call as api.gui.musicPlayer.getPlaylist(…)
Gets the current playlist. Only available while in-game.
Returns string: the resource name of the current playlist
isPlaying() : boolean api/tealdef/api/gui.d.tl:563
Call as api.gui.musicPlayer.isPlaying(…)
Checks if the music player is currently playing.
Returns boolean: true if music is playing
playTrack(trackName : string, offset? : number) api/tealdef/api/gui.d.tl:568
Call as api.gui.musicPlayer.playTrack(…)
Plays a track by name.
| Parameter | Type | Description |
|---|---|---|
trackName |
string |
the name of the track to play |
offset? |
number |
playback offset in seconds (optional) |
playTrackFile(filePath : string, offset? : number) api/tealdef/api/gui.d.tl:573
Call as api.gui.musicPlayer.playTrackFile(…)
Plays a specific file that might not be part of the current track list
| Parameter | Type | Description |
|---|---|---|
filePath |
string |
the path to the track file |
offset? |
number |
playback offset in seconds (optional) |
getTrackLength() : number api/tealdef/api/gui.d.tl:577
Call as api.gui.musicPlayer.getTrackLength(…)
Gets the length (duration) of the current track
Returns number: the track duration in second
getTrackElapsedTime() : number api/tealdef/api/gui.d.tl:581
Call as api.gui.musicPlayer.getTrackElapsedTime(…)
Gets the time of the current track
Returns number: the current time of the current track
getGain() : number api/tealdef/api/gui.d.tl:585
Call as api.gui.musicPlayer.getGain(…)
Gets the current gain (volume) of the music player.
Returns number: the gain value
setGain(gain : number) api/tealdef/api/gui.d.tl:589
Call as api.gui.musicPlayer.setGain(…)
Sets the gain (volume) of the music player.
| Parameter | Type | Description |
|---|---|---|
gain |
number |
the gain value |
setTrackList(trackList : {{string, string, boolean}}, enableRepeat : boolean) api/tealdef/api/gui.d.tl:594
Call as api.gui.musicPlayer.setTrackList(…)
Sets the track list for the music player, replaces the current track list.
| Parameter | Type | Description |
|---|---|---|
trackList |
{{string, string, boolean}} |
array of tuples containing track name, file path, and repeat flag |
enableRepeat |
boolean |
true to enable repeat for the entire list |
Used in the base game: 3 times in 3 files
base/content/gui/gui/menu/mission_page_content.tl:436
base/content/mission/mission/mission_framework/mission_end_window_util.tl:357
base/content/mission/mission/mission_sim.script.tl:1231
addTrackList(trackList : {{string, string, boolean}}, enableRepeat : boolean) api/tealdef/api/gui.d.tl:600
Call as api.gui.musicPlayer.addTrackList(…)
Adds a track list to the music player. This doesn't replace the existing tracks and once the added tracks are finish, the track previously playing will resume
| Parameter | Type | Description |
|---|---|---|
trackList |
{{string, string, boolean}} |
array of tuples containing track name, file path, and repeat flag |
enableRepeat |
boolean |
true to enable repeat for the entire list |
setContextTag(contextTag : string) api/tealdef/api/gui.d.tl:605
Call as api.gui.musicPlayer.setContextTag(…)
Sets the context tag for the music player. The context tag can be used to change the variant of a playing track.
| Parameter | Type | Description |
|---|---|---|
contextTag |
string |
the context tag to set |
Gui.VoiceOverManager¶
record api/tealdef/api/gui.d.tl:608
record VoiceOverManager
Access: api.gui.voiceOverManager
Notes
Voice-over playback, reached as api.gui.voiceOverManager.
Functions
stop() api/tealdef/api/gui.d.tl:610
Call as api.gui.voiceOverManager.stop(…)
Stops the current voice over playing
play(voiceOverRes : string, delayInSeconds? : number) api/tealdef/api/gui.d.tl:615
Call as api.gui.voiceOverManager.play(…)
Plays a new voice over
| Parameter | Type | Description |
|---|---|---|
voiceOverRes |
string |
the file path to the voice over to play |
delayInSeconds? |
number |
delay before the voice over starts |
isPlaying(voiceOverRes : string) : boolean api/tealdef/api/gui.d.tl:620
Call as api.gui.voiceOverManager.isPlaying(…)
Checks whether a specific voice over is playing
| Parameter | Type | Description |
|---|---|---|
voiceOverRes |
string |
the voice over file to check |
Returns boolean: true if the voice over file is playing
isPlayingAny() : boolean api/tealdef/api/gui.d.tl:624
Call as api.gui.voiceOverManager.isPlayingAny(…)
Checks whether any voice over is current playing
Returns boolean: true if any voice over is playing
Used in the base game: 6 times in 2 files
base/content/mission/mission/mission_react_util.tl:461
base/content/mission/mission/tasks/guide/guide_collect_entity.tl:43
getPlaying() : ResName api/tealdef/api/gui.d.tl:628
Call as api.gui.voiceOverManager.getPlaying(…)
Checks whether any voice over is current playing and returns the file path if one is playing
Returns ResName: file path if any voice over is playing
Gui.ByEntity¶
record api/tealdef/api/gui.d.tl:631
record ByEntity
Access: api.gui.byEntity
Notes
Visibility checks for game entities, reached as api.gui.byEntity.
Functions
isLineEmptyOrVisible(Engine.Entity) : boolean api/tealdef/api/gui.d.tl:635
Call as api.gui.byEntity.isLineEmptyOrVisible(…)
Checks if line is empty or visible
| Parameter | Type | Description |
|---|---|---|
#1 (Engine.Entity) |
Engine.Entity |
the line entity to check |
Returns boolean: true if the line is empty or visible
Used in the base game: 6 times in 2 files
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:155
base/content/gui/gui/statistics/statistic_lines.tl:313
isVisible(Engine.Entity) : boolean api/tealdef/api/gui.d.tl:640
Call as api.gui.byEntity.isVisible(…)
Checks if an entity is visible
| Parameter | Type | Description |
|---|---|---|
#1 (Engine.Entity) |
Engine.Entity |
the entity to check |
Returns boolean: true if the entity is visible
Used in the base game: 10 times in 6 files
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:1677
base/content/gui/gui/statistics/statistic_depots.tl:234
base/content/gui/gui/statistics/statistic_industries.tl:446
base/content/gui/gui/statistics/statistic_stations.tl:338
base/content/gui/gui/statistics/statistic_towns.tl:544
base/content/gui/gui/statistics/statistic_warehouses.tl:367
isVehicleVisible(Engine.Entity) : boolean api/tealdef/api/gui.d.tl:645
Call as api.gui.byEntity.isVehicleVisible(…)
Checks if vehicle is visible
| Parameter | Type | Description |
|---|---|---|
#1 (Engine.Entity) |
Engine.Entity |
the vehicle entity to check |
Returns boolean: true if the vehicle is visible
Gui.ContextHelper¶
record api/tealdef/api/gui.d.tl:648
record ContextHelper
Access: api.gui.contextHelper
Notes
Data for the context help window, reached as api.gui.contextHelper.
Functions
collectSubjectStates(idsOfInterest : {string}) : {string : SubjectState} api/tealdef/api/gui.d.tl:656
Call as api.gui.contextHelper.collectSubjectStates(…)
Collects subject states for given ids
| Parameter | Type | Description |
|---|---|---|
idsOfInterest |
{string} |
ids to collect states for |
Returns {string : SubjectState}
getIdsOfActiveTool() : {string} api/tealdef/api/gui.d.tl:657
Call as api.gui.contextHelper.getIdsOfActiveTool(…)
Notes
Ids of the currently active tools in the main view; the context helper uses them to pick the help page for the active tool.
Returns {string}: List of tool ids (empty when no tool is active).
Gui.ContextHelper.SubjectState¶
record api/tealdef/api/gui.d.tl:649
record SubjectState
Notes
State of a GUI component reported by collectSubjectStates.
Used in the base game: 1 time in 1 file
base/content/gui/gui/context_helper/context_helper_react.tl:815
Fields
| Name | Type | Description |
|---|---|---|
Visible |
SubjectState |
The component is visible. used 2× in the base game |
Focused |
SubjectState |
The component is visible and has the focus. used 1× in the base game |
Gui.Construction¶
record api/tealdef/api/gui.d.tl:660
record Construction
Access: api.gui.construction
Notes
Construction-tool helpers, reached as api.gui.construction.
Functions
setAngle(angle : number) api/tealdef/api/gui.d.tl:663
Call as api.gui.construction.setAngle(…)
Sets the default construction angle for constructions.
| Parameter | Type | Description |
|---|---|---|
angle |
number |
the default construction angle |
modify(construction : Engine.Entity) api/tealdef/api/gui.d.tl:667
Call as api.gui.construction.modify(…)
Modifies a construction
| Parameter | Type | Description |
|---|---|---|
construction |
Engine.Entity |
the construction entity |
getBrushIcons() : {string} api/tealdef/api/gui.d.tl:671
Call as api.gui.construction.getBrushIcons(…)
Returns brush icons for construction menu
Returns {string}: paths to brush icons for the construction menu
provideDustWheneverPossible(proposal : Proposal, proposalData : ProposalData) api/tealdef/api/gui.d.tl:676
Call as api.gui.construction.provideDustWheneverPossible(…)
Provides dust effects for proposal
| Parameter | Type | Description |
|---|---|---|
proposal |
Proposal |
the proposal |
proposalData |
ProposalData |
the proposal data |
getRefundableEntities() : {{Engine.Entity, integer}, {Engine.Revision, integer}} api/tealdef/api/gui.d.tl:678
Call as api.gui.construction.getRefundableEntities(…)
Notes
Entities whose cost would currently be refunded when they are replaced; pass the result as refundableEntities of the command context.
Returns {{Engine.Entity, integer}, {Engine.Revision, integer}}: Refundable entities with their revisions, or nil.
Example
-- gui/entity_window/bridge_and_tunnel.tl
local context = api.type.Context.new()
context.player = api.engine.util.getPlayer()
local refundables = api.gui.construction.getRefundableEntities()
if refundables ~= nil then
context.refundableEntities = refundables
end
local cmd = api.cmd.makeWorldBuildProposalCmd(proposal, context, false, true)
api.cmd.sendCommand(cmd, function(res, success)
if success then
api.gui.construction.updateRefundableEntities(resultEntities, res.proposal.proposal)
end
end)
updateRefundableEntities(resultEntities : {Engine.Entity}, proposal : Proposal.StreetProposal) api/tealdef/api/gui.d.tl:682
Call as api.gui.construction.updateRefundableEntities(…)
Updates refundable entities
| Parameter | Type | Description |
|---|---|---|
resultEntities |
{Engine.Entity} |
result entities |
proposal |
Proposal.StreetProposal |
the street proposal |
Gui.Mission¶
record api/tealdef/api/gui.d.tl:685
record Mission
Access: api.gui.mission
Notes
Mission and campaign helpers (zones, markers, cutscenes), reached as api.gui.mission.
Functions
getMission() : string api/tealdef/api/gui.d.tl:688
Call as api.gui.mission.getMission(…)
Get the current mission
Returns string: the mission name
Used in the base game: 7 times in 3 files
base/content/mission/mission/mission_framework/mission_end_window_util.tl:9
base/content/mission/mission/mission_framework/mission_framework_react.tl:539
base/content/mission/mission/mission_react_util.tl:168
getCampaign() : string api/tealdef/api/gui.d.tl:692
Call as api.gui.mission.getCampaign(…)
Get the current campaign
Returns string: the campaign name
Used in the base game: 4 times in 2 files
base/content/mission/mission/mission_framework/mission_end_window_util.tl:272
base/content/mission/mission/mission_framework/mission_framework_react.tl:544
setZone(key : string, polygon : {Vec2f}, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation? : boolean, zOffset? : number) api/tealdef/api/gui.d.tl:702
Call as api.gui.mission.setZone(…)
Adds a zone
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key (name) of the zone |
polygon |
{Vec2f} |
the shape of the zone as a list of 2d position |
draw |
boolean |
if the zone should be drawn |
drawColor |
Vec4f |
the color of the zone |
prohibitBuilding |
boolean |
if prevented or not to build inside the zone |
playAnimation? |
boolean |
if player zone animation (optional), default to true |
zOffset? |
number |
(optional), default to terrain level |
Used in the base game: 2 times in 2 files
base/content/mission/mission/legacy_ui_util.tl:13
base/content/mission/mission/mission_sim.script.tl:1109
setZoneCircle(key : string, center : Vec2f, radius : number, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation? : boolean, zOffset? : number) api/tealdef/api/gui.d.tl:713
Call as api.gui.mission.setZoneCircle(…)
Adds a zone as a cylinder
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key (name) of the zone |
center |
Vec2f |
the center of the zone |
radius |
number |
the radius of the zone |
draw |
boolean |
if the zone should be drawn |
drawColor |
Vec4f |
the color of the zone |
prohibitBuilding |
boolean |
if prevented or not to build inside the zone |
playAnimation? |
boolean |
if player zone animation (optional), default to true |
zOffset? |
number |
(optional), default to terrain level |
removeZone(key : string) api/tealdef/api/gui.d.tl:717
Call as api.gui.mission.removeZone(…)
Removes a zone
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key of the zone |
setMarkerAtPosition(key : string, pos : Vec3f, type : string, scaling : number, isSelectable? : boolean, fireSelectEntity? : boolean) api/tealdef/api/gui.d.tl:726
Call as api.gui.mission.setMarkerAtPosition(…)
Sets marker at the given position
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key of the marker |
pos |
Vec3f |
the position of the marker |
type |
string |
type of marker (optional) |
scaling |
number |
scaling of marker (optional) |
isSelectable? |
boolean |
whether marker is selectable |
fireSelectEntity? |
boolean |
whether selecting the marker also selects the underlying entity (default is true) |
Used in the base game: 2 times in 2 files
base/content/mission/mission/legacy_ui_util.tl:24
base/content/mission/mission/mission_sim.script.tl:1096
setMarkerAtEntity(key : string, entity : Engine.Entity, type : string, scaling : number, isSelectable? : boolean, fireSelectEntity? : boolean) api/tealdef/api/gui.d.tl:735
Call as api.gui.mission.setMarkerAtEntity(…)
Sets marker at the given entity
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key of the marker |
entity |
Engine.Entity |
the entity |
type |
string |
optional type |
scaling |
number |
optional scaling |
isSelectable? |
boolean |
whether marker is selectable |
fireSelectEntity? |
boolean |
whether selecting the marker also selects the underlying entity (default is true) |
Used in the base game: 2 times in 2 files
base/content/mission/mission/legacy_ui_util.tl:21
base/content/mission/mission/mission_sim.script.tl:1094
removeMarker(key : string) api/tealdef/api/gui.d.tl:739
Call as api.gui.mission.removeMarker(…)
Removes a marker
| Parameter | Type | Description |
|---|---|---|
key |
string |
the key of the marker |
setMovePathVisualizationAtEntity(key : string, entity : Engine.Entity, color? : Vec3f) api/tealdef/api/gui.d.tl:745
Call as api.gui.mission.setMovePathVisualizationAtEntity(…)
Renderes the move path of an entity dynamically ATTENTION: at the moment, only ships are supported.
| Parameter | Type | Description |
|---|---|---|
key |
string |
unique key |
entity |
Engine.Entity |
entity |
color? |
Vec3f |
optional color |
removeMovePathVisualization(key : string) api/tealdef/api/gui.d.tl:748
Call as api.gui.mission.removeMovePathVisualization(…)
Removes the move path of an entity dynamically
| Parameter | Type | Description |
|---|---|---|
key |
string |
unique key |
playCutscene(filePath : string, resolveLanguageFolder? : boolean, entityToEntityMap? : {Engine.Entity : Engine.Entity}) api/tealdef/api/gui.d.tl:754
Call as api.gui.mission.playCutscene(…)
Plays a cutscene.
| Parameter | Type | Description |
|---|---|---|
filePath |
string |
the filepath to the cutscene keyframe definition that should be played |
resolveLanguageFolder? |
boolean |
automatically resolve the selected keyframe file by language |
entityToEntityMap? |
{Engine.Entity : Engine.Entity} |
maps entities from the keyframe file to possible runtime entities |
isCutscenePlaying() : boolean api/tealdef/api/gui.d.tl:757
Call as api.gui.mission.isCutscenePlaying(…)
Checks if a cutscene is currently playing.
Returns boolean
Used in the base game: 5 times in 3 files
base/content/game_mechanics/game_mechanics/notifications/gui/notification_popups.tl:96
base/content/mission/mission/mission_framework/mission_framework_react.tl:1055
base/content/mission/mission/mission_react_util.tl:347
getCutsceneElapsedTime() : number api/tealdef/api/gui.d.tl:761
Call as api.gui.mission.getCutsceneElapsedTime(…)
Return the current cutscene time for syncing mission related systems to the cutscene
Returns number: the actual simulated cutscene time
Gui.Game¶
record api/tealdef/api/gui.d.tl:764
record Game
Access: api.gui.game
Notes
Game-session helpers (GUI save data, map editor state, environment), reached as api.gui.game.
Functions
isSavegameUIBlocked() : boolean api/tealdef/api/gui.d.tl:767
Call as api.gui.game.isSavegameUIBlocked(…)
Returns if the UI is blocked by a savegame in progress
Returns boolean: true if the ui is blocked by a savegame
setInGameMenuPause(pause : boolean) api/tealdef/api/gui.d.tl:771
Call as api.gui.game.setInGameMenuPause(…)
Sets if the game pause menu is open
| Parameter | Type | Description |
|---|---|---|
pause |
boolean |
true if the user is in the pause menu |
getGuiSaveData(modId : string) : table api/tealdef/api/gui.d.tl:776
Call as api.gui.game.getGuiSaveData(…)
Returns the GUI SaveData
| Parameter | Type | Description |
|---|---|---|
modId |
string |
the mod to get the user data for |
Returns table: the userData as a lua table
Used in the base game: 8 times in 7 files
base/content/gui/gui/hud/cargo_flow.script.tl:147
base/content/gui/gui/hud/greenification_display.script.tl:140
base/content/gui/gui/hud/happy_change_display.script.tl:79
base/content/gui/gui/hud/marketing_display.script.tl:141
base/content/gui/gui/layers/layer_hud_filter.tl:37
base/content/gui/gui/line_vehicle_mgmt/vehicle_react_util.tl:329
… and 1 more files.
setGuiSaveData(modId : string, data : table) api/tealdef/api/gui.d.tl:781
Call as api.gui.game.setGuiSaveData(…)
Sets the GUI SaveData
| Parameter | Type | Description |
|---|---|---|
modId |
string |
the mod to set the user data for |
data |
table |
the user data |
getEstimatedMaximumGameSpeed() : integer api/tealdef/api/gui.d.tl:786
Call as api.gui.game.getEstimatedMaximumGameSpeed(…)
Returns the (estimated) maximum possible game speed based on actual simulation timings. Only available in GUI thread.
Returns integer: maximum game speed (or 0 if not enough data available)
isMapEditor() : boolean api/tealdef/api/gui.d.tl:790
Call as api.gui.game.isMapEditor(…)
Returns if the game is currently in the map editor
Returns boolean: true if in the map editor
Used in the base game: 6 times in 6 files
base/content/gui/gui/construction/construction_react_util.tl:3305
base/content/gui/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.script.tl:8
local isMapEditorRef : ReactRefT<boolean> = react.useRefLazy(function() : boolean return api.gui.game.isMapEditor() end)
base/content/gui/gui/game_bar/game_bar_display_transported_plugin/game_bar_display_transported.script.tl:9
local isMapEditorRef : ReactRefT<boolean> = react.useRefLazy(function() : boolean return api.gui.game.isMapEditor() end)
base/content/gui/gui/main/game.tl:735
local isMapEditorRef : ReactRefT<boolean> = react.useRefLazy(function() : boolean return api.gui.game.isMapEditor() end)
base/content/gui/gui/main/pause_menu.tl:58
local isMapEditorRef : ReactRefT<boolean> = react.useRefLazy(function() : boolean return api.gui.game.isMapEditor() end)
base/content/gui/gui/menu/save_game_page.tl:155
getDefaultSavegameId() : string api/tealdef/api/gui.d.tl:794
Call as api.gui.game.getDefaultSavegameId(…)
Returns the default savegame id
Returns string: the default savegame id
setEnvironment(environment : ResName) api/tealdef/api/gui.d.tl:799
Call as api.gui.game.setEnvironment(…)
Sets an environment. This value is saved in the GUI SaveData and will be restored on next load.
Changing it will not change the current environment, for that api.gui.rendering.setEnvironment needs to be as well called.
| Parameter | Type | Description |
|---|---|---|
environment |
ResName |
the resource name for the environment |
getEnvironment() : ResName api/tealdef/api/gui.d.tl:803
Call as api.gui.game.getEnvironment(…)
Returns the resource name of the current environment
Returns ResName: the environment resource name
Gui.Guide¶
record api/tealdef/api/gui.d.tl:806
record Guide
Access: api.gui.guide
Notes
The guide system (tutorial "bookmark" buttons attached to GUI components), reached as api.gui.guide.
Functions
trySpawnGuideById(targets : {GuideTarget}, tooltip : string, caption : string) : boolean api/tealdef/api/gui.d.tl:833
Call as api.gui.guide.trySpawnGuideById(…)
Tries to attach a guide system button to the first visible target component
| Parameter | Type | Description |
|---|---|---|
targets |
{GuideTarget} |
prioritized list of target components |
tooltip |
string |
text |
caption |
string |
optional caption text |
Returns boolean
trySpawnGuideFree(position : FreeGuidePosition, tooltip : string, caption : string) : boolean api/tealdef/api/gui.d.tl:838
Call as api.gui.guide.trySpawnGuideFree(…)
Tries to spawn a free floating guide system button
| Parameter | Type | Description |
|---|---|---|
position |
FreeGuidePosition |
|
tooltip |
string |
text |
caption |
string |
optional caption text |
Returns boolean
completeGuideById(targets : {GuideTarget}) : boolean api/tealdef/api/gui.d.tl:841
Call as api.gui.guide.completeGuideById(…)
Completes a guide corresponding to a specific id
Returns boolean
resetGuide() api/tealdef/api/gui.d.tl:844
Call as api.gui.guide.resetGuide(…)
Resets the current active guide
Gui.Guide.GuidePosition¶
record api/tealdef/api/gui.d.tl:808
record GuidePosition
Gui positioning of the guide "bookmark" with respect to target component
Used in the base game: 1 time in 1 file
base/content/mission/mission/guide_system/guide_system_react.tl:186
Fields
| Name | Type | Description |
|---|---|---|
Left |
GuidePosition |
Guide button to the left of the target component. used 1× in the base game |
Right |
GuidePosition |
Guide button to the right of the target component. used 1× in the base game |
Above |
GuidePosition |
Guide button above the target component (the default). used 1× in the base game |
Below |
GuidePosition |
Guide button below the target component. used 1× in the base game |
Gui.Guide.FreeGuidePosition¶
record api/tealdef/api/gui.d.tl:816
record FreeGuidePosition
Gui positioning of the guide "bookmark" with respect to the entire screen
Used in the base game: 1 time in 1 file
base/content/mission/mission/guide_system/guide_system_react.tl:193
Fields
| Name | Type | Description |
|---|---|---|
High |
FreeGuidePosition |
Free guide button in the upper part of the screen. used 1× in the base game |
Low |
FreeGuidePosition |
Free guide button in the lower part of the screen (the base game's default). used 2× in the base game |
Gui.Guide.GuideTarget¶
record userdata api/tealdef/api/gui.d.tl:822
record GuideTarget
A target component for the guide system
Used in the base game: 2 times in 1 file
base/content/mission/mission/guide_system/guide_system_react.tl:166
Fields
| Name | Type | Description |
|---|---|---|
idOrTag |
string |
Id or tag of the target GUI component. |
position |
GuidePosition |
default is above |
Functions
new(idOrTag : string, position? : GuidePosition) : GuideTarget api/tealdef/api/gui.d.tl:824
Notes
Creates a guide target.
| Parameter | Type | Description |
|---|---|---|
idOrTag |
string |
Id or tag of the GUI component to attach the guide to. |
position? |
GuidePosition |
Where to place the guide button; defaults to GuidePosition.Above. |
Returns GuideTarget: The new target.
Example
Gui.Rendering¶
record api/tealdef/api/gui.d.tl:847
record Rendering
Access: api.gui.rendering
Notes
Rendering helpers (environment, dust effects, frame interpolation), reached as api.gui.rendering.
Functions
setEnvironment(environment : Environment) api/tealdef/api/gui.d.tl:851
Call as api.gui.rendering.setEnvironment(…)
Sets an environment. This will change the current environment, but will not persist the environment resource name.
It might be necessary to as well call api.gui.game.setEnvironment if a different environment resource is set.
| Parameter | Type | Description |
|---|---|---|
environment |
Environment |
the description for the environment |
getEnvironment() : Environment api/tealdef/api/gui.d.tl:855
Call as api.gui.rendering.getEnvironment(…)
Returns the current environment data
Returns Environment: the current environment data
spawnDust(bbMin : Vec3f, bbMax : Vec3f, transf : Mat4f) api/tealdef/api/gui.d.tl:861
Call as api.gui.rendering.spawnDust(…)
Makes a dust cloud appear
| Parameter | Type | Description |
|---|---|---|
bbMin |
Vec3f |
bounding box min |
bbMax |
Vec3f |
bounding box max |
transf |
Mat4f |
transformation matrix |
getFrameTime01() : number api/tealdef/api/gui.d.tl:862
Call as api.gui.rendering.getFrameTime01(…)
Notes
Interpolation factor of the current render frame between the previous and the current simulation step.
Returns number: Value from 0 to 1; use it to blend between previous and current positions.
Example
Gui.Map¶
record api/tealdef/api/gui.d.tl:865
record Map
Access: api.gui.map
Notes
Map and terrain helpers, reached as api.gui.map.
Functions
setMapSeedText(seed : string) api/tealdef/api/gui.d.tl:868
Call as api.gui.map.setMapSeedText(…)
Sets seed for the map. Only available in GUI thread.
| Parameter | Type | Description |
|---|---|---|
seed |
string |
the seed |
reloadMaterialIndexManagerPipeline() api/tealdef/api/gui.d.tl:870
Call as api.gui.map.reloadMaterialIndexManagerPipeline(…)
Reloads the material index manager pipeline.
openTerrainEditor() api/tealdef/api/gui.d.tl:871
Call as api.gui.map.openTerrainEditor(…)
Notes
Opens the terrain (node) editor; called by its game-bar toggle.
closeTerrainEditor() api/tealdef/api/gui.d.tl:872
Call as api.gui.map.closeTerrainEditor(…)
Notes
Closes the terrain (node) editor.
Gui.BenchMark¶
record api/tealdef/api/gui.d.tl:875
record BenchMark
Access: api.gui.benchMark
Notes
Frame and simulation timing data, reached as api.gui.benchMark.
Functions
getBeginFrameTimes() : {integer} api/tealdef/api/gui.d.tl:883
Call as api.gui.benchMark.getBeginFrameTimes(…)
Returns the rendering preparation time
Returns {integer}
getEventTimes() : {integer} api/tealdef/api/gui.d.tl:886
Call as api.gui.benchMark.getEventTimes(…)
Returns the events processing time
Returns {integer}
getCoreStepTimes() : {integer} api/tealdef/api/gui.d.tl:889
Call as api.gui.benchMark.getCoreStepTimes(…)
Returns the gui update time
Returns {integer}
getRenderTimes() : {integer} api/tealdef/api/gui.d.tl:892
Call as api.gui.benchMark.getRenderTimes(…)
Returns the rendering time
Returns {integer}
getSwapTimes() : {integer} api/tealdef/api/gui.d.tl:895
Call as api.gui.benchMark.getSwapTimes(…)
Returns the rendering finish time
Returns {integer}
getReplicateTimes() : {SimTime} api/tealdef/api/gui.d.tl:898
Call as api.gui.benchMark.getReplicateTimes(…)
Returns the sync time between gui and simulation. Only available in GUI thread.
Returns {SimTime}
getCommandTimes() : {SimTime} api/tealdef/api/gui.d.tl:901
Call as api.gui.benchMark.getCommandTimes(…)
Returns commands processing time. Only available in GUI thread.
Returns {SimTime}
getGameStepTimes() : {SimTime} api/tealdef/api/gui.d.tl:904
Call as api.gui.benchMark.getGameStepTimes(…)
Returns the simulation update time. Only available in GUI thread.
Returns {SimTime}
Gui.BenchMark.SimTime¶
record api/tealdef/api/gui.d.tl:877
record SimTime
Simulation time frame along with game time at moment of capture
Fields
| Name | Type | Description |
|---|---|---|
frameTime |
integer |
Measured duration of the frame. |
gameTime |
integer |
Game time at the moment of capture. |
Gui.Debug¶
record api/tealdef/api/gui.d.tl:907
record Debug
Access: api.gui.debug
Notes
Debug helpers, reached as api.gui.debug.
Functions
selectEntity(entity : Engine.Entity) api/tealdef/api/gui.d.tl:910
Call as api.gui.debug.selectEntity(…)
Set the current debug entity
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
the entity |
Gui.Achievements¶
record api/tealdef/api/gui.d.tl:913
record Achievements
Access: api.gui.achievements
Notes
Achievements and player statistics, reached as api.gui.achievements.
Functions
areStatsDisabled() : boolean api/tealdef/api/gui.d.tl:916
Call as api.gui.achievements.areStatsDisabled(…)
Checkes whether player stats are disabled
Returns boolean: true if player stats are disabled
unlockAchievement(achievement : string) api/tealdef/api/gui.d.tl:920
Call as api.gui.achievements.unlockAchievement(…)
Unlocks an achievement based on its string id
| Parameter | Type | Description |
|---|---|---|
achievement |
string |
achievement to unlock |
isAchievementUnlockable(achievement : string) : boolean api/tealdef/api/gui.d.tl:925
Call as api.gui.achievements.isAchievementUnlockable(…)
Checks whether an achievement can be unlocked
| Parameter | Type | Description |
|---|---|---|
achievement |
string |
achievement to check |
Returns boolean: true if the achievement can be unlocked
isAchievementUnlocked(achievement : string) : boolean api/tealdef/api/gui.d.tl:930
Call as api.gui.achievements.isAchievementUnlocked(…)
Checks whether an achievement is unlocked (completed)
| Parameter | Type | Description |
|---|---|---|
achievement |
string |
achievement to check |
Returns boolean: true if the achievement is unlocked
updateStat(playerStat : string, value : number) api/tealdef/api/gui.d.tl:935
Call as api.gui.achievements.updateStat(…)
Increments a player stat value by the provided value
| Parameter | Type | Description |
|---|---|---|
playerStat |
string |
the stat id to update |
value |
number |
the value to add to the stat |
setStat(playerStat : string, value : number) api/tealdef/api/gui.d.tl:940
Call as api.gui.achievements.setStat(…)
Sets a player stat value, replacing the current value by the provided one
| Parameter | Type | Description |
|---|---|---|
playerStat |
string |
the stat id to update |
value |
number |
the value to add to the stat |
getStatValue(playerStat : string) : number api/tealdef/api/gui.d.tl:945
Call as api.gui.achievements.getStatValue(…)
Gets a player stat value
| Parameter | Type | Description |
|---|---|---|
playerStat |
string |
the stat id to get |
Returns number: the current value of the stat
setStatExtraData(playerStat : string, data : table) api/tealdef/api/gui.d.tl:951
Call as api.gui.achievements.setStatExtraData(…)
Sets extra data associated with a stat. Extra data are stored locally in the player profile and allow tracking of more informations if necessary.
| Parameter | Type | Description |
|---|---|---|
playerStat |
string |
the stat id to set the extra data for |
data |
table |
the extra data to set |
getStatExtraData(playerStat : string) : table api/tealdef/api/gui.d.tl:957
Call as api.gui.achievements.getStatExtraData(…)
Gets extra data associated with a stat. Extra data are stored locally in the player profile and allow tracking of more informations if necessary.
| Parameter | Type | Description |
|---|---|---|
playerStat |
string |
the stat id to get the extra data for |
Returns table: the extra data
setEarnedSFX(sfx : {FilePath}) api/tealdef/api/gui.d.tl:961
Call as api.gui.achievements.setEarnedSFX(…)
Set sound effect(s) to be played when an achievement is earned.
| Parameter | Type | Description |
|---|---|---|
sfx |
{FilePath} |
vector of filepaths pointing to .wav files with according sound effect(s) |
Gui.GenericRep¶
record api/tealdef/api/gui.d.tl:964
record GenericRep is ResTypeRep<integer, GenericGameRes>
Access: api.gui.genericRep
Notes
Repository of GUI-side generic resources (.gres files of type gui_res / gui_res_overwrite), reached as api.gui.genericRep.
Example
Functions
getAllOfType(typeName : string, includeInvisible? : boolean) : {integer} api/tealdef/api/gui.d.tl:969
Call as api.gui.genericRep.getAllOfType(…)
Gets all the Genereic Resource Type of a given type name
Only allows typeName in { "gui_res_overwrite", "gui_res" }, for other types, use api.res.genericRep
| Parameter | Type | Description |
|---|---|---|
typeName |
string |
the type name |
includeInvisible? |
boolean |
whether to include invisible resources |
Returns {integer}
Gui.Backend¶
record api/tealdef/api/gui.d.tl:972
record Backend
Access: api.gui.backend
Notes
Paradox account and online backend (login, profile, legal documents, third-party account linking), reached as api.gui.backend.
Functions
isInitialized() : boolean api/tealdef/api/gui.d.tl:978
Call as api.gui.backend.isInitialized(…)
Notes
Whether the online backend is initialized; the mod manager shows an offline message when it is not.
Returns boolean: true when the backend is available.
hasLegalDocuments() api/tealdef/api/gui.d.tl:980
Call as api.gui.backend.hasLegalDocuments(…)
Notes
Whether there are legal documents the player still has to view; the main menu then shows the licence page first.
Details
The definition declares no return value, but the base game uses the result as a boolean (gui/menu/main_menu.tl).
getLegalDocuments() : {string} api/tealdef/api/gui.d.tl:982
Call as api.gui.backend.getLegalDocuments(…)
Notes
Types of the legal documents to show; pass each one to getLegalDocument.
Returns {string}: List of document type strings.
markLegalDocumentViewed(string) api/tealdef/api/gui.d.tl:984
Call as api.gui.backend.markLegalDocumentViewed(…)
Notes
Marks a legal document as viewed by the player.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Document type, as returned by getLegalDocuments. |
isAccountLoggedIn() : boolean api/tealdef/api/gui.d.tl:986
Call as api.gui.backend.isAccountLoggedIn(…)
Notes
Whether a Paradox account is logged in.
Returns boolean: true when logged in.
loginAccount(username : string, password : string) : PdxFuture<PdxLoginResult> api/tealdef/api/gui.d.tl:988
Call as api.gui.backend.loginAccount(…)
Notes
Starts logging in to a Paradox account.
| Parameter | Type | Description |
|---|---|---|
username |
string |
Account e-mail / user name. |
password |
string |
Account password. |
Returns PdxFuture<PdxLoginResult>: Future; poll getResult() (it returns nil until the result is available).
logoutAccount() : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:990
Call as api.gui.backend.logoutAccount(…)
Notes
Logs out of the Paradox account.
getAccountInfo() : PdxFuture<PdxAccountInfo> api/tealdef/api/gui.d.tl:992
Call as api.gui.backend.getAccountInfo(…)
Notes
Requests information about the logged-in account.
Returns PdxFuture<PdxAccountInfo>: Future with the account info.
getProfile(social : boolean) : PdxFuture<PdxProfileResult> api/tealdef/api/gui.d.tl:994
Call as api.gui.backend.getProfile(…)
Notes
Requests the player's Paradox profile.
| Parameter | Type | Description |
|---|---|---|
social |
boolean |
Which profile to query; the base game passes true. |
Returns PdxFuture<PdxProfileResult>: Future with the profile result.
createProfile(name : string, social : boolean) : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:996
Call as api.gui.backend.createProfile(…)
Notes
Creates a Paradox profile with the given name.
| Parameter | Type | Description |
|---|---|---|
name |
string |
Profile name entered by the player. |
social |
boolean |
The base game passes true. |
renameProfile(name : string, social : boolean) : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:998
Call as api.gui.backend.renameProfile(…)
Notes
Renames the Paradox profile.
| Parameter | Type | Description |
|---|---|---|
name |
string |
New profile name. |
social |
boolean |
As for createProfile. |
getCountries() : {PdxCountry} api/tealdef/api/gui.d.tl:1000
Call as api.gui.backend.getCountries(…)
Notes
Countries / regions selectable when creating an account.
Returns {PdxCountry}: List of PdxCountry (name, code); pass code to createAccount.
getLegalDocument(type : string) : PdxFuture<PdxLegalDocument> api/tealdef/api/gui.d.tl:1002
Call as api.gui.backend.getLegalDocument(…)
Notes
Requests the content of one legal document.
| Parameter | Type | Description |
|---|---|---|
type |
string |
Document type, as returned by getLegalDocuments. |
Returns PdxFuture<PdxLegalDocument>: Future with the document (title, text).
Example
createAccount(email : string, password : string, dateOfBirth : string, countryCode : integer, marketingPermission : boolean) : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:1004
Call as api.gui.backend.createAccount(…)
Notes
Creates a new Paradox account.
| Parameter | Type | Description |
|---|---|---|
email |
string |
E-mail address. |
password |
string |
Password. |
dateOfBirth |
string |
Date of birth, as delivered by the base game's date input. |
countryCode |
integer |
Country code from getCountries. |
marketingPermission |
boolean |
Whether the player agrees to marketing e-mails. |
supportsAccountLinking() : boolean api/tealdef/api/gui.d.tl:1006
Call as api.gui.backend.supportsAccountLinking(…)
Notes
Whether the platform supports linking a third-party (platform) account to the Paradox account.
Returns boolean
getThirdPartyLinkState() : PdxFuture<PdxThirdPartyLinkState> api/tealdef/api/gui.d.tl:1008
Call as api.gui.backend.getThirdPartyLinkState(…)
Notes
Requests whether the third-party account is linked.
Returns PdxFuture<PdxThirdPartyLinkState>: Future with the link state.
getThirdPartyAutoLoginPromptState() : PdxThirdPartyAutoLoginPromptState api/tealdef/api/gui.d.tl:1010
Call as api.gui.backend.getThirdPartyAutoLoginPromptState(…)
Notes
Current state of the third-party auto-login prompt.
setThirdPartyAutoLoginPromptState(state : PdxThirdPartyAutoLoginPromptState) api/tealdef/api/gui.d.tl:1012
Call as api.gui.backend.setThirdPartyAutoLoginPromptState(…)
Notes
Sets the state of the third-party auto-login prompt (the mod manager resets it to NotShown on logout).
| Parameter | Type | Description |
|---|---|---|
state |
PdxThirdPartyAutoLoginPromptState |
New state, e.g. api.type.enum.PdxThirdPartyAutoLoginPromptState.NotShown. |
linkThirdPartyAccount() : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:1014
Call as api.gui.backend.linkThirdPartyAccount(…)
Notes
Links the third-party account to the logged-in Paradox account.
unlinkThirdPartyAccount() : PdxFuture<PdxResult> api/tealdef/api/gui.d.tl:1016
Call as api.gui.backend.unlinkThirdPartyAccount(…)
Notes
Removes the link between the third-party account and the Paradox account.
loginThirdPartyAccount() : PdxFuture<PdxLoginResult> api/tealdef/api/gui.d.tl:1018
Call as api.gui.backend.loginThirdPartyAccount(…)
Notes
Logs in to Paradox with the linked third-party account.
Returns PdxFuture<PdxLoginResult>: Future with the login result.
Gui.Backend.LegalDocument¶
record api/tealdef/api/gui.d.tl:973
record LegalDocument
Notes
A legal document (title and text).
Fields
| Name | Type | Description |
|---|---|---|
title |
string |
Title of the document. |
text |
string |
Text of the document. |