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" as MapEditor

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:43

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:366

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/game_bar/game_bar.tl:680

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

Value Description
"map-editor-generate-heightmap" "Generate Heightmap" window, with an export tab if hasHeightMapExporter is set.In game Generate Heightmap · Generate · Export
"map-editor-import-heightmap" "Import Heightmap" window with height map and biome import tabs (requires hasHeightMapImporter).In game Import Heightmap · Heightmap · Biomes
"map-editor-generate-townsIndustries" "Towns / Industries" window with generator tabs (if enabled) and import and export tabs.In game Towns / Industries · Towns · Industries
"map-editor-generate-street" "Main Connections" window for generating the main street connections.In game Main 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/main/game.tl:356

local toolParam : MapEditor.MapEditorConfig = {
base/content/gui/gui/map_editor/map_editor.tl:2914
function map_editor.prepareWindows(gameCtx : GameContext, config : 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.
hasTownIndustryImporter boolean Whether the import tab for towns and industries is shown. The map editor sets it together with hasIndustryGenerator.
hasTownIndustryExporter boolean Whether the export tab for towns and industries is shown. The map editor sets it together with hasIndustryGenerator.

MapEditor.GlobalState

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

record GlobalState

Notes

State shared by the map editor windows.

Used in the base game: 15 times in 3 files

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({})
base/content/gui/gui/map_editor/map_editor.tl:188
local function setEditorBusy(editorStateRef : ReactRefT<MapEditor.GlobalState>, key : string, inProgress : boolean)

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:27

record MapEditorToolParams is ToolReactUtil.IToolParam

Notes

Tool parameters of MapEditorTool.

Used in the base game: 8 times in 2 files

base/content/gui/gui/game_bar/game_bar.tl:43

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

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.
hasTownIndustryImporter boolean Whether the import tab for towns and industries is shown.
hasTownIndustryExporter boolean Whether the export tab for towns and industries is shown.