Skip to content

map_editor

Source: base/tealdef/gui/map_editor/map_editor.d.tl

Notes

Windows of the map editor for generating or importing the height map, generating towns and industries and generating main connections, loaded with ug_require "/gui/map_editor/map_editor.tl".

MapEditor

record global base/tealdef/gui/map_editor/map_editor.d.tl:3

global record MapEditor

Load: local map_editor = ug_require "/gui/map_editor/map_editor.tl"

Notes

The map editor tools.

Fields

Name Type Description
MapEditorTool ReactToolDefinition<MapEditor.MapEditorToolParams> Tool that shows one of the map editor windows, selected by variant. The windows are created beforehand by prepareWindows and only shown and hidden. used 3× in the base game

Functions

prepareWindows(gameCtx : GameContext, MapEditor.MapEditorConfig) base/tealdef/gui/map_editor/map_editor.d.tl:39

Call as map_editor.prepareWindows

for performance reasons, the windows are created initially and reused later

Used in the base game: 1 time in 1 file

base/content/gui/gui/main/game.tl:364

map_editor.prepareWindows(gameCtx, toolParam)

MapEditor.MapEditorToolVariant

enum base/tealdef/gui/map_editor/map_editor.d.tl:5

enum MapEditorToolVariant

Notes

Which map editor window the tool shows.

Used in the base game: 6 times in 2 files

base/content/gui/gui/map_editor/map_editor.tl:16

local editorWindowIds <total> : {MapEditor.MapEditorToolVariant : string} = {
base/content/gui/gui/game_bar/game_bar.tl:680
variant : MapEditor.MapEditorToolVariant

Value Description
"map-editor-generate-heightmap" "Generate Heightmap" window, with an export tab if hasHeightMapExporter is set.
"map-editor-import-heightmap" "Import Heightmap" window with height map and biome import tabs (requires hasHeightMapImporter).
"map-editor-generate-townsIndustries" "Towns / Industries" window with generator tabs (if enabled) and import and export tabs.
"map-editor-generate-street" "Main Connections" window for generating the main street connections.

MapEditor.MapEditorConfig

record base/tealdef/gui/map_editor/map_editor.d.tl:11

record MapEditorConfig

Notes

Configuration passed to prepareWindows.

Used in the base game: 2 times in 2 files

base/content/gui/gui/map_editor/map_editor.tl:2910

function map_editor.prepareWindows(gameCtx : GameContext, config : MapEditor.MapEditorConfig)
base/content/gui/gui/main/game.tl:356
local toolParam : MapEditor.MapEditorConfig = {

Fields

Name Type Description
mapEditorGlobalStateRef ReactRefT<MapEditor.GlobalState> State shared by all map editor windows.
hasHeightMapImporter boolean Whether height maps can be imported (map editor, not on consoles).
hasHeightMapExporter boolean Whether the height map can be exported (map editor, not on consoles).
hasTownGenerator boolean Whether the town generator tab is shown.
hasIndustryGenerator boolean Whether the industry generator tab is shown.

MapEditor.GlobalState

record base/tealdef/gui/map_editor/map_editor.d.tl:21

record GlobalState

Notes

State shared by the map editor windows.

Used in the base game: 15 times in 3 files

base/content/gui/gui/map_editor/map_editor.tl:188

local function setEditorBusy(editorStateRef : ReactRefT<MapEditor.GlobalState>, key : string, inProgress : boolean)
base/content/gui/gui/game_bar/game_bar.tl:675
mapEditorGlobalStateRef : ReactRefT<MapEditor.GlobalState>
base/content/gui/gui/main/game.tl:332
local mapEditorGlobalStateRef : ReactRefT<MapEditor.GlobalState> = react.useRef({})

Fields

Name Type Description
operationInProgress string Key of the editor tab whose operation (for example a generation) is running; while set, the other tabs are unavailable. nil when idle.

MapEditor.MapEditorToolParams

record base/tealdef/gui/map_editor/map_editor.d.tl:25

record MapEditorToolParams is ToolReactUtil.IToolParam

Notes

Tool parameters of MapEditorTool.

Used in the base game: 8 times in 2 files

base/content/gui/gui/map_editor/map_editor.tl:177

local function getWindowId(param : MapEditor.MapEditorToolParams) : string
base/content/gui/gui/game_bar/game_bar.tl:43
local function pushMapEditorTool(toolParam : MapEditor.MapEditorToolParams)

Fields

Name Type Description
variant MapEditorToolVariant Window to show.
mapEditorGlobalStateRef ReactRefT<MapEditor.GlobalState> State shared by all map editor windows.
hasHeightMapImporter boolean Whether height maps can be imported.
hasHeightMapExporter boolean Whether the height map can be exported.
hasTownGenerator boolean Whether the town generator tab is shown.
hasIndustryGenerator boolean Whether the industry generator tab is shown.