Module api.gui🔗
Contains all GUI functionality apart from react.
global record Gui
fireReactEvent: function(name : string, param : any) fireGuiScriptEvent: function(id : string, name : string, param : any): anyspawnEphemeralHudImage: function(iconPath : FilePath, entity : Engine.Entity, color : Vec4f, position : Vec3f, overrideDuration : number, fadeIn : boolean, fadeOut : boolean, rev0 : integer) spawnEphemeralHudImageOnPath: function(iconPath : FilePath, pos0 : Vec3f, pos1 : Vec3f, pos0 : Vec3f, pos1 : Vec3f, speed : number, scale : number, maxDistance : number) closeAllWindows: function()record SpawnHudImageParams
iconPath: FilePath color: Vec4f entity: Engine.Entity position: Vec3f endrecord SelectionDetails
new: function(): SelectionDetailsrecord Type
None: Type Line: Type Station: Type Signal: Type Stop: Type Waypoint: Type TransportNetworkEdge: Type World: Type Marker: Type Town: Type endrecord Station
new: function(): Station stationGroup: Engine.Entity flatStationTerminalIndex: integer stationTerminal: StationTerminal endrecord Stop
new: function(): Stop station: SelectionDetails.Station line: Engine.Entity stopIndex: integer endrecord Marker
new: function(): Marker marker: string fireSelectEntity: boolean pos: Vec3f entity: Engine.Entity enddata: DataType endrecord Town
new: function(): Town townEntity: Engine.Entity districtType: LandUseType districtCenter: Vec3f endrecord Mouse
getTerrainPosition: function(): Vec3f hasTerrainPosition: function(): boolean endrecord Event
type: Type button: integer x: integer y: integer xrel: integer yrel: integer handled: boolean endrecord Type
Pressed: Type Released: Type Clicked: Type Entered: Type Exited: Type Moved: Type Wheel: Type DoubleClicked: Type PressedOutside: Type endrecord Key
endrecord InputEvent
dir: State repeated: boolean isGamepadEvent: function(InputEvent): boolean isKeyboardEvent: function(InputEvent): boolean getKey: function(InputEvent): integer getKeyMod: function(InputEvent): integer endrecord DnD
setCursor: function(cursor : integer) addTransferData: function(dragStartEvent : Event, item : DataTransferItem) getAllTransferData: function(): {DataTransferItem} endrecord InputAction
record InputActionState
Disabled: InputActionState Inactive: InputActionState Enabled: InputActionState endmodifierOnlyActionIsActive: function(inputActionId : string): boolean hasConflicts: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): string findDuplicatesOf: function(inputActionId : string): {string} getFixedKeyCmdDefs: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): {string : {KeyComboDef}} endrecord InvokeData
status: Status endrecord Status
Triggered: Status Repeat: Status PressedStep: Status EndReleased: Status EndAborted: Status endrecord ById
setVisibilityByClass: function(idOrTag : string, visible : boolean, idOnly : boolean) setEnabled: function(idOrTag : string, enabled : boolean, idOnly : boolean) setHighlighted: function(idOrTag : string, highlighted : boolean, style : HighlightStyle, color : Vec3f, idOnly : boolean) isVisible: function(id : string): boolean isVisibleRecursive: function(id : string): boolean setVisible: function(id : string, visible : boolean) resetMovedWindowPosition: function(id : string) getSize: function(id : string): Vec2f endrecord Camera
setManualCamera: function(center : Vec2f, distance : number) getCameraData: function(): Vec5f setCameraData: function(Vec5f : Vec5f) getHeightAboveTerrain: function(): number focusEntity: function(entity : Engine.Entity) focusPosition: function(position : Vec3f, distance : number) takeScreenshot: function(scale : integer) getFollowEntity: function(): {Engine.Entity, Engine.Revision} followEntity: function(entity : Engine.Entity, jump : boolean) enterFollowCameraCockpit: function(entity : Engine.Entity) leaveFollowCameraCockpit: function() isFreeCameraMouseAttached: function(): boolean toggleFreeCameraMouseAttachment: function() toggleFreeCamera: function() world2Screen: function(Vec3f): Vec2i screen2World: function(Vec3f): Vec3f getEye: function(): Vec3f getCenter: function(): Vec3f getNearFar: function(): Vec2f getSize: function(): Vec2i traceToTerrain: function(worldPos : Vec3f, farPos : Vec3f, zOffset : number, numSteps : integer): Vec3f | nil endrecord Sound
letVehicleHorn: function(vehicleEntity : Engine.Entity) playRandomSoundEffect: function(paths : {FilePath}) endrecord MusicPlayer
goBack: function() goForward: function() togglePause: function() getTitle: function(): string getArtist: function(): string hasPlaylist: function(): boolean getPlaylistIndex: function(): integer setTrackListFromPlayList: function(playlist : string, startPaused : boolean, offset : number) setPlaylist: function(playlist : string) getPlaylist: function(): string isPlaying: function(): boolean playTrack: function(trackName : string, offset : number) playTrackFile: function(filePath : string, offset : number) getTrackLength: function(): number getTrackElapsedTime: function(): number getGain: function(): number setGain: function(gain : number) setTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) addTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) setContextTag: function(contextTag : string) endrecord VoiceOverManager
stop: function() play: function(voiceOverRes : string, delayInSeconds : number) isPlaying: function(voiceOverRes : string): boolean isPlayingAny: function(): boolean getPlaying: function(): ResName endrecord ByEntity
isLineEmptyOrVisible: function(Engine.Entity : Engine.Entity): boolean isVisible: function(Engine.Entity : Engine.Entity): boolean isVehicleVisible: function(Engine.Entity : Engine.Entity): boolean endrecord ContextHelper
collectSubjectStates: function(idsOfInterest : {string}): {string : SubjectState} getIdsOfActiveTool: function(): {string} endrecord Construction
setAngle: function(angle : number) modify: function(construction : Engine.Entity) getBrushIcons: function(): {string} provideDustWheneverPossible: function(proposal : Proposal, proposalData : ProposalData) getRefundableEntities: function(): {{Engine.Entity, integer}, {Engine.Revision, integer}} updateRefundableEntities: function(resultEntities : {Engine.Entity}, proposal : Proposal.StreetProposal) endrecord Mission
getMission: function(): string getCampaign: function(): string setZone: function(key : string, polygon : {Vec2f}, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) setZoneCircle: function(key : string, center : Vec2f, radius : number, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) removeZone: function(key : string) setMarkerAtPosition: function(key : string, pos : Vec3f, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) setMarkerAtEntity: function(key : string, entity : Engine.Entity, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) removeMarker: function(key : string) setMovePathVisualizationAtEntity: function(key : string, entity : Engine.Entity, color : Vec3f) removeMovePathVisualization: function(key : string) playCutscene: function(filePath : string, resolveLanguageFolder : boolean, entityToEntityMap : {Engine.Entity : Engine.Entity}) isCutscenePlaying: function(): boolean getCutsceneElapsedTime: function(): number endrecord Game
isSavegameUIBlocked: function(): boolean setInGameMenuPause: function(pause : boolean) getGuiSaveData: function(modId : string): {<any type> : <any type>} setGuiSaveData: function(modId : string, data : {<any type> : <any type>}) getEstimatedMaximumGameSpeed: function(): integer isMapEditor: function(): boolean getDefaultSavegameId: function(): string setEnvironment: function(environment : ResName) getEnvironment: function(): ResName endrecord Guide
record GuidePosition
Left: GuidePosition Right: GuidePosition Above: GuidePosition Below: GuidePosition endtrySpawnGuideById: function({GuideTarget}, string, string): boolean trySpawnGuideFree: function(FreeGuidePosition, string, string): boolean completeGuideById: function({GuideTarget}): boolean endrecord GuideTarget
new: function(string, GuidePosition): GuideTarget idOrTag: string position: GuidePosition endrecord Rendering
setEnvironment: function(environment : Environment) getEnvironment: function(): Environment spawnDust: function(bbMin : Vec3f, bbMax : Vec3f, transf : Mat4f) getFrameTime01: function(): number endrecord Map
setMapSeedText: function(seed : string) reloadMaterialIndexManagerPipeline: function() openTerrainEditor: function() closeTerrainEditor: function() endrecord BenchMark
getBeginFrameTimes: function(): {integer} getEventTimes: function(): {integer} getCoreStepTimes: function(): {integer} getRenderTimes: function(): {integer} getSwapTimes: function(): {integer} getReplicateTimes: function(): {SimTime} getCommandTimes: function(): {SimTime} getGameStepTimes: function(): {SimTime} endrecord Achievements
areStatsDisabled: function(): boolean unlockAchievement: function(achievement : string) isAchievementUnlockable: function(achievement : string): boolean isAchievementUnlocked: function(achievement : string): boolean updateStat: function(playerStat : string, value : number) setStat: function(playerStat : string, value : number) getStatValue: function(playerStat : string): number setStatExtraData: function(playerStat : string, data : {<any type> : <any type>}) getStatExtraData: function(playerStat : string): {<any type> : <any type>} setEarnedSFX: function(sfx : {FilePath}) endrecord GenericRep
getAllOfType: function(typeName : string, includeInvisible : boolean): {integer} endmouse: Mouse key: Key dnd: DnD inputAction: InputAction byId: ById camera: Camera sound: Sound musicPlayer: MusicPlayer backend: Backend voiceOverManager: VoiceOverManager byEntity: ByEntity contextHelper: ContextHelper construction: Construction mission: Mission guide: Guide game: Game map: Map benchMark: BenchMark rendering: Rendering debug: Debug achievements: Achievements genericRep: GenericRep StyleSheet: StyleSheet NinePatch: NinePatch endrecord Backend
isInitialized: function(): boolean hasLegalDocuments: function() getLegalDocuments: function(): {PdxLegalDocumentType} isAccountLoggedIn: function(): boolean loginAccount: function(string, string): PdxFuture<PdxLoginResult> logoutAccount: function(): PdxFuture<PdxResult> getAccountInfo: function(): PdxFuture<PdxAccountInfo> getProfile: function(boolean): PdxFuture<PdxProfileResult> createProfile: function(string, boolean): PdxFuture<PdxResult> renameProfile: function(string, boolean): PdxFuture<PdxResult> getCountries: function(): {PdxCountry} getLegalDocument: function(PdxLegalDocumentType): PdxFuture<PdxLegalDocument> createAccount: function(string, string, string, integer, boolean): PdxFuture<PdxResult> supportsAccountLinking: function(): boolean getThirdPartyLinkState: function(): PdxFuture<PdxThirdPartyLinkState> getThirdPartyAutoLoginPromptState: function(): PdxThirdPartyAutoLoginPromptState setThirdPartyAutoLoginPromptState: function(PdxThirdPartyAutoLoginPromptState) linkThirdPartyAccount: function(): PdxFuture<PdxResult> unlinkThirdPartyAccount: function(): PdxFuture<PdxResult> loginThirdPartyAccount: function(): PdxFuture<PdxLoginResult> endglobal record NinePatch
new: function(): NinePatch fileName: string horizontal: {integer} vertical: {integer} flipHorizontally: boolean repeatHorizontally: boolean repeatVertically: boolean repeatFactor: number endglobal record StyleSheet
new: function(): StyleSheet backgroundColor: Vec4f backgroundColor1: Vec4f backgroundColor2: Vec4f backgroundImage1: NinePatch backgroundImage2: NinePatch borderWidth: Vec4f borderColor: Vec4f color: Vec4f size: Vec2f padding: Vec4f fontSize: integer borderImage: NinePatch anchorPoint: Vec2f end
Category: main🔗
Gui🔗
global record Gui
fireReactEvent: function(name : string, param : any) fireGuiScriptEvent: function(id : string, name : string, param : any): anyspawnEphemeralHudImage: function(iconPath : FilePath, entity : Engine.Entity, color : Vec4f, position : Vec3f, overrideDuration : number, fadeIn : boolean, fadeOut : boolean, rev0 : integer) spawnEphemeralHudImageOnPath: function(iconPath : FilePath, pos0 : Vec3f, pos1 : Vec3f, pos0 : Vec3f, pos1 : Vec3f, speed : number, scale : number, maxDistance : number) closeAllWindows: function()record SpawnHudImageParams
iconPath: FilePath color: Vec4f entity: Engine.Entity position: Vec3f endrecord SelectionDetails
new: function(): SelectionDetailsrecord Type
None: Type Line: Type Station: Type Signal: Type Stop: Type Waypoint: Type TransportNetworkEdge: Type World: Type Marker: Type Town: Type endrecord Station
new: function(): Station stationGroup: Engine.Entity flatStationTerminalIndex: integer stationTerminal: StationTerminal endrecord Stop
new: function(): Stop station: SelectionDetails.Station line: Engine.Entity stopIndex: integer endrecord Marker
new: function(): Marker marker: string fireSelectEntity: boolean pos: Vec3f entity: Engine.Entity enddata: DataType endrecord Town
new: function(): Town townEntity: Engine.Entity districtType: LandUseType districtCenter: Vec3f endrecord Mouse
getTerrainPosition: function(): Vec3f hasTerrainPosition: function(): boolean endrecord Event
type: Type button: integer x: integer y: integer xrel: integer yrel: integer handled: boolean endrecord Type
Pressed: Type Released: Type Clicked: Type Entered: Type Exited: Type Moved: Type Wheel: Type DoubleClicked: Type PressedOutside: Type endrecord Key
endrecord InputEvent
dir: State repeated: boolean isGamepadEvent: function(InputEvent): boolean isKeyboardEvent: function(InputEvent): boolean getKey: function(InputEvent): integer getKeyMod: function(InputEvent): integer endrecord DnD
setCursor: function(cursor : integer) addTransferData: function(dragStartEvent : Event, item : DataTransferItem) getAllTransferData: function(): {DataTransferItem} endrecord InputAction
record InputActionState
Disabled: InputActionState Inactive: InputActionState Enabled: InputActionState endmodifierOnlyActionIsActive: function(inputActionId : string): boolean hasConflicts: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): string findDuplicatesOf: function(inputActionId : string): {string} getFixedKeyCmdDefs: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): {string : {KeyComboDef}} endrecord InvokeData
status: Status endrecord Status
Triggered: Status Repeat: Status PressedStep: Status EndReleased: Status EndAborted: Status endrecord ById
setVisibilityByClass: function(idOrTag : string, visible : boolean, idOnly : boolean) setEnabled: function(idOrTag : string, enabled : boolean, idOnly : boolean) setHighlighted: function(idOrTag : string, highlighted : boolean, style : HighlightStyle, color : Vec3f, idOnly : boolean) isVisible: function(id : string): boolean isVisibleRecursive: function(id : string): boolean setVisible: function(id : string, visible : boolean) resetMovedWindowPosition: function(id : string) getSize: function(id : string): Vec2f endrecord Camera
setManualCamera: function(center : Vec2f, distance : number) getCameraData: function(): Vec5f setCameraData: function(Vec5f : Vec5f) getHeightAboveTerrain: function(): number focusEntity: function(entity : Engine.Entity) focusPosition: function(position : Vec3f, distance : number) takeScreenshot: function(scale : integer) getFollowEntity: function(): {Engine.Entity, Engine.Revision} followEntity: function(entity : Engine.Entity, jump : boolean) enterFollowCameraCockpit: function(entity : Engine.Entity) leaveFollowCameraCockpit: function() isFreeCameraMouseAttached: function(): boolean toggleFreeCameraMouseAttachment: function() toggleFreeCamera: function() world2Screen: function(Vec3f): Vec2i screen2World: function(Vec3f): Vec3f getEye: function(): Vec3f getCenter: function(): Vec3f getNearFar: function(): Vec2f getSize: function(): Vec2i traceToTerrain: function(worldPos : Vec3f, farPos : Vec3f, zOffset : number, numSteps : integer): Vec3f | nil endrecord Sound
letVehicleHorn: function(vehicleEntity : Engine.Entity) playRandomSoundEffect: function(paths : {FilePath}) endrecord MusicPlayer
goBack: function() goForward: function() togglePause: function() getTitle: function(): string getArtist: function(): string hasPlaylist: function(): boolean getPlaylistIndex: function(): integer setTrackListFromPlayList: function(playlist : string, startPaused : boolean, offset : number) setPlaylist: function(playlist : string) getPlaylist: function(): string isPlaying: function(): boolean playTrack: function(trackName : string, offset : number) playTrackFile: function(filePath : string, offset : number) getTrackLength: function(): number getTrackElapsedTime: function(): number getGain: function(): number setGain: function(gain : number) setTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) addTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) setContextTag: function(contextTag : string) endrecord VoiceOverManager
stop: function() play: function(voiceOverRes : string, delayInSeconds : number) isPlaying: function(voiceOverRes : string): boolean isPlayingAny: function(): boolean getPlaying: function(): ResName endrecord ByEntity
isLineEmptyOrVisible: function(Engine.Entity : Engine.Entity): boolean isVisible: function(Engine.Entity : Engine.Entity): boolean isVehicleVisible: function(Engine.Entity : Engine.Entity): boolean endrecord ContextHelper
collectSubjectStates: function(idsOfInterest : {string}): {string : SubjectState} getIdsOfActiveTool: function(): {string} endrecord Construction
setAngle: function(angle : number) modify: function(construction : Engine.Entity) getBrushIcons: function(): {string} provideDustWheneverPossible: function(proposal : Proposal, proposalData : ProposalData) getRefundableEntities: function(): {{Engine.Entity, integer}, {Engine.Revision, integer}} updateRefundableEntities: function(resultEntities : {Engine.Entity}, proposal : Proposal.StreetProposal) endrecord Mission
getMission: function(): string getCampaign: function(): string setZone: function(key : string, polygon : {Vec2f}, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) setZoneCircle: function(key : string, center : Vec2f, radius : number, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) removeZone: function(key : string) setMarkerAtPosition: function(key : string, pos : Vec3f, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) setMarkerAtEntity: function(key : string, entity : Engine.Entity, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) removeMarker: function(key : string) setMovePathVisualizationAtEntity: function(key : string, entity : Engine.Entity, color : Vec3f) removeMovePathVisualization: function(key : string) playCutscene: function(filePath : string, resolveLanguageFolder : boolean, entityToEntityMap : {Engine.Entity : Engine.Entity}) isCutscenePlaying: function(): boolean getCutsceneElapsedTime: function(): number endrecord Game
isSavegameUIBlocked: function(): boolean setInGameMenuPause: function(pause : boolean) getGuiSaveData: function(modId : string): {<any type> : <any type>} setGuiSaveData: function(modId : string, data : {<any type> : <any type>}) getEstimatedMaximumGameSpeed: function(): integer isMapEditor: function(): boolean getDefaultSavegameId: function(): string setEnvironment: function(environment : ResName) getEnvironment: function(): ResName endrecord Guide
record GuidePosition
Left: GuidePosition Right: GuidePosition Above: GuidePosition Below: GuidePosition endtrySpawnGuideById: function({GuideTarget}, string, string): boolean trySpawnGuideFree: function(FreeGuidePosition, string, string): boolean completeGuideById: function({GuideTarget}): boolean endrecord GuideTarget
new: function(string, GuidePosition): GuideTarget idOrTag: string position: GuidePosition endrecord Rendering
setEnvironment: function(environment : Environment) getEnvironment: function(): Environment spawnDust: function(bbMin : Vec3f, bbMax : Vec3f, transf : Mat4f) getFrameTime01: function(): number endrecord Map
setMapSeedText: function(seed : string) reloadMaterialIndexManagerPipeline: function() openTerrainEditor: function() closeTerrainEditor: function() endrecord BenchMark
getBeginFrameTimes: function(): {integer} getEventTimes: function(): {integer} getCoreStepTimes: function(): {integer} getRenderTimes: function(): {integer} getSwapTimes: function(): {integer} getReplicateTimes: function(): {SimTime} getCommandTimes: function(): {SimTime} getGameStepTimes: function(): {SimTime} endrecord Achievements
areStatsDisabled: function(): boolean unlockAchievement: function(achievement : string) isAchievementUnlockable: function(achievement : string): boolean isAchievementUnlocked: function(achievement : string): boolean updateStat: function(playerStat : string, value : number) setStat: function(playerStat : string, value : number) getStatValue: function(playerStat : string): number setStatExtraData: function(playerStat : string, data : {<any type> : <any type>}) getStatExtraData: function(playerStat : string): {<any type> : <any type>} setEarnedSFX: function(sfx : {FilePath}) endrecord GenericRep
getAllOfType: function(typeName : string, includeInvisible : boolean): {integer} endmouse: Mouse key: Key dnd: DnD inputAction: InputAction byId: ById camera: Camera sound: Sound musicPlayer: MusicPlayer backend: Backend voiceOverManager: VoiceOverManager byEntity: ByEntity contextHelper: ContextHelper construction: Construction mission: Mission guide: Guide game: Game map: Map benchMark: BenchMark rendering: Rendering debug: Debug achievements: Achievements genericRep: GenericRep StyleSheet: StyleSheet NinePatch: NinePatch endrecord Backend
isInitialized: function(): boolean hasLegalDocuments: function() getLegalDocuments: function(): {PdxLegalDocumentType} isAccountLoggedIn: function(): boolean loginAccount: function(string, string): PdxFuture<PdxLoginResult> logoutAccount: function(): PdxFuture<PdxResult> getAccountInfo: function(): PdxFuture<PdxAccountInfo> getProfile: function(boolean): PdxFuture<PdxProfileResult> createProfile: function(string, boolean): PdxFuture<PdxResult> renameProfile: function(string, boolean): PdxFuture<PdxResult> getCountries: function(): {PdxCountry} getLegalDocument: function(PdxLegalDocumentType): PdxFuture<PdxLegalDocument> createAccount: function(string, string, string, integer, boolean): PdxFuture<PdxResult> supportsAccountLinking: function(): boolean getThirdPartyLinkState: function(): PdxFuture<PdxThirdPartyLinkState> getThirdPartyAutoLoginPromptState: function(): PdxThirdPartyAutoLoginPromptState setThirdPartyAutoLoginPromptState: function(PdxThirdPartyAutoLoginPromptState) linkThirdPartyAccount: function(): PdxFuture<PdxResult> unlinkThirdPartyAccount: function(): PdxFuture<PdxResult> loginThirdPartyAccount: function(): PdxFuture<PdxLoginResult> end
Main GUI interface
Gui.fireReactEvent🔗
function Gui.fireReactEvent(name : string, param : any)
Fire a react event (same as react.fireEvent() but from outside of react)
Parametersname:string— the event nameparam:any— the event parameter
Gui.fireGuiScriptEvent🔗
function Gui.fireGuiScriptEvent(id : string, name : string, param : any): any
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)
id:string— the component idname:string— the event nameparam:any— event-specific parameters
any— the result from the event handler
Gui.HighlightStyle🔗
Gui.HighlightStyle.Square🔗
Gui.HighlightStyle.Square: HighlightStyle
Gui.HighlightStyle.Circle🔗
Gui.HighlightStyle.Circle: HighlightStyle
Gui.SpawnHudImageParams🔗
record Gui.SpawnHudImageParams
iconPath: FilePath color: Vec4f entity: Engine.Entity position: Vec3f end
Gui.SpawnHudImageParams.iconPath🔗
Gui.SpawnHudImageParams.iconPath: FilePath
Mandatory path to the icon
Gui.SpawnHudImageParams.color🔗
Gui.SpawnHudImageParams.color: Vec4f
Optional color. If set, the icon is expected to be grayscale.
Gui.SpawnHudImageParams.entity🔗
Gui.SpawnHudImageParams.entity: Engine.Entity
Optional entity (if not used, specify position)
Gui.SpawnHudImageParams.position🔗
Gui.SpawnHudImageParams.position: Vec3f
Optional position (if not used, position of the entity is used)
Gui.spawnEphemeralHudImage🔗
function Gui.spawnEphemeralHudImage(iconPath : FilePath, entity : Engine.Entity, color : Vec4f, position : Vec3f, overrideDuration : number, fadeIn : boolean, fadeOut : boolean, rev0 : integer)
Spawn a short-lived floating image as a hud-icon
ParametersiconPath:FilePath— The icon to be usedentity: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 secondsfadeIn: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])
Gui.spawnEphemeralHudImageOnPath🔗
function Gui.spawnEphemeralHudImageOnPath(iconPath : FilePath, pos0 : Vec3f, pos1 : Vec3f, pos0 : Vec3f, pos1 : Vec3f, speed : number, scale : number, maxDistance : number)
Spawns a short icon that follows a path
ParametersiconPath:FilePath— The icon to be usedpos0:Vec3f— The starting position of the iconpos1:Vec3f— The end position of the iconpos0:Vec3f— The starting tangent of the iconpos1:Vec3f— The end tangent of the iconspeed:number— The speed (in m/s) of the iconscale:number— A scaling factor for the size of the iconmaxDistance:number— The maximal distance at which the icon will be rendered
Gui.closeAllWindows🔗
function Gui.closeAllWindows()
Close all windows
Gui.SelectionDetails🔗
record Gui.SelectionDetails
new: function(): SelectionDetailsrecord Type
None: Type Line: Type Station: Type Signal: Type Stop: Type Waypoint: Type TransportNetworkEdge: Type World: Type Marker: Type Town: Type endrecord Station
new: function(): Station stationGroup: Engine.Entity flatStationTerminalIndex: integer stationTerminal: StationTerminal endrecord Stop
new: function(): Stop station: SelectionDetails.Station line: Engine.Entity stopIndex: integer endrecord Marker
new: function(): Marker marker: string fireSelectEntity: boolean pos: Vec3f entity: Engine.Entity enddata: DataType endrecord Town
new: function(): Town townEntity: Engine.Entity districtType: LandUseType districtCenter: Vec3f end
Carries details about selection event
Gui.SelectionDetails.new()🔗
function Gui.SelectionDetails.new()(): SelectionDetailsReturns
SelectionDetails
Gui.SelectionDetails.new(SelectionDetails)🔗
function Gui.SelectionDetails.new(SelectionDetails)(SelectionDetails): SelectionDetailsParameters
SelectionDetails
SelectionDetails
Gui.SelectionDetails.Type🔗
Gui.SelectionDetails.Type.None🔗
Gui.SelectionDetails.Type.None: Type
Gui.SelectionDetails.Type.Line🔗
Gui.SelectionDetails.Type.Line: Type
Gui.SelectionDetails.Type.Station🔗
Gui.SelectionDetails.Type.Station: Type
Gui.SelectionDetails.Type.Signal🔗
Gui.SelectionDetails.Type.Signal: Type
Gui.SelectionDetails.Type.Stop🔗
Gui.SelectionDetails.Type.Stop: Type
Gui.SelectionDetails.Type.Waypoint🔗
Gui.SelectionDetails.Type.Waypoint: Type
Gui.SelectionDetails.Type.TransportNetworkEdge🔗
Gui.SelectionDetails.Type.TransportNetworkEdge: Type
Gui.SelectionDetails.Type.World🔗
Gui.SelectionDetails.Type.World: Type
Gui.SelectionDetails.Type.Marker🔗
Gui.SelectionDetails.Type.Marker: Type
Gui.SelectionDetails.Type.Town🔗
Gui.SelectionDetails.Type.Town: Type
Gui.SelectionDetails.DataType🔗
Gui.SelectionDetails.DataType.kind🔗
Gui.SelectionDetails.DataType.kind: Type
Gui.SelectionDetails.Line🔗
Carries details about selection event for a Line.
Gui.SelectionDetails.Line.line🔗
Gui.SelectionDetails.Line.line: Engine.Entity
The line entity
Gui.SelectionDetails.Line.stop🔗
Gui.SelectionDetails.Line.stop: integer
Stop index where the selected line segment starts
Gui.SelectionDetails.Line.waypoint🔗
Gui.SelectionDetails.Line.waypoint: integer
Waypoint index identifying the selected subsegment (-1: no waypoints, 0 = begins at stop, numWaypoints = ends at next stop)
Gui.SelectionDetails.Station🔗
record Gui.SelectionDetails.Station
new: function(): Station stationGroup: Engine.Entity flatStationTerminalIndex: integer stationTerminal: StationTerminal end
Carries details about selection event for a Station, StationGroup or Terminal
Gui.SelectionDetails.Station.new🔗
function Gui.SelectionDetails.Station.new(): StationReturns
Station
Gui.SelectionDetails.Station.stationGroup🔗
Gui.SelectionDetails.Station.stationGroup: Engine.Entity
The station group entity
Gui.SelectionDetails.Station.flatStationTerminalIndex🔗
Gui.SelectionDetails.Station.flatStationTerminalIndex: integer
Index in the the StationGroup's flattened list of station/terminals
Gui.SelectionDetails.Station.stationTerminal🔗
Gui.SelectionDetails.Station.stationTerminal: StationTerminal
Gui.SelectionDetails.Signal🔗
Carries details about selection event for a Signal
Gui.SelectionDetails.Signal.signalList🔗
Gui.SelectionDetails.Signal.signalList: Engine.Entity
The signalList entity
Gui.SelectionDetails.Signal.signalIndex🔗
Gui.SelectionDetails.Signal.signalIndex: integer
Index of the actual signal in the the SignalList
Gui.SelectionDetails.Stop🔗
record Gui.SelectionDetails.Stop
new: function(): Stop station: SelectionDetails.Station line: Engine.Entity stopIndex: integer end
Carries details about selection event for a Stop (terminal) inside a line
Gui.SelectionDetails.Stop.new🔗
function Gui.SelectionDetails.Stop.new(): StopReturns
Stop
Gui.SelectionDetails.Stop.station🔗
Gui.SelectionDetails.Stop.station: SelectionDetails.Station
The station / terminal
Gui.SelectionDetails.Stop.line🔗
Gui.SelectionDetails.Stop.line: Engine.Entity
The line entity
Gui.SelectionDetails.Stop.stopIndex🔗
Gui.SelectionDetails.Stop.stopIndex: integer
Index of the stop in the line
Gui.SelectionDetails.Waypoint🔗
record Gui.SelectionDetails.Waypoint
line: Engine.Entity stopIndex: integer waypointIndex: integer tag: integer end
Carries details about selection event for a waypoint inside a line
Gui.SelectionDetails.Waypoint.line🔗
Gui.SelectionDetails.Waypoint.line: Engine.Entity
The line entity
Gui.SelectionDetails.Waypoint.stopIndex🔗
Gui.SelectionDetails.Waypoint.stopIndex: integer
Index of the stop in the line
Gui.SelectionDetails.Waypoint.waypointIndex🔗
Gui.SelectionDetails.Waypoint.waypointIndex: integer
Index of the waypoint in the line (index in stop.waypoints)
Gui.SelectionDetails.Waypoint.tag🔗
Gui.SelectionDetails.Waypoint.tag: integer
Gui.SelectionDetails.TransportNetworkEdge🔗
record Gui.SelectionDetails.TransportNetworkEdge
new: function(): TransportNetworkEdge snap: EdgePos end
Carries details about selection event for a Transport Network Edge
Gui.SelectionDetails.TransportNetworkEdge.new🔗
function Gui.SelectionDetails.TransportNetworkEdge.new(): TransportNetworkEdgeReturns
TransportNetworkEdge
Gui.SelectionDetails.TransportNetworkEdge.snap🔗
Gui.SelectionDetails.TransportNetworkEdge.snap: EdgePos
Gui.SelectionDetails.World🔗
Carries details about the cursor location in the world.
Gui.SelectionDetails.World.new🔗
function Gui.SelectionDetails.World.new(): WorldReturns
World
Gui.SelectionDetails.World.pos🔗
Gui.SelectionDetails.World.pos: Vec3f
Gui.SelectionDetails.World.water🔗
Gui.SelectionDetails.World.water: boolean
Gui.SelectionDetails.Marker🔗
record Gui.SelectionDetails.Marker
new: function(): Marker marker: string fireSelectEntity: boolean pos: Vec3f entity: Engine.Entity end
Carries details about selection event for a Marker.
Gui.SelectionDetails.Marker.new🔗
function Gui.SelectionDetails.Marker.new(): MarkerReturns
Marker
Gui.SelectionDetails.Marker.marker🔗
Gui.SelectionDetails.Marker.marker: string
Gui.SelectionDetails.Marker.fireSelectEntity🔗
Gui.SelectionDetails.Marker.fireSelectEntity: boolean
If true, select the underlying entity of the marker (default = true)
Gui.SelectionDetails.Marker.pos🔗
Gui.SelectionDetails.Marker.pos: Vec3f
Get the marker position (if it is a position marker)
Gui.SelectionDetails.Marker.entity🔗
Gui.SelectionDetails.Marker.entity: Engine.Entity
Get the marked entity (if it is an entity marker)
Gui.SelectionDetails.Town🔗
record Gui.SelectionDetails.Town
new: function(): Town townEntity: Engine.Entity districtType: LandUseType districtCenter: Vec3f end
Carries details about selection event for a Town.
Gui.SelectionDetails.Town.new🔗
function Gui.SelectionDetails.Town.new(): TownReturns
Town
Gui.SelectionDetails.Town.townEntity🔗
Gui.SelectionDetails.Town.townEntity: Engine.Entity
Gui.SelectionDetails.Town.districtType🔗
Gui.SelectionDetails.Town.districtType: LandUseType
Gui.SelectionDetails.Town.districtCenter🔗
Gui.SelectionDetails.Town.districtCenter: Vec3f
Gui.SelectionDetails.data🔗
Gui.SelectionDetails.data: DataType
Gui.WorldEvent🔗
Gui.WorldEvent.pos🔗
Gui.WorldEvent.pos: {number, number, number}
Gui.WorldEvent.water🔗
Gui.WorldEvent.water: boolean
Gui.Mouse🔗
record Gui.Mouse
getTerrainPosition: function(): Vec3f hasTerrainPosition: function(): boolean endrecord Event
type: Type button: integer x: integer y: integer xrel: integer yrel: integer handled: boolean endrecord Type
Pressed: Type Released: Type Clicked: Type Entered: Type Exited: Type Moved: Type Wheel: Type DoubleClicked: Type PressedOutside: Type end
Gui.Mouse.Event🔗
Represents a mouse event
Gui.Mouse.Event.Type🔗
Gui.Mouse.Event.Type.Pressed🔗
Gui.Mouse.Event.Type.Pressed: Type
Gui.Mouse.Event.Type.Released🔗
Gui.Mouse.Event.Type.Released: Type
Gui.Mouse.Event.Type.Clicked🔗
Gui.Mouse.Event.Type.Clicked: Type
Gui.Mouse.Event.Type.Entered🔗
Gui.Mouse.Event.Type.Entered: Type
Gui.Mouse.Event.Type.Exited🔗
Gui.Mouse.Event.Type.Exited: Type
Gui.Mouse.Event.Type.Moved🔗
Gui.Mouse.Event.Type.Moved: Type
Gui.Mouse.Event.Type.Wheel🔗
Gui.Mouse.Event.Type.Wheel: Type
Gui.Mouse.Event.Type.DoubleClicked🔗
Gui.Mouse.Event.Type.DoubleClicked: Type
Gui.Mouse.Event.Type.PressedOutside🔗
Gui.Mouse.Event.Type.PressedOutside: Type
Gui.Mouse.Event.type🔗
Gui.Mouse.Event.type: Type
Event type.
Gui.Mouse.Event.button🔗
Gui.Mouse.Event.button: integer
Mouse button: 0 = left, 1 = middle, 2 = right.
Gui.Mouse.Event.x🔗
Gui.Mouse.Event.x: integer
Horizontal position of the mouse when event was triggered
Gui.Mouse.Event.y🔗
Gui.Mouse.Event.y: integer
Vertical position of the mouse when event was triggered
Gui.Mouse.Event.xrel🔗
Gui.Mouse.Event.xrel: integer
Relative horizontal movement.
Gui.Mouse.Event.yrel🔗
Gui.Mouse.Event.yrel: integer
Relative vertical movement.
Gui.Mouse.Event.handled🔗
Gui.Mouse.Event.handled: boolean
Whether the event was already handled by a child component.
Gui.Mouse.getTerrainPosition🔗
function Gui.Mouse.getTerrainPosition(): Vec3f
Gets the last valid terrain position pointed by the mouse.
ReturnsVec3f— coordinates of the terrain position
Gui.Mouse.hasTerrainPosition🔗
function Gui.Mouse.hasTerrainPosition(): boolean
Returns whether a valid terrain position is currently available.
Returnsboolean— boolean true if the mouse is pointing at the terrain
Gui.Key🔗
record Gui.Key
endrecord InputEvent
dir: State repeated: boolean isGamepadEvent: function(InputEvent): boolean isKeyboardEvent: function(InputEvent): boolean getKey: function(InputEvent): integer getKeyMod: function(InputEvent): integer end
Gui.Key.State🔗
Gui.Key.State.Up🔗
Gui.Key.State.Up: State
Gui.Key.State.Pressed🔗
Gui.Key.State.Pressed: State
Gui.Key.InputEvent🔗
record Gui.Key.InputEvent
dir: State repeated: boolean isGamepadEvent: function(InputEvent): boolean isKeyboardEvent: function(InputEvent): boolean getKey: function(InputEvent): integer getKeyMod: function(InputEvent): integer end
Gui.Key.InputEvent.dir🔗
Gui.Key.InputEvent.dir: State
Gui.Key.InputEvent.repeated🔗
Gui.Key.InputEvent.repeated: boolean
Gui.Key.InputEvent.isGamepadEvent🔗
function Gui.Key.InputEvent.isGamepadEvent(InputEvent): boolean
Returns whether this is a gamepad event.
ParametersInputEvent
boolean
Gui.Key.InputEvent.isKeyboardEvent🔗
function Gui.Key.InputEvent.isKeyboardEvent(InputEvent): boolean
Returns whether this is a keyboard event.
ParametersInputEvent
boolean
Gui.Key.InputEvent.getKey🔗
function Gui.Key.InputEvent.getKey(InputEvent): integer
Returns the key code.
ParametersInputEvent
integer
Gui.Key.InputEvent.getKeyMod🔗
function Gui.Key.InputEvent.getKeyMod(InputEvent): integer
Returns key modifiers.
ParametersInputEvent
integer
Gui.Key.Event🔗
Represents a key press event.
Gui.Key.Event.data🔗
Gui.Key.Event.data: InputEvent
Gui.Key.Event.isPressed🔗
function Gui.Key.Event.isPressed(Event): boolean
Returns whether the key is pressed.
ParametersEvent
boolean
Gui.DataTransferItem🔗
record Gui.DataTransferItem
new: function(ResName, any): DataTransferItem type: ResName data: any end
Gui.DataTransferItem.new🔗
function Gui.DataTransferItem.new(ResName, any): DataTransferItemParameters
ResNameany
DataTransferItem
Gui.DataTransferItem.type🔗
Gui.DataTransferItem.type: ResName
Gui.DataTransferItem.data🔗
Gui.DataTransferItem.data: any
Gui.DnD🔗
record Gui.DnD
setCursor: function(cursor : integer) addTransferData: function(dragStartEvent : Event, item : DataTransferItem) getAllTransferData: function(): {DataTransferItem} end
Gui.DnD.Event🔗
Represents drag & drop event
Gui.DnD.Event.Type🔗
Gui.DnD.Event.Type.Drop🔗
Gui.DnD.Event.Type.Drop: Type
Gui.DnD.Event.Type.DragStarted🔗
Gui.DnD.Event.Type.DragStarted: Type
Gui.DnD.Event.Type.DragEntered🔗
Gui.DnD.Event.Type.DragEntered: Type
Gui.DnD.Event.Type.DragExited🔗
Gui.DnD.Event.Type.DragExited: Type
Gui.DnD.Event.type🔗
Gui.DnD.Event.type: Type
Event type.
Gui.DnD.setCursor🔗
function Gui.DnD.setCursor(cursor : integer)
Set cursor while dragging (will get reset when a new drag starts).
Parameterscursor:integer— the cursor id
Gui.DnD.addTransferData🔗
function Gui.DnD.addTransferData(dragStartEvent : Event, item : DataTransferItem)
Add transfer data to the current drag & drop operation.
ParametersdragStartEvent:Event— drag start event (must be Event.Type.DragStarted)item:DataTransferItem— transferable item
Gui.DnD.getAllTransferData🔗
function Gui.DnD.getAllTransferData(): {DataTransferItem}
Get current drag & drop data.
Returns{DataTransferItem}— current transfer data list
Gui.InputAction🔗
record Gui.InputAction
record InputActionState
Disabled: InputActionState Inactive: InputActionState Enabled: InputActionState endmodifierOnlyActionIsActive: function(inputActionId : string): boolean hasConflicts: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): string findDuplicatesOf: function(inputActionId : string): {string} getFixedKeyCmdDefs: function(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): {string : {KeyComboDef}} endrecord InvokeData
status: Status endrecord Status
Triggered: Status Repeat: Status PressedStep: Status EndReleased: Status EndAborted: Status end
Gui.InputAction.InputActionState🔗
Gui.InputAction.InputActionState.Disabled🔗
Gui.InputAction.InputActionState.Disabled: InputActionState
Gui.InputAction.InputActionState.Inactive🔗
Gui.InputAction.InputActionState.Inactive: InputActionState
Gui.InputAction.InputActionState.Enabled🔗
Gui.InputAction.InputActionState.Enabled: InputActionState
Gui.InputAction.InvokeData🔗
record Gui.InputAction.InvokeData
status: Status endrecord Status
Triggered: Status Repeat: Status PressedStep: Status EndReleased: Status EndAborted: Status end
Additional info about the invocation of an input action event
Gui.InputAction.InvokeData.Status🔗
Status type of the InputActionInvokeData
Gui.InputAction.InvokeData.Status.Triggered🔗
Gui.InputAction.InvokeData.Status.Triggered: Status
Gui.InputAction.InvokeData.Status.Repeat🔗
Gui.InputAction.InvokeData.Status.Repeat: Status
Gui.InputAction.InvokeData.Status.PressedStep🔗
Gui.InputAction.InvokeData.Status.PressedStep: Status
Gui.InputAction.InvokeData.Status.EndReleased🔗
Gui.InputAction.InvokeData.Status.EndReleased: Status
Gui.InputAction.InvokeData.Status.EndAborted🔗
Gui.InputAction.InvokeData.Status.EndAborted: Status
Gui.InputAction.InvokeData.status🔗
Gui.InputAction.InvokeData.status: Status
status of the action.
Gui.InputAction.modifierOnlyActionIsActive🔗
function Gui.InputAction.modifierOnlyActionIsActive(inputActionId : string): boolean
Checks if a modifier-only action is currently active.
ParametersinputActionId:string— the input action identifier
boolean— True if active.
Gui.InputAction.hasConflicts🔗
function Gui.InputAction.hasConflicts(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): string
Checks for key binding conflicts.
ParameterskeyCmdDefinitions:{string : {KeyComboDef}}— Key command definitions.inputActionId:string— Input action id.keyComboDef:KeyComboDef— Key combo definition.
string— Conflict description (empty if no conflict).
Gui.InputAction.findDuplicatesOf🔗
function Gui.InputAction.findDuplicatesOf(inputActionId : string): {string}
Recursively find list of all IAs that should are duplicates of this one (i.e. duplicateOf == inputActionId and duplicatedKeybindings == true)
ParametersinputActionId:string— Input action id.
{string}— Duplications of the IA
Gui.InputAction.getFixedKeyCmdDefs🔗
function Gui.InputAction.getFixedKeyCmdDefs(keyCmdDefinitions : {string : {KeyComboDef}}, inputActionId : string, keyComboDef : KeyComboDef): {string : {KeyComboDef}}
Resolves key binding conflicts and returns updated key command definitions.
ParameterskeyCmdDefinitions:{string : {KeyComboDef}}— Key command definitions.inputActionId:string— Input action id.keyComboDef:KeyComboDef— Key combo definition.
{string : {KeyComboDef}}— Fixed key command definitions or empty table if change not allowed.
Gui.ById🔗
record Gui.ById
setVisibilityByClass: function(idOrTag : string, visible : boolean, idOnly : boolean) setEnabled: function(idOrTag : string, enabled : boolean, idOnly : boolean) setHighlighted: function(idOrTag : string, highlighted : boolean, style : HighlightStyle, color : Vec3f, idOnly : boolean) isVisible: function(id : string): boolean isVisibleRecursive: function(id : string): boolean setVisible: function(id : string, visible : boolean) resetMovedWindowPosition: function(id : string) getSize: function(id : string): Vec2f end
Gui.ById.setVisibilityByClass🔗
function Gui.ById.setVisibilityByClass(idOrTag : string, visible : boolean, idOnly : boolean)
Shows or hides a component.
ParametersidOrTag:string— the component identifier or a tagvisible:boolean— whether visible or not (nil to reset the ruleidOnly:boolean— idOnly -> do not consider tags
Gui.ById.setEnabled🔗
function Gui.ById.setEnabled(idOrTag : string, enabled : boolean, idOnly : boolean)
Enables or disables a component.
ParametersidOrTag:string— the component identifier or a tagenabled:boolean— whether enabled or not (nil sets to enabled and removes the rule)idOnly:boolean— idOnly -> do not consider tags
Gui.ById.setHighlighted🔗
function Gui.ById.setHighlighted(idOrTag : string, highlighted : boolean, style : HighlightStyle, color : Vec3f, idOnly : boolean)
Sets the highlighted state of a component.
ParametersidOrTag:string— the component identifier or a taghighlighted:boolean— whether highlighted or not (nil sets to not highlighted and removes the rule)style:HighlightStyle— defaults to HighlightStyle::Circlecolor:Vec3f— the color of the highlight, defaults to yellowidOnly:boolean— idOnly -> do not consider tags
Gui.ById.isVisible🔗
function Gui.ById.isVisible(id : string): boolean
Checks if a UI component is visible by its id.
Parametersid:string— the component identifier
boolean— true if the component is visible
Gui.ById.isVisibleRecursive🔗
function Gui.ById.isVisibleRecursive(id : string): boolean
Checks if a UI component and all its parents are visible by id.
Parametersid:string— the component identifier
boolean— true if the component and all parents are visible
Gui.ById.setVisible🔗
function Gui.ById.setVisible(id : string, visible : boolean)
Sets the visibility of a UI component by its ID.
Parametersid:string— the component identifiervisible:boolean— if the component should be visible
Gui.ById.resetMovedWindowPosition🔗
function Gui.ById.resetMovedWindowPosition(id : string)
Resets a window to its original position if it was moved by the user.
Parametersid:string— string id the window identifier
Gui.ById.getSize🔗
function Gui.ById.getSize(id : string): Vec2f
Get width and height of UI component
Parametersid:string— string id the window identifier
Vec2f— width and height
Gui.Camera🔗
record Gui.Camera
setManualCamera: function(center : Vec2f, distance : number) getCameraData: function(): Vec5f setCameraData: function(Vec5f : Vec5f) getHeightAboveTerrain: function(): number focusEntity: function(entity : Engine.Entity) focusPosition: function(position : Vec3f, distance : number) takeScreenshot: function(scale : integer) getFollowEntity: function(): {Engine.Entity, Engine.Revision} followEntity: function(entity : Engine.Entity, jump : boolean) enterFollowCameraCockpit: function(entity : Engine.Entity) leaveFollowCameraCockpit: function() isFreeCameraMouseAttached: function(): boolean toggleFreeCameraMouseAttachment: function() toggleFreeCamera: function() world2Screen: function(Vec3f): Vec2i screen2World: function(Vec3f): Vec3f getEye: function(): Vec3f getCenter: function(): Vec3f getNearFar: function(): Vec2f getSize: function(): Vec2i traceToTerrain: function(worldPos : Vec3f, farPos : Vec3f, zOffset : number, numSteps : integer): Vec3f | nil end
Gui.Camera.setManualCamera🔗
function Gui.Camera.setManualCamera(center : Vec2f, distance : number)
Sets camera to a given position/orientation.
Parameterscenter:Vec2f— position on the map where the camera should point todistance:number— the distance from the position
Gui.Camera.getCameraData🔗
function Gui.Camera.getCameraData(): Vec5f
Obtains the current camera data.
ReturnsVec5f— the current camera data as a Vec5f {center.x, center.y, distance, angle, pitch}
Gui.Camera.setCameraData🔗
function Gui.Camera.setCameraData(Vec5f : Vec5f)
Set the camera data.
ParametersVec5f:Vec5f— set the camera data as a Vec5f {center.x, center.y, distance, angle, pitch}
Gui.Camera.getHeightAboveTerrain🔗
function Gui.Camera.getHeightAboveTerrain(): number
Obtains the current height above terrain.
Returnsnumber— the height of the camera above the terrain
Gui.Camera.focusEntity🔗
function Gui.Camera.focusEntity(entity : Engine.Entity)
Focuses the camera on an entity.
Parametersentity:Engine.Entity— the id of the entity that should be focused on
Gui.Camera.focusPosition🔗
function Gui.Camera.focusPosition(position : Vec3f, distance : number)
Focuses the camera on a position.
Parametersposition:Vec3f— the position that should be focuseddistance:number— the distance of the camera from the target
Gui.Camera.takeScreenshot🔗
function Gui.Camera.takeScreenshot(scale : integer)
Takes a screenshot and stores it in userdata folder
Parametersscale:integer— image resolution
Gui.Camera.getFollowEntity🔗
function Gui.Camera.getFollowEntity(): {Engine.Entity, Engine.Revision}
Gets the entity currently being followed.
Returns{Engine.Entity, Engine.Revision}— the entity being followed (and the entity revision)
Gui.Camera.followEntity🔗
function Gui.Camera.followEntity(entity : Engine.Entity, jump : boolean)
Sets camera to follow an Entity.
Parametersentity:Engine.Entity— the id of the entity that should be followedjump:boolean— true if the camera should directly jump to the entity and not slide there
Gui.Camera.enterFollowCameraCockpit🔗
function Gui.Camera.enterFollowCameraCockpit(entity : Engine.Entity)
Enters the cockpit of an entity.
Parametersentity:Engine.Entity— entity of the object to enter
Gui.Camera.leaveFollowCameraCockpit🔗
function Gui.Camera.leaveFollowCameraCockpit()
Leave the cockpit of an entity.
Gui.Camera.isFreeCameraMouseAttached🔗
function Gui.Camera.isFreeCameraMouseAttached(): boolean
Tells if mouse is attached to free cam or not
Returnsboolean— if mouse is attached (true) or not (false)
Gui.Camera.toggleFreeCameraMouseAttachment🔗
function Gui.Camera.toggleFreeCameraMouseAttachment()
Toggles mouse attachment
Gui.Camera.toggleFreeCamera🔗
function Gui.Camera.toggleFreeCamera()
Toggles free camera
Gui.Camera.world2Screen🔗
function Gui.Camera.world2Screen(Vec3f): Vec2i
Convert a 3D World position into a position on screen (in pixels)
ParametersVec3f
Vec2i
Gui.Camera.screen2World🔗
function Gui.Camera.screen2World(Vec3f): Vec3f
Convert a position on the screen (in pixels) (with depth [0, 1]) into a 3D World position
ParametersVec3f
Vec3f
Gui.Camera.getEye🔗
function Gui.Camera.getEye(): Vec3f
Get camera origin in world coordinates
ReturnsVec3f
Gui.Camera.getCenter🔗
function Gui.Camera.getCenter(): Vec3f
Get camera center ("look-at" pos) in world coordinates
ReturnsVec3f
Gui.Camera.getNearFar🔗
function Gui.Camera.getNearFar(): Vec2f
Get near and far distances of camera in x and y coordinates repsectively
ReturnsVec2f
Gui.Camera.getSize🔗
function Gui.Camera.getSize(): Vec2i
Width and height of the viewport, in pixels
ReturnsVec2i
Gui.Camera.traceToTerrain🔗
function Gui.Camera.traceToTerrain(worldPos : Vec3f, farPos : Vec3f, zOffset : number, numSteps : integer): Vec3f | nil
Trace a ray from worldPos to farPos, and find the intersection (if any) with the terrain, offsetted at zOffset
ParametersworldPos:Vec3f— world position of starting point of rayfarPos:Vec3f— world position of end point of rayzOffset:number— offset to shift the terrain for intersectionnumSteps:integer— number of steps to perform for finding an intersection. more steps are more precise but cost more, 30 is a good compromise
Vec3f | nil
Gui.Sound🔗
record Gui.Sound
letVehicleHorn: function(vehicleEntity : Engine.Entity) playRandomSoundEffect: function(paths : {FilePath}) end
Gui.Sound.letVehicleHorn🔗
function Gui.Sound.letVehicleHorn(vehicleEntity : Engine.Entity)
Sounds the vehicle horn.
ParametersvehicleEntity:Engine.Entity— the vehicle to sound the horn
Gui.Sound.playRandomSoundEffect🔗
function Gui.Sound.playRandomSoundEffect(paths : {FilePath})
Plays a single sound effect randomly selected of the provided selection.
Parameterspaths:{FilePath}— vector of strings paths of sound effects
Gui.MusicPlayer🔗
record Gui.MusicPlayer
goBack: function() goForward: function() togglePause: function() getTitle: function(): string getArtist: function(): string hasPlaylist: function(): boolean getPlaylistIndex: function(): integer setTrackListFromPlayList: function(playlist : string, startPaused : boolean, offset : number) setPlaylist: function(playlist : string) getPlaylist: function(): string isPlaying: function(): boolean playTrack: function(trackName : string, offset : number) playTrackFile: function(filePath : string, offset : number) getTrackLength: function(): number getTrackElapsedTime: function(): number getGain: function(): number setGain: function(gain : number) setTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) addTrackList: function(trackList : {{string, string, boolean}}, enableRepeat : boolean) setContextTag: function(contextTag : string) end
Gui.MusicPlayer.goBack🔗
function Gui.MusicPlayer.goBack()
Goes back to the previous track in the music player.
Gui.MusicPlayer.goForward🔗
function Gui.MusicPlayer.goForward()
Goes forward to the next track in the music player.
Gui.MusicPlayer.togglePause🔗
function Gui.MusicPlayer.togglePause()
Toggles pause/play state of the music player.
Gui.MusicPlayer.getTitle🔗
function Gui.MusicPlayer.getTitle(): string
Gets the title of the currently playing track.
Returnsstring— the track title
Gui.MusicPlayer.getArtist🔗
function Gui.MusicPlayer.getArtist(): string
Gets the artist of the currently playing track.
Returnsstring— the track artist
Gui.MusicPlayer.hasPlaylist🔗
function Gui.MusicPlayer.hasPlaylist(): boolean
Checks if the music player has tracks loaded.
Returnsboolean— true if the music player has tracks
Gui.MusicPlayer.getPlaylistIndex🔗
function Gui.MusicPlayer.getPlaylistIndex(): integer
Gets the current track index (1-based).
Returnsinteger— the current track index
Gui.MusicPlayer.setTrackListFromPlayList🔗
function Gui.MusicPlayer.setTrackListFromPlayList(playlist : string, startPaused : boolean, offset : number)
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.
playlist:string— the playlist resource namestartPaused:boolean— if set, does not play the playlist, just prepares itoffset:number— playback offset in seconds (optional)
Gui.MusicPlayer.setPlaylist🔗
function Gui.MusicPlayer.setPlaylist(playlist : string)
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.
playlist:string— the playlist resource name
Gui.MusicPlayer.getPlaylist🔗
function Gui.MusicPlayer.getPlaylist(): string
Gets the current playlist. Only available while in-game.
Returnsstring— the resource name of the current playlist
Gui.MusicPlayer.isPlaying🔗
function Gui.MusicPlayer.isPlaying(): boolean
Checks if the music player is currently playing.
Returnsboolean— true if music is playing
Gui.MusicPlayer.playTrack🔗
function Gui.MusicPlayer.playTrack(trackName : string, offset : number)
Plays a track by name.
ParameterstrackName:string— the name of the track to playoffset:number— playback offset in seconds (optional)
Gui.MusicPlayer.playTrackFile🔗
function Gui.MusicPlayer.playTrackFile(filePath : string, offset : number)
Plays a specific file that might not be part of the current track list
ParametersfilePath:string— the path to the track fileoffset:number— playback offset in seconds (optional)
Gui.MusicPlayer.getTrackLength🔗
function Gui.MusicPlayer.getTrackLength(): number
Gets the length (duration) of the current track
Returnsnumber— the track duration in second
Gui.MusicPlayer.getTrackElapsedTime🔗
function Gui.MusicPlayer.getTrackElapsedTime(): number
Gets the time of the current track
Returnsnumber— the current time of the current track
Gui.MusicPlayer.getGain🔗
function Gui.MusicPlayer.getGain(): number
Gets the current gain (volume) of the music player.
Returnsnumber— the gain value
Gui.MusicPlayer.setGain🔗
function Gui.MusicPlayer.setGain(gain : number)
Sets the gain (volume) of the music player.
Parametersgain:number— the gain value
Gui.MusicPlayer.setTrackList🔗
function Gui.MusicPlayer.setTrackList(trackList : {{string, string, boolean}}, enableRepeat : boolean)
Sets the track list for the music player, replaces the current track list.
ParameterstrackList:{{string, string, boolean}}— array of tuples containing track name, file path, and repeat flagenableRepeat:boolean— true to enable repeat for the entire list
Gui.MusicPlayer.addTrackList🔗
function Gui.MusicPlayer.addTrackList(trackList : {{string, string, boolean}}, enableRepeat : boolean)
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
trackList:{{string, string, boolean}}— array of tuples containing track name, file path, and repeat flagenableRepeat:boolean— true to enable repeat for the entire list
Gui.MusicPlayer.setContextTag🔗
function Gui.MusicPlayer.setContextTag(contextTag : string)
Sets the context tag for the music player.
The context tag can be used to change the variant of a playing track.
contextTag:string— the context tag to set
Gui.VoiceOverManager🔗
record Gui.VoiceOverManager
stop: function() play: function(voiceOverRes : string, delayInSeconds : number) isPlaying: function(voiceOverRes : string): boolean isPlayingAny: function(): boolean getPlaying: function(): ResName end
Gui.VoiceOverManager.stop🔗
function Gui.VoiceOverManager.stop()
Stops the current voice over playing
Gui.VoiceOverManager.play🔗
function Gui.VoiceOverManager.play(voiceOverRes : string, delayInSeconds : number)
Plays a new voice over
ParametersvoiceOverRes:string— the file path to the voice over to playdelayInSeconds:number— delay before the voice over starts
Gui.VoiceOverManager.isPlaying🔗
function Gui.VoiceOverManager.isPlaying(voiceOverRes : string): boolean
Checks whether a specific voice over is playing
ParametersvoiceOverRes:string— the voice over file to check
boolean— true if the voice over file is playing
Gui.VoiceOverManager.isPlayingAny🔗
function Gui.VoiceOverManager.isPlayingAny(): boolean
Checks whether any voice over is current playing
Returnsboolean— true if any voice over is playing
Gui.VoiceOverManager.getPlaying🔗
function Gui.VoiceOverManager.getPlaying(): ResName
Checks whether any voice over is current playing and returns the file path if one is playing
ReturnsResName— file path if any voice over is playing
Gui.ByEntity🔗
record Gui.ByEntity
isLineEmptyOrVisible: function(Engine.Entity : Engine.Entity): boolean isVisible: function(Engine.Entity : Engine.Entity): boolean isVehicleVisible: function(Engine.Entity : Engine.Entity): boolean end
Gui.ByEntity.isLineEmptyOrVisible🔗
function Gui.ByEntity.isLineEmptyOrVisible(Engine.Entity : Engine.Entity): boolean
Checks if line is empty or visible
ParametersEngine.Entity:Engine.Entity— the line entity to check
boolean— true if the line is empty or visible
Gui.ByEntity.isVisible🔗
function Gui.ByEntity.isVisible(Engine.Entity : Engine.Entity): boolean
Checks if an entity is visible
ParametersEngine.Entity:Engine.Entity— the entity to check
boolean— true if the entity is visible
Gui.ByEntity.isVehicleVisible🔗
function Gui.ByEntity.isVehicleVisible(Engine.Entity : Engine.Entity): boolean
Checks if vehicle is visible
ParametersEngine.Entity:Engine.Entity— the vehicle entity to check
boolean— true if the vehicle is visible
Gui.ContextHelper🔗
record Gui.ContextHelper
collectSubjectStates: function(idsOfInterest : {string}): {string : SubjectState} getIdsOfActiveTool: function(): {string} end
Gui.ContextHelper.SubjectState🔗
Gui.ContextHelper.SubjectState.Visible🔗
Gui.ContextHelper.SubjectState.Visible: SubjectState
Gui.ContextHelper.SubjectState.Focused🔗
Gui.ContextHelper.SubjectState.Focused: SubjectState
Gui.ContextHelper.collectSubjectStates🔗
function Gui.ContextHelper.collectSubjectStates(idsOfInterest : {string}): {string : SubjectState}
Collects subject states for given ids
ParametersidsOfInterest:{string}— ids to collect states for
{string : SubjectState}
Gui.ContextHelper.getIdsOfActiveTool🔗
function Gui.ContextHelper.getIdsOfActiveTool(): {string}Returns
{string}
Gui.Construction🔗
record Gui.Construction
setAngle: function(angle : number) modify: function(construction : Engine.Entity) getBrushIcons: function(): {string} provideDustWheneverPossible: function(proposal : Proposal, proposalData : ProposalData) getRefundableEntities: function(): {{Engine.Entity, integer}, {Engine.Revision, integer}} updateRefundableEntities: function(resultEntities : {Engine.Entity}, proposal : Proposal.StreetProposal) end
Gui.Construction.setAngle🔗
function Gui.Construction.setAngle(angle : number)
Sets the default construction angle for constructions.
Parametersangle:number— the default construction angle
Gui.Construction.modify🔗
function Gui.Construction.modify(construction : Engine.Entity)
Modifies a construction
Parametersconstruction:Engine.Entity— the construction entity
Gui.Construction.getBrushIcons🔗
function Gui.Construction.getBrushIcons(): {string}
Returns brush icons for construction menu
Returns{string}— paths to brush icons for the construction menu
Gui.Construction.provideDustWheneverPossible🔗
function Gui.Construction.provideDustWheneverPossible(proposal : Proposal, proposalData : ProposalData)
Provides dust effects for proposal
Parametersproposal:Proposal— the proposalproposalData:ProposalData— the proposal data
Gui.Construction.getRefundableEntities🔗
function Gui.Construction.getRefundableEntities(): {{Engine.Entity, integer}, {Engine.Revision, integer}}Returns
{{Engine.Entity, integer}, {Engine.Revision, integer}}
Gui.Construction.updateRefundableEntities🔗
function Gui.Construction.updateRefundableEntities(resultEntities : {Engine.Entity}, proposal : Proposal.StreetProposal)
Updates refundable entities
ParametersresultEntities:{Engine.Entity}— result entitiesproposal:Proposal.StreetProposal— the street proposal
Gui.Mission🔗
record Gui.Mission
getMission: function(): string getCampaign: function(): string setZone: function(key : string, polygon : {Vec2f}, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) setZoneCircle: function(key : string, center : Vec2f, radius : number, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number) removeZone: function(key : string) setMarkerAtPosition: function(key : string, pos : Vec3f, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) setMarkerAtEntity: function(key : string, entity : Engine.Entity, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean) removeMarker: function(key : string) setMovePathVisualizationAtEntity: function(key : string, entity : Engine.Entity, color : Vec3f) removeMovePathVisualization: function(key : string) playCutscene: function(filePath : string, resolveLanguageFolder : boolean, entityToEntityMap : {Engine.Entity : Engine.Entity}) isCutscenePlaying: function(): boolean getCutsceneElapsedTime: function(): number end
Gui.Mission.getMission🔗
function Gui.Mission.getMission(): string
Get the current mission
Returnsstring— the mission name
Gui.Mission.getCampaign🔗
function Gui.Mission.getCampaign(): string
Get the current campaign
Returnsstring— the campaign name
Gui.Mission.setZone🔗
function Gui.Mission.setZone(key : string, polygon : {Vec2f}, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number)
Adds a zone
Parameterskey:string— the key (name) of the zonepolygon:{Vec2f}— the shape of the zone as a list of 2d positiondraw:boolean— if the zone should be drawndrawColor:Vec4f— the color of the zoneprohibitBuilding:boolean— if prevented or not to build inside the zoneplayAnimation:boolean— if player zone animation (optional), default to truezOffset:number— (optional), default to terrain level
Gui.Mission.setZoneCircle🔗
function Gui.Mission.setZoneCircle(key : string, center : Vec2f, radius : number, draw : boolean, drawColor : Vec4f, prohibitBuilding : boolean, playAnimation : boolean, zOffset : number)
Adds a zone as a cylinder
Parameterskey:string— the key (name) of the zonecenter:Vec2f— the center of the zoneradius:number— the radius of the zonedraw:boolean— if the zone should be drawndrawColor:Vec4f— the color of the zoneprohibitBuilding:boolean— if prevented or not to build inside the zoneplayAnimation:boolean— if player zone animation (optional), default to truezOffset:number— (optional), default to terrain level
Gui.Mission.removeZone🔗
function Gui.Mission.removeZone(key : string)
Removes a zone
Parameterskey:string— the key of the zone
Gui.Mission.setMarkerAtPosition🔗
function Gui.Mission.setMarkerAtPosition(key : string, pos : Vec3f, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean)
Sets marker at the given position
Parameterskey:string— the key of the markerpos:Vec3f— the position of the markertype:string— type of marker (optional)scaling:number— scaling of marker (optional)isSelectable:boolean— whether marker is selectablefireSelectEntity:boolean— whether selecting the marker also selects the underlying entity (default is true)
Gui.Mission.setMarkerAtEntity🔗
function Gui.Mission.setMarkerAtEntity(key : string, entity : Engine.Entity, type : string, scaling : number, isSelectable : boolean, fireSelectEntity : boolean)
Sets marker at the given entity
Parameterskey:string— the key of the markerentity:Engine.Entity— the entitytype:string— optional typescaling:number— optional scalingisSelectable:boolean— whether marker is selectablefireSelectEntity:boolean— whether selecting the marker also selects the underlying entity (default is true)
Gui.Mission.removeMarker🔗
function Gui.Mission.removeMarker(key : string)
Removes a marker
Parameterskey:string— the key of the marker
Gui.Mission.setMovePathVisualizationAtEntity🔗
function Gui.Mission.setMovePathVisualizationAtEntity(key : string, entity : Engine.Entity, color : Vec3f)
Renderes the move path of an entity dynamically
ATTENTION: at the moment, only ships are supported.
key:string— unique keyentity:Engine.Entity— entitycolor:Vec3f— optional color
Gui.Mission.removeMovePathVisualization🔗
function Gui.Mission.removeMovePathVisualization(key : string)
Removes the move path of an entity dynamically
Parameterskey:string— unique key
Gui.Mission.playCutscene🔗
function Gui.Mission.playCutscene(filePath : string, resolveLanguageFolder : boolean, entityToEntityMap : {Engine.Entity : Engine.Entity})
Plays a cutscene.
ParametersfilePath:string— the filepath to the cutscene keyframe definition that should be playedresolveLanguageFolder:boolean— automatically resolve the selected keyframe file by languageentityToEntityMap:{Engine.Entity : Engine.Entity}— maps entities from the keyframe file to possible runtime entities
Gui.Mission.isCutscenePlaying🔗
function Gui.Mission.isCutscenePlaying(): boolean
Checks if a cutscene is currently playing.
Returnsboolean
Gui.Mission.getCutsceneElapsedTime🔗
function Gui.Mission.getCutsceneElapsedTime(): number
Return the current cutscene time for syncing mission related systems to the cutscene
Returnsnumber— the actual simulated cutscene time
Gui.Game🔗
record Gui.Game
isSavegameUIBlocked: function(): boolean setInGameMenuPause: function(pause : boolean) getGuiSaveData: function(modId : string): {<any type> : <any type>} setGuiSaveData: function(modId : string, data : {<any type> : <any type>}) getEstimatedMaximumGameSpeed: function(): integer isMapEditor: function(): boolean getDefaultSavegameId: function(): string setEnvironment: function(environment : ResName) getEnvironment: function(): ResName end
Gui.Game.isSavegameUIBlocked🔗
function Gui.Game.isSavegameUIBlocked(): boolean
Returns if the UI is blocked by a savegame in progress
Returnsboolean— true if the ui is blocked by a savegame
Gui.Game.setInGameMenuPause🔗
function Gui.Game.setInGameMenuPause(pause : boolean)
Sets if the game pause menu is open
Parameterspause:boolean— true if the user is in the pause menu
Gui.Game.getGuiSaveData🔗
function Gui.Game.getGuiSaveData(modId : string): {<any type> : <any type>}
Returns the GUI SaveData
ParametersmodId:string— the mod to get the user data for
{<any type> : <any type>}— the userData as a lua table
Gui.Game.setGuiSaveData🔗
function Gui.Game.setGuiSaveData(modId : string, data : {<any type> : <any type>})
Sets the GUI SaveData
ParametersmodId:string— the mod to set the user data fordata:{<any type> : <any type>}— the user data
Gui.Game.getEstimatedMaximumGameSpeed🔗
function Gui.Game.getEstimatedMaximumGameSpeed(): integer
Returns the (estimated) maximum possible game speed based on actual simulation timings.
Only available in GUI thread.
integer— maximum game speed (or 0 if not enough data available)
Gui.Game.isMapEditor🔗
function Gui.Game.isMapEditor(): boolean
Returns if the game is currently in the map editor
Returnsboolean— true if in the map editor
Gui.Game.getDefaultSavegameId🔗
function Gui.Game.getDefaultSavegameId(): string
Returns the default savegame id
Returnsstring— the default savegame id
Gui.Game.setEnvironment🔗
function Gui.Game.setEnvironment(environment : ResName)
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.
environment:ResName— the resource name for the environment
Gui.Game.getEnvironment🔗
function Gui.Game.getEnvironment(): ResName
Returns the resource name of the current environment
ReturnsResName— the environment resource name
Gui.Guide🔗
record Gui.Guide
record GuidePosition
Left: GuidePosition Right: GuidePosition Above: GuidePosition Below: GuidePosition endtrySpawnGuideById: function({GuideTarget}, string, string): boolean trySpawnGuideFree: function(FreeGuidePosition, string, string): boolean completeGuideById: function({GuideTarget}): boolean endrecord GuideTarget
new: function(string, GuidePosition): GuideTarget idOrTag: string position: GuidePosition end
Gui.Guide.GuidePosition🔗
Gui positioning of the guide "bookmark" with respect to target component
Gui.Guide.GuidePosition.Left🔗
Gui.Guide.GuidePosition.Left: GuidePosition
Gui.Guide.GuidePosition.Right🔗
Gui.Guide.GuidePosition.Right: GuidePosition
Gui.Guide.GuidePosition.Above🔗
Gui.Guide.GuidePosition.Above: GuidePosition
Gui.Guide.GuidePosition.Below🔗
Gui.Guide.GuidePosition.Below: GuidePosition
Gui.Guide.FreeGuidePosition🔗
Gui positioning of the guide "bookmark" with respect to the entire screen
Gui.Guide.FreeGuidePosition.High🔗
Gui.Guide.FreeGuidePosition.High: FreeGuidePosition
Gui.Guide.FreeGuidePosition.Low🔗
Gui.Guide.FreeGuidePosition.Low: FreeGuidePosition
Gui.Guide.GuideTarget🔗
record Gui.Guide.GuideTarget
new: function(string, GuidePosition): GuideTarget idOrTag: string position: GuidePosition end
A target component for the guide system
Gui.Guide.GuideTarget.new🔗
function Gui.Guide.GuideTarget.new(string, GuidePosition): GuideTargetParameters
stringGuidePosition
GuideTarget
Gui.Guide.GuideTarget.idOrTag🔗
Gui.Guide.GuideTarget.idOrTag: string
Gui.Guide.GuideTarget.position🔗
Gui.Guide.GuideTarget.position: GuidePosition
Gui.Guide.trySpawnGuideById🔗
function Gui.Guide.trySpawnGuideById({GuideTarget}, string, string): booleanParameters
{GuideTarget}stringstring
boolean
Gui.Guide.trySpawnGuideFree🔗
function Gui.Guide.trySpawnGuideFree(FreeGuidePosition, string, string): booleanParameters
FreeGuidePositionstringstring
boolean
Gui.Guide.completeGuideById🔗
function Gui.Guide.completeGuideById({GuideTarget}): booleanParameters
{GuideTarget}
boolean
Gui.Rendering🔗
record Gui.Rendering
setEnvironment: function(environment : Environment) getEnvironment: function(): Environment spawnDust: function(bbMin : Vec3f, bbMax : Vec3f, transf : Mat4f) getFrameTime01: function(): number end
Gui.Rendering.setEnvironment🔗
function Gui.Rendering.setEnvironment(environment : Environment)
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.
environment:Environment— the description for the environment
Gui.Rendering.getEnvironment🔗
function Gui.Rendering.getEnvironment(): Environment
Returns the current environment data
ReturnsEnvironment— the current environment data
Gui.Rendering.spawnDust🔗
function Gui.Rendering.spawnDust(bbMin : Vec3f, bbMax : Vec3f, transf : Mat4f)
Makes a dust cloud appear
ParametersbbMin:Vec3f— bounding box minbbMax:Vec3f— bounding box maxtransf:Mat4f— transformation matrix
Gui.Rendering.getFrameTime01🔗
function Gui.Rendering.getFrameTime01(): numberReturns
number
Gui.Map🔗
record Gui.Map
setMapSeedText: function(seed : string) reloadMaterialIndexManagerPipeline: function() openTerrainEditor: function() closeTerrainEditor: function() end
Gui.Map.setMapSeedText🔗
function Gui.Map.setMapSeedText(seed : string)
Sets seed for the map. Only available in GUI thread.
Parametersseed:string— the seed
Gui.Map.reloadMaterialIndexManagerPipeline🔗
function Gui.Map.reloadMaterialIndexManagerPipeline()
Reloads the material index manager pipeline.
Gui.Map.openTerrainEditor🔗
function Gui.Map.openTerrainEditor()
Gui.Map.closeTerrainEditor🔗
function Gui.Map.closeTerrainEditor()
Gui.BenchMark🔗
record Gui.BenchMark
getBeginFrameTimes: function(): {integer} getEventTimes: function(): {integer} getCoreStepTimes: function(): {integer} getRenderTimes: function(): {integer} getSwapTimes: function(): {integer} getReplicateTimes: function(): {SimTime} getCommandTimes: function(): {SimTime} getGameStepTimes: function(): {SimTime} end
Gui.BenchMark.SimTime🔗
Simulation time frame along with game time at moment of capture
Gui.BenchMark.SimTime.frameTime🔗
Gui.BenchMark.SimTime.frameTime: integer
Gui.BenchMark.SimTime.gameTime🔗
Gui.BenchMark.SimTime.gameTime: integer
Gui.BenchMark.getBeginFrameTimes🔗
function Gui.BenchMark.getBeginFrameTimes(): {integer}
Returns the rendering preparation time
Returns{integer}
Gui.BenchMark.getEventTimes🔗
function Gui.BenchMark.getEventTimes(): {integer}
Returns the events processing time
Returns{integer}
Gui.BenchMark.getCoreStepTimes🔗
function Gui.BenchMark.getCoreStepTimes(): {integer}
Returns the gui update time
Returns{integer}
Gui.BenchMark.getRenderTimes🔗
function Gui.BenchMark.getRenderTimes(): {integer}
Returns the rendering time
Returns{integer}
Gui.BenchMark.getSwapTimes🔗
function Gui.BenchMark.getSwapTimes(): {integer}
Returns the rendering finish time
Returns{integer}
Gui.BenchMark.getReplicateTimes🔗
function Gui.BenchMark.getReplicateTimes(): {SimTime}
Returns the sync time between gui and simulation. Only available in GUI thread.
Returns{SimTime}
Gui.BenchMark.getCommandTimes🔗
function Gui.BenchMark.getCommandTimes(): {SimTime}
Returns commands processing time. Only available in GUI thread.
Returns{SimTime}
Gui.BenchMark.getGameStepTimes🔗
function Gui.BenchMark.getGameStepTimes(): {SimTime}
Returns the simulation update time. Only available in GUI thread.
Returns{SimTime}
Gui.Debug🔗
Gui.Debug.selectEntity🔗
function Gui.Debug.selectEntity(entity : Engine.Entity)
Set the current debug entity
Parametersentity:Engine.Entity— the entity
Gui.Achievements🔗
record Gui.Achievements
areStatsDisabled: function(): boolean unlockAchievement: function(achievement : string) isAchievementUnlockable: function(achievement : string): boolean isAchievementUnlocked: function(achievement : string): boolean updateStat: function(playerStat : string, value : number) setStat: function(playerStat : string, value : number) getStatValue: function(playerStat : string): number setStatExtraData: function(playerStat : string, data : {<any type> : <any type>}) getStatExtraData: function(playerStat : string): {<any type> : <any type>} setEarnedSFX: function(sfx : {FilePath}) end
Gui.Achievements.areStatsDisabled🔗
function Gui.Achievements.areStatsDisabled(): boolean
Checkes whether player stats are disabled
Returnsboolean— true if player stats are disabled
Gui.Achievements.unlockAchievement🔗
function Gui.Achievements.unlockAchievement(achievement : string)
Unlocks an achievement based on its string id
Parametersachievement:string— achievement to unlock
Gui.Achievements.isAchievementUnlockable🔗
function Gui.Achievements.isAchievementUnlockable(achievement : string): boolean
Checks whether an achievement can be unlocked
Parametersachievement:string— achievement to check
boolean— true if the achievement can be unlocked
Gui.Achievements.isAchievementUnlocked🔗
function Gui.Achievements.isAchievementUnlocked(achievement : string): boolean
Checks whether an achievement is unlocked (completed)
Parametersachievement:string— achievement to check
boolean— true if the achievement is unlocked
Gui.Achievements.updateStat🔗
function Gui.Achievements.updateStat(playerStat : string, value : number)
Increments a player stat value by the provided value
ParametersplayerStat:string— the stat id to updatevalue:number— the value to add to the stat
Gui.Achievements.setStat🔗
function Gui.Achievements.setStat(playerStat : string, value : number)
Sets a player stat value, replacing the current value by the provided one
ParametersplayerStat:string— the stat id to updatevalue:number— the value to add to the stat
Gui.Achievements.getStatValue🔗
function Gui.Achievements.getStatValue(playerStat : string): number
Gets a player stat value
ParametersplayerStat:string— the stat id to get
number— the current value of the stat
Gui.Achievements.setStatExtraData🔗
function Gui.Achievements.setStatExtraData(playerStat : string, data : {<any type> : <any type>})
Sets extra data associated with a stat.
Extra data are stored locally in the player profile and allow tracking of more informations if necessary.
playerStat:string— the stat id to set the extra data fordata:{<any type> : <any type>}— the extra data to set
Gui.Achievements.getStatExtraData🔗
function Gui.Achievements.getStatExtraData(playerStat : string): {<any type> : <any type>}
Gets extra data associated with a stat.
Extra data are stored locally in the player profile and allow tracking of more informations if necessary.
playerStat:string— the stat id to get the extra data for
{<any type> : <any type>}— the extra data
Gui.Achievements.setEarnedSFX🔗
function Gui.Achievements.setEarnedSFX(sfx : {FilePath})
Set sound effect(s) to be played when an achievement is earned.
Parameterssfx:{FilePath}— vector of filepaths pointing to .wav files with according sound effect(s)
Gui.GenericRep🔗
record Gui.GenericRep
getAllOfType: function(typeName : string, includeInvisible : boolean): {integer} end
Gui.GenericRep.getAllOfType🔗
function Gui.GenericRep.getAllOfType(typeName : string, includeInvisible : boolean): {integer}
Gets all the Genereic Resource Type of a given type name
Only allows typeName in { "guiresoverwrite", "gui_res" }, for other types, use api.res.genericRep
typeName:string— the type nameincludeInvisible:boolean— whether to include invisible resources
{integer}
Gui.Backend🔗
record Gui.Backend
isInitialized: function(): boolean hasLegalDocuments: function() getLegalDocuments: function(): {PdxLegalDocumentType} isAccountLoggedIn: function(): boolean loginAccount: function(string, string): PdxFuture<PdxLoginResult> logoutAccount: function(): PdxFuture<PdxResult> getAccountInfo: function(): PdxFuture<PdxAccountInfo> getProfile: function(boolean): PdxFuture<PdxProfileResult> createProfile: function(string, boolean): PdxFuture<PdxResult> renameProfile: function(string, boolean): PdxFuture<PdxResult> getCountries: function(): {PdxCountry} getLegalDocument: function(PdxLegalDocumentType): PdxFuture<PdxLegalDocument> createAccount: function(string, string, string, integer, boolean): PdxFuture<PdxResult> supportsAccountLinking: function(): boolean getThirdPartyLinkState: function(): PdxFuture<PdxThirdPartyLinkState> getThirdPartyAutoLoginPromptState: function(): PdxThirdPartyAutoLoginPromptState setThirdPartyAutoLoginPromptState: function(PdxThirdPartyAutoLoginPromptState) linkThirdPartyAccount: function(): PdxFuture<PdxResult> unlinkThirdPartyAccount: function(): PdxFuture<PdxResult> loginThirdPartyAccount: function(): PdxFuture<PdxLoginResult> end
Gui.Backend.LegalDocument🔗
Gui.Backend.LegalDocument.title🔗
Gui.Backend.LegalDocument.title: string
Gui.Backend.LegalDocument.text🔗
Gui.Backend.LegalDocument.text: string
Gui.Backend.isInitialized🔗
function Gui.Backend.isInitialized(): booleanReturns
boolean
Gui.Backend.hasLegalDocuments🔗
function Gui.Backend.hasLegalDocuments()
Gui.Backend.getLegalDocuments🔗
function Gui.Backend.getLegalDocuments(): {PdxLegalDocumentType}Returns
{PdxLegalDocumentType}
Gui.Backend.isAccountLoggedIn🔗
function Gui.Backend.isAccountLoggedIn(): booleanReturns
boolean
Gui.Backend.loginAccount🔗
function Gui.Backend.loginAccount(string, string): PdxFuture<PdxLoginResult>Parameters
stringstring
PdxFuture<PdxLoginResult>
Gui.Backend.logoutAccount🔗
function Gui.Backend.logoutAccount(): PdxFuture<PdxResult>Returns
PdxFuture<PdxResult>
Gui.Backend.getAccountInfo🔗
function Gui.Backend.getAccountInfo(): PdxFuture<PdxAccountInfo>Returns
PdxFuture<PdxAccountInfo>
Gui.Backend.getProfile🔗
function Gui.Backend.getProfile(boolean): PdxFuture<PdxProfileResult>Parameters
boolean
PdxFuture<PdxProfileResult>
Gui.Backend.createProfile🔗
function Gui.Backend.createProfile(string, boolean): PdxFuture<PdxResult>Parameters
stringboolean
PdxFuture<PdxResult>
Gui.Backend.renameProfile🔗
function Gui.Backend.renameProfile(string, boolean): PdxFuture<PdxResult>Parameters
stringboolean
PdxFuture<PdxResult>
Gui.Backend.getCountries🔗
function Gui.Backend.getCountries(): {PdxCountry}Returns
{PdxCountry}
Gui.Backend.getLegalDocument🔗
function Gui.Backend.getLegalDocument(PdxLegalDocumentType): PdxFuture<PdxLegalDocument>Parameters
PdxLegalDocumentType
PdxFuture<PdxLegalDocument>
Gui.Backend.createAccount🔗
function Gui.Backend.createAccount(string, string, string, integer, boolean): PdxFuture<PdxResult>Parameters
stringstringstringintegerboolean
PdxFuture<PdxResult>
Gui.Backend.supportsAccountLinking🔗
function Gui.Backend.supportsAccountLinking(): booleanReturns
boolean
Gui.Backend.getThirdPartyLinkState🔗
function Gui.Backend.getThirdPartyLinkState(): PdxFuture<PdxThirdPartyLinkState>Returns
PdxFuture<PdxThirdPartyLinkState>
Gui.Backend.getThirdPartyAutoLoginPromptState🔗
function Gui.Backend.getThirdPartyAutoLoginPromptState(): PdxThirdPartyAutoLoginPromptStateReturns
PdxThirdPartyAutoLoginPromptState
Gui.Backend.setThirdPartyAutoLoginPromptState🔗
function Gui.Backend.setThirdPartyAutoLoginPromptState(PdxThirdPartyAutoLoginPromptState)Parameters
PdxThirdPartyAutoLoginPromptState
Gui.Backend.linkThirdPartyAccount🔗
function Gui.Backend.linkThirdPartyAccount(): PdxFuture<PdxResult>Returns
PdxFuture<PdxResult>
Gui.Backend.unlinkThirdPartyAccount🔗
function Gui.Backend.unlinkThirdPartyAccount(): PdxFuture<PdxResult>Returns
PdxFuture<PdxResult>
Gui.Backend.loginThirdPartyAccount🔗
function Gui.Backend.loginThirdPartyAccount(): PdxFuture<PdxLoginResult>Returns
PdxFuture<PdxLoginResult>
Gui.mouse🔗
Gui.mouse: Mouse
Gui.key🔗
Gui.key: Key
Gui.dnd🔗
Gui.dnd: DnD
Gui.inputAction🔗
Gui.inputAction: InputAction
Gui.byId🔗
Gui.byId: ById
Gui.camera🔗
Gui.camera: Camera
Gui.sound🔗
Gui.sound: Sound
Gui.musicPlayer🔗
Gui.musicPlayer: MusicPlayer
Gui.backend🔗
Gui.backend: Backend
Gui.voiceOverManager🔗
Gui.voiceOverManager: VoiceOverManager
Gui.byEntity🔗
Gui.byEntity: ByEntity
Gui.contextHelper🔗
Gui.contextHelper: ContextHelper
Gui.construction🔗
Gui.construction: Construction
Gui.mission🔗
Gui.mission: Mission
Gui.guide🔗
Gui.guide: Guide
Gui.game🔗
Gui.game: Game
Gui.map🔗
Gui.map: Map
Gui.benchMark🔗
Gui.benchMark: BenchMark
Gui.rendering🔗
Gui.rendering: Rendering
Gui.debug🔗
Gui.debug: Debug
Gui.achievements🔗
Gui.achievements: Achievements
Gui.genericRep🔗
Gui.genericRep: GenericRep
Gui.StyleSheet🔗
Gui.StyleSheet: StyleSheet
Gui.NinePatch🔗
Gui.NinePatch: NinePatch
Category: globals🔗
NinePatch🔗
global record NinePatch
new: function(): NinePatch fileName: string horizontal: {integer} vertical: {integer} flipHorizontally: boolean repeatHorizontally: boolean repeatVertically: boolean repeatFactor: number end
Nine-patch image description.
NinePatch.new🔗
function NinePatch.new(): NinePatchReturns
NinePatch
NinePatch.fileName🔗
NinePatch.fileName: string
NinePatch.horizontal🔗
NinePatch.horizontal: {integer}
NinePatch.vertical🔗
NinePatch.vertical: {integer}
NinePatch.flipHorizontally🔗
NinePatch.flipHorizontally: boolean
NinePatch.repeatHorizontally🔗
NinePatch.repeatHorizontally: boolean
NinePatch.repeatVertically🔗
NinePatch.repeatVertically: boolean
NinePatch.repeatFactor🔗
NinePatch.repeatFactor: number
Repeat factor (must be positive).
StyleSheet🔗
global record StyleSheet
new: function(): StyleSheet backgroundColor: Vec4f backgroundColor1: Vec4f backgroundColor2: Vec4f backgroundImage1: NinePatch backgroundImage2: NinePatch borderWidth: Vec4f borderColor: Vec4f color: Vec4f size: Vec2f padding: Vec4f fontSize: integer borderImage: NinePatch anchorPoint: Vec2f end
Stylesheet used by GUI components.
StyleSheet.new🔗
function StyleSheet.new(): StyleSheetReturns
StyleSheet
StyleSheet.backgroundColor🔗
StyleSheet.backgroundColor: Vec4f
StyleSheet.backgroundColor1🔗
StyleSheet.backgroundColor1: Vec4f
StyleSheet.backgroundColor2🔗
StyleSheet.backgroundColor2: Vec4f
StyleSheet.backgroundImage1🔗
StyleSheet.backgroundImage1: NinePatch
StyleSheet.backgroundImage2🔗
StyleSheet.backgroundImage2: NinePatch
StyleSheet.borderWidth🔗
StyleSheet.borderWidth: Vec4f
StyleSheet.borderColor🔗
StyleSheet.borderColor: Vec4f
StyleSheet.color🔗
StyleSheet.color: Vec4f
StyleSheet.size🔗
StyleSheet.size: Vec2f
StyleSheet.padding🔗
StyleSheet.padding: Vec4f
StyleSheet.fontSize🔗
StyleSheet.fontSize: integer
StyleSheet.borderImage🔗
StyleSheet.borderImage: NinePatch
StyleSheet.anchorPoint🔗
StyleSheet.anchorPoint: Vec2f