Skip to content

construction_menu

Source: base/tealdef/gui/construction/construction_menu.d.tl

Notes

Shared types of the construction menu: menu tabs and categories, menu entries (ConstructionDefinition), their parameters (ConstructionMenuParam), the parameter API of the menu, HUD icon configuration and custom tool actions.

ConstructionMenu

enum global base/tealdef/gui/construction/construction_menu.d.tl:3

global enum ConstructionMenu

Notes

Top-level tab of the construction menu. Menu categories (menu_category resources) name the tab they belong to.

Value Description
"ROAD" Road transport buildings and tools (stations, depots; categories road_buildings, road_tools, road_assets).
"RAIL" Rail buildings (category rail_buildings).
"WATER" Water transport buildings, tools and assets.
"AIR" Air transport buildings, tools and assets.
"ROADS" Streets and street tools (categories roads_small, roads_medium, roads_large, roads_country, roads_highway, roads_tools, street_constructions).
"TRACKS" Tracks, signals and rail tools (categories tracks, rail_signals, rail_tools, rail_constructions, rail_assets).
"WAREHOUSE" Warehouses (category warehouses).
"PERKS" Company perks (categories perks_mechanics, landmarks, prospections).
"LANDSCAPING" Terrain, ground, vegetation, assets and town buildings (categories landscaping_*, town_buildings_*).
"TOWN" Town tools (category town_tools).
"INDUSTRY" Industries (categories industries, industries_assets).
"BULLDOZER" The bulldozer.
"MODULES" Modules of a modular construction (categories modules_*).
"MODULE_BULLDOZER" The module bulldozer.

ConstructionMenuCategory

record global base/tealdef/gui/construction/construction_menu.d.tl:20

global record ConstructionMenuCategory

Notes

Data of a menu_category resource, a sub tab of a construction menu tab.

Example

-- base/content/gui/gui/construction/menu/modules_categories/landing.res.lua
function data()
    return {
        type = "menu_category",
        data = {
            category = "modules_landing",
            order = 4000,
            name = _("Landing"),
            icon = resolve("landing.tga"),
            menu = "MODULES",
        }
    }
end

Fields

Name Type Description
category string Category id; menu entries reference it in menuCategory.categories[].category.
menu ConstructionMenu Construction menu tab the category is shown in.
name string Display name of the category.
icon ResName Icon of the category tab.
order integer Sort key within the menu tab (ascending); categories without order come after, sorted by name.

ConstructionAvailability

record global base/tealdef/gui/construction/construction_menu.d.tl:28

global record ConstructionAvailability

Notes

Years in which a construction menu entry is available.

Fields

Name Type Description
yearFrom integer First year the entry is available; 0 means no lower limit.
yearTo integer Year from which the entry is no longer available; 0 means no upper limit.

ConstructionMenuParamsAPI

record global base/tealdef/gui/construction/construction_menu.d.tl:33

global record ConstructionMenuParamsAPI

Notes

API of the parameter list of the construction menu (side window or bottom bar), passed to parameter callbacks such as ConstructionMenuParam.onChangeFn.

Details

Parameter values are stored per category index. Parameters with preserveValueInAllCategories are stored under the category index -1.

Functions

setActiveDefinition(definition : ConstructionDefinition, category : integer, categoryId : string) : {string : number} base/tealdef/gui/construction/construction_menu.d.tl:34

Notes

Makes a definition the active one, resets parameters flagged resetOnCategoryChange/resetOnDefinitionChange as needed, and returns the resulting parameter values.

Parameter Type Description
definition ConstructionDefinition Menu entry to activate.
category integer Index of the category (tab).
categoryId string Id of the category; "bulldozer" and "module-bulldozer" defer the category reset until another category is selected.

Returns {string : number}: Parameter values by key.

getParamsForDefinition(definition : ConstructionDefinition, category : integer) : {string : number} base/tealdef/gui/construction/construction_menu.d.tl:35

Notes

Computes the parameter values a definition would get in a category, without activating it.

Returns {string : number}: Parameter values by key.

getStoredValues(category : integer) : {string : number} base/tealdef/gui/construction/construction_menu.d.tl:36

Notes

Returns the stored parameter values of a category.

Parameter Type Description
category integer Category index, or -1 for values preserved in all categories.

Returns {string : number}: Values by parameter key, or nil if none are stored.

changeParam(index : integer, value : number) base/tealdef/gui/construction/construction_menu.d.tl:37

Notes

Sets the value of a parameter of the active definition.

Parameter Type Description
index integer Position of the parameter in the current parameter list.
value number New value (option index, or slider value).

setParamDisabled(index : integer, disabled : boolean) base/tealdef/gui/construction/construction_menu.d.tl:38

Notes

Disables or enables a parameter in addition to its own checkEnabledFn. Cleared when another definition is activated.

Parameter Type Description
index integer Position of the parameter in the current parameter list.
disabled boolean true to disable the parameter.

isParamActive(key : string) : boolean base/tealdef/gui/construction/construction_menu.d.tl:39

Notes

Tells whether the parameter with the given key exists for the active definition and is neither hidden nor disabled.

Returns boolean

getParam(index : integer) : ConstructionMenuParam base/tealdef/gui/construction/construction_menu.d.tl:40

Notes

Returns the parameter at a position of the current parameter list, or nil.

Returns ConstructionMenuParam

getCategory() : integer base/tealdef/gui/construction/construction_menu.d.tl:41

Notes

Returns the index of the current category.

Returns integer

getParamByKey(key : string) : ConstructionMenuParamInfo base/tealdef/gui/construction/construction_menu.d.tl:42

Notes

Looks up a parameter of the active definition by key.

Returns ConstructionMenuParamInfo: Its position, definition and current value, or nil if the active definition has no such parameter.

updateVisibility() base/tealdef/gui/construction/construction_menu.d.tl:43

Notes

Shows or hides the parameter window depending on whether there are parameters to show (no effect for the bottom bar).

getCurrentParams() : {string : number} base/tealdef/gui/construction/construction_menu.d.tl:44

Notes

Returns the current parameter values by key.

Returns {string : number}

onInfoPopupVisibilityChange(visible : boolean) base/tealdef/gui/construction/construction_menu.d.tl:45

No description in the game files yet.

ConstructionMenuParam

record global base/tealdef/gui/construction/construction_menu.d.tl:48

global record ConstructionMenuParam

Notes

A parameter of a construction menu entry, shown in the parameter window or the toolbar.

Details

Script parameters of construction descriptions are converted into this type by ConstructionReactUtil.convertScriptParamsToMenuParams; built-in tools create them directly. A parameter's value is a 1-based index into values (or numbers).

Fields

Name Type Description
key string Key of the parameter in the parameter value table.
name string Display name.
tooltip string Tooltip of the parameter.
values {string} Display values (or image paths for icon buttons), one per option.
numbers {number} Numeric values for slider parameters, used instead of values.
defaultIndex Index Index of the default value.
uiType ScriptParamType Widget type of the parameter.
iconStyle ScriptParamUtil.ParamForUi.IconStyle
location ScriptParamLocation Where the parameter is shown (parameter window or toolbar).
displayMode ScriptParamDisplayMode Display mode of the parameter widget.
yearFrom integer First year the parameter is available; 0 means no lower limit.
yearTo integer Year from which the parameter is no longer available; 0 means no upper limit.
group string Group name; consecutive parameters of the same group are shown together, with a separator between groups.
tooltips {string} Tooltip per value.
hideLabel boolean Hides the parameter's label.
resetOnCategoryChange boolean Resets the value to the default when the category changes.
resetOnMenuClose boolean Resets the value to the default when the construction menu closes.
resetOnDefinitionChange boolean Resets the value to the default when another entry is selected.
preserveValueInAllCategories boolean Shares one stored value across all categories (stored under category -1).
constructionParam boolean Marks a parameter as a parameter of the construction itself; only such parameters are passed to the construction builder. Set for all converted script parameters.
id string

Functions

new() : ConstructionMenuParam base/tealdef/gui/construction/construction_menu.d.tl:49

Notes

Creates a new, empty ConstructionMenuParam.

Returns ConstructionMenuParam

onChangeFn(newValue : number, paramsApi : ConstructionMenuParamsAPI, oldValue? : number) base/tealdef/gui/construction/construction_menu.d.tl:76

Notes

Called after the parameter's value changed.

checkEnabledFn(params : {string : number}) : ConstructionMenuParam.CheckEnabledResult base/tealdef/gui/construction/construction_menu.d.tl:77

Notes

Decides from the current parameter values whether the parameter is enabled, disabled or hidden. For script parameters it calls the parameter's checkEnabledScript.

Returns ConstructionMenuParam.CheckEnabledResult

makeCompactButtonFn(value : number) : TreeNodeId base/tealdef/gui/construction/construction_menu.d.tl:78

Notes

Creates the compact button for a value; for script parameters with images it shows the matching image.

Returns TreeNodeId

formatValueFn(value : number) : string base/tealdef/gui/construction/construction_menu.d.tl:79

Notes

Formats a value for display; for script parameters it calls formatValueScript.

Returns string

getImageFn(value : integer) : string base/tealdef/gui/construction/construction_menu.d.tl:80

Notes

Returns the image path for a value.

Returns string

stepValueFn(value : number, direction : integer, precise : boolean) : number base/tealdef/gui/construction/construction_menu.d.tl:81

Notes

Returns the next value when the parameter is stepped (key binding or gamepad) in direction; precise is set while the precision modifier is held. For script parameters it calls stepValueScript, otherwise it steps through the values.

Returns number

getFilterObjectsFn() : {MenuCategoryUtil.FilterObject}, integer base/tealdef/gui/construction/construction_menu.d.tl:83

Notes

Returns the selectable objects (and the default index) of an object-filter parameter, such as the bridge, tunnel or railroad crossing type of the street and track builders.

Returns {MenuCategoryUtil.FilterObject}, integer

ConstructionMenuParam.CheckEnabledResult

enum base/tealdef/gui/construction/construction_menu.d.tl:69

enum CheckEnabledResult

Notes

Result of checkEnabledFn, the state of a parameter for the current parameter values.

Used in the base game: 41 times in 2 files

base/content/gui/gui/construction/construction.tl:1463

local refDisabledParams = react.useRef({}) as ReactRefT<{ConstructionMenuParam.CheckEnabledResult}>
base/content/gui/gui/construction/construction_react_util.tl:658
checkEnabledFn? : (function(params : {string : number}) : ConstructionMenuParam.CheckEnabledResult), defaultUnderground? : boolean) : ConstructionMenuParam

Value Description
"Enabled" Shown and usable.
"Hidden" Not shown.
"Disabled" Shown but not usable.
"InputActionOnly" Not shown in the parameter list; the base game uses it for parameters that are only changed through input actions (for example the brush eraser mode).

ConstructionMenuParamInfo

record global base/tealdef/gui/construction/construction_menu.d.tl:97

global record ConstructionMenuParamInfo

Notes

A parameter of the active definition with its position and current value, as returned by ConstructionMenuParamsAPI.getParamByKey.

Fields

Name Type Description
index integer Position in the current parameter list (use with changeParam).
param ConstructionMenuParam The parameter.
value number Its current value.

ConstructionMenuAction

enum global base/tealdef/gui/construction/construction_menu.d.tl:103

global enum ConstructionMenuAction

Notes

Kind of action a construction menu entry starts; selects which built-in construction action is configured.

Value Description
"ACTION_CONSTRUCTION_BUILDER" Places a construction (constructions, optionally constructionTemplate).
"ACTION_STREET_BUILDER_UPGRADER" Builds or upgrades streets.
"ACTION_STREET_TERMINAL_BUILDER" Places an edge object construction (street terminal) on a street.
"ACTION_BUS_LANE_TOOL" Bus lane tool (upgrades roads with bus lanes).
"ACTION_TRAM_TRACK_TOOL" Tram track tool (upgrades roads with tram tracks).
"ACTION_PLAYER_OWNED_TOOL" Locking tool (marks roads as locked and player owned).
"ACTION_TRAFFIC_LIGHT_TOOL" Traffic light tool (enables or disables traffic lights on crossings).
"ACTION_LANE_MODIFIER_TOOL" Crossing tool (changes road and tram lanes at crossings).
"ACTION_CROSSWALK_MODIFIER_TOOL" Crosswalk tool (enables or disables crosswalks).
"ACTION_TRACK_BUILDER_UPGRADER" Builds or upgrades tracks.
"ACTION_TRACK_ELECTRIFICATION_TOOL" Electrification tool (adds catenary to tracks).
"ACTION_TRACK_EDGE_DECORATION_TOOL" Applies an edge decoration (resIndex) to tracks.
"ACTION_TERRAIN_MODIFIER_SMOOTH_TOOL" Smooth terrain tool.
"ACTION_TERRAIN_MODIFIER_FLATTEN_TOOL" Flatten terrain tool.
"ACTION_TERRAIN_MODIFIER_RAISE_TOOL" Raise terrain tool.
"ACTION_TERRAIN_MODIFIER_LOWER_TOOL" Lower terrain tool.
"ACTION_TERRAIN_MODIFIER_HEIGHTMAP_TOOL" Roughen terrain tool (modifies the terrain with a heightmap texture).
"ACTION_TERRAIN_PAINTER" Paints a terrain material (resIndex, 0 is the eraser).
"ACTION_ASSET_BRUSH" Brush that places or erases assets such as trees, plants and rocks.
"ACTION_TOWN_BUILDER" Town builder.
"ACTION_TOWN_BUILDER_EXPERIMENTAL" Experimental town builder.
"ACTION_BULLDOZER" The bulldozer.
"ACTION_MODULE_BUILDER" Places a module of a modular construction.
"ACTION_MODULE_BULLDOZER" Removes modules.
"ACTION_MARKETING" Marketing campaign perk.
"ACTION_ECO_INDUSTRY" Industry greenification perk.
"ACTION_PROSPECTION" Prospection perk.
"ACTION_CUSTOM"

ConstructionActionCustomHudIcons

enum global base/tealdef/gui/construction/construction_menu.d.tl:134

global enum ConstructionActionCustomHudIcons

Notes

Extra HUD icons a construction action can show.

Value Description
"MAINTENANCE_STATION" Shows the maintenance pool progress bar on vehicle depots that have a maintenance pool.

ConstructionActionHudIconStationType

enum global base/tealdef/gui/construction/construction_menu.d.tl:138

global enum ConstructionActionHudIconStationType

Notes

Restricts station HUD icons to cargo or passenger stations.

Value Description
"CARGO" Only cargo stations.
"PASSENGER" Only passenger stations.

ConstructionActionHudIconConstructionType

enum global base/tealdef/gui/construction/construction_menu.d.tl:143

global enum ConstructionActionHudIconConstructionType

Notes

Restricts station and depot HUD icons to a carrier.

Value Description
"ROAD" also includes TRAM
"TRAM" Tram stations and depots.
"RAIL" Rail stations and depots.
"WATER" Water stations and depots.

ConstructionActionHudIconParams

record global base/tealdef/gui/construction/construction_menu.d.tl:150

global record ConstructionActionHudIconParams

Notes

User parameters of the HUD icon master used while a construction action is active.

Fields

Name Type Description
defaultIcons {Engine.ComponentType} Component types whose entities get HUD icons (filled from ConstructionActionHudIcons.componentTypes).
customIcons {ConstructionActionCustomHudIcons} Extra icons to show.
stationType ConstructionActionHudIconStationType Shows station icons only for stations of this type.
constructionType ConstructionActionHudIconConstructionType Shows station and depot icons only for this carrier.
depotType ConstructionActionHudIconConstructionType Carrier filter for depots; overrides constructionType for depots.
showPerksAndTowns boolean Shows only town icons and custom HUD icons of landmark constructions (hudIconScript) instead of the default icons.

Functions

accessNotificationCacheFn(entity : Engine.Entity) : {Notification} base/tealdef/gui/construction/construction_menu.d.tl:156

Notes

Returns the notifications of an entity (from the game context).

Returns {Notification}

ConstructionActionHudIcons

record global base/tealdef/gui/construction/construction_menu.d.tl:160

global record ConstructionActionHudIcons

Notes

HUD icon configuration of a construction menu entry. Construction descriptions set it through configureHudIconsScript.

Example

-- base/content/gui/gui/construction/construction_desc_hud_icons.script.tl
configureIndustryHudIconsFn = function() : ConstructionActionHudIcons
    return {
        componentTypes = {
            api.type.ComponentType.INDUSTRY,
            api.type.ComponentType.TOWN,
        },
    }
end,

Fields

Name Type Description
componentTypes {Engine.ComponentType} Component types whose entities show HUD icons while the action is active.
showDistricts boolean default nil/false -- note: true is only working, when componentTypes contains TOWN!!
showTownBorders boolean default nil/false -- note: true is only working, when componentTypes contains TOWN!!
showPerksAndTowns boolean default nil/false -- note: true is only working, when componentTypes contains TOWN!!
params ConstructionActionHudIconParams Extra parameters for the HUD icon master.

ConstructionCustomActionParams

record global base/tealdef/gui/construction/construction_menu.d.tl:168

global record ConstructionCustomActionParams<P>

Notes

Parameters passed to the recipe of a custom construction action (ConstructionDefinition.customAction).

Fields

Name Type Description
gameCtx GameContext Game context.
definition ConstructionDefinition The menu entry the action belongs to.
customParam P The customParam of the custom action.
isActive boolean Whether the action is currently active.

Functions

abort() base/tealdef/gui/construction/construction_menu.d.tl:173

Notes

Aborts the action.

setActionFn(fn : (function() : TreeNodeId), key2? : string) base/tealdef/gui/construction/construction_menu.d.tl:174

Notes

Binds the function that creates the action's tree node (for example an ActionDescriptor) to the menu entry; key2 identifies the bound function.

getCurrentParams() : {string : number} base/tealdef/gui/construction/construction_menu.d.tl:175

Notes

Returns the current parameter values of the menu.

Returns {string : number}

ConstructionCustomAction

record global base/tealdef/gui/construction/construction_menu.d.tl:178

global record ConstructionCustomAction<P>

Notes

A custom action of a construction menu entry; create one for perk tools with ConstructionReactUtil.RegisterCustomSelectorBasedActionRecipe.

Fields

Name Type Description
recipe Recipe<ConstructionCustomActionParams<P>> Recipe that implements the action.
customParam P Value passed to the recipe as customParam.

SelectorBasedActionHoverResult

record global base/tealdef/gui/construction/construction_menu.d.tl:183

global record SelectorBasedActionHoverResult

Notes

Result of RegisterCustomSelectorBasedActionRecipeParams.onHover.

Fields

Name Type Description
param Builtin.ActionTooltipParam<any> Tooltip to show (recipe and parameters), for example with ConstructionReactUtil.SimpleTooltipRecipe.
mouseCursor integer Mouse cursor id, for example from gui_react_util.getMouseCursorInteger("CompanyMechanics").

RegisterCustomSelectorBasedActionRecipeParams

record global base/tealdef/gui/construction/construction_menu.d.tl:188

global record RegisterCustomSelectorBasedActionRecipeParams<P>

Notes

Callbacks of a custom action that selects an entity on the map, for ConstructionReactUtil.RegisterCustomSelectorBasedActionRecipe.

Fields

Name Type Description
isActive boolean

Functions

isAvailable(params : ConstructionCustomActionParams<P>) : boolean base/tealdef/gui/construction/construction_menu.d.tl:189

Notes

Returns whether selecting is currently allowed; without it the action is always available.

Returns boolean

onHover(ConstructionCustomActionParams<P>, entity : Engine.Entity, indices : {integer}, details : Gui.SelectionDetails) : SelectorBasedActionHoverResult base/tealdef/gui/construction/construction_menu.d.tl:191

Notes

Called when an entity is hovered; returns the tooltip and cursor to show, or nil to clear them.

Returns SelectorBasedActionHoverResult

onSelect(ConstructionCustomActionParams<P>, entity : Engine.Entity) base/tealdef/gui/construction/construction_menu.d.tl:192

Notes

Called when the hovered entity is selected (click or IA_APPLY) and the action is available.

filter(entity : Engine.Entity) base/tealdef/gui/construction/construction_menu.d.tl:193

Notes

Filter of the selector; decides which entities can be hovered.

IconWithAvailability

record global base/tealdef/gui/construction/construction_menu.d.tl:196

global record IconWithAvailability

Notes

Icon of a construction menu entry.

Fields

Name Type Description
icon string Icon path.
lockedIcon string Icon shown while the entry is locked (company rank too low).
yearFrom {{integer, string}} List of {year, iconPath} pairs in ascending year order; the last entry whose year has been reached is shown. Overrides icon.

ConstructionDefinition

record global base/tealdef/gui/construction/construction_menu.d.tl:202

global record ConstructionDefinition

Notes

An entry of the construction menu. The menu builds these from constructions, streets, tracks, modules, terrain materials, edge decorations and construction_tool resources.

Details

A construction_tool resource returns its entry from getDefinitionFn (see ConstructionToolData); the base game's perk tools in gui/construction/tools/ are examples.

Fields

Name Type Description
action ConstructionMenuAction Kind of action the entry starts.
resName ResName Resource name of the entry (construction, street type, module, ...).
constructions {ResName} Constructions placed by ACTION_CONSTRUCTION_BUILDER.
builderAudioRes {ResName} Builder audio resources (*.builder_audio) used for the action's sounds.
resIndex integer for terrainPainter
icon IconWithAvailability Icon in the menu list. used 1× in the base game
previewIcon IconWithAvailability Preview image in the info panel.
name string Display name.
description string Description text.
params {ConstructionMenuParam} Parameters of the entry.
categories {string} Filter categories of the entry within its menu category.
availability ConstructionAvailability Years in which the entry is available.
placementTag string
metadata ConstructionDescMetadata Construction description metadata (company perks, emissions, track description, ...); read by the info panel.
constructionTemplate integer Zero-based index of the construction template, or -1 for none.
hudIcons ConstructionActionHudIcons HUD icons shown while the action is active.
showInAllCategories boolean Shows the entry regardless of the selected filter category.
disabled DefinitionDisabled When set, the entry is shown as disabled with its message, and its action is not started unless keepDisabledActive is set.
terrainContours boolean Shows terrain contour lines while the action is active.
navigableWater boolean Colors navigable water while the action is active.
configureLayerScript ScriptRef Script that adjusts the layer configuration of the action (called with its params, the layer config and the current parameter values).
configureHudIconsScript ScriptRef Script that returns the ConstructionActionHudIcons.
customAction ConstructionCustomAction<any> Custom action implemented by a recipe; when set, the menu runs this recipe for the entry. The base game uses it for the prospection, marketing and industry greenification perks.
order integer Sort order (set for edge decorations).
attributes {string : {number, number}} Attribute ranges shown in the info panel (for example cost, maintenanceCost, noise), each {min, max}.
attributesCostPerKm boolean Shows costs and emissions per km (per mile in imperial units), as for streets and tracks.
costsYearProgression boolean Adjusts the displayed costs to the current year.
cargoTypeSet CargoTypeSet Cargo types the construction handles, shown in the info panel.
keepDisabledActive boolean Keeps the action running while the entry is disabled (used for modules).
showNumRemaining boolean Shows how many uses of the company permit remain (landmarks and headquarters).
numRemaining integer Fixed number of remaining uses to show, instead of computing it.
menuCategory ModelMetadata.MenuCategory Menu categories (with order and filter categories) the entry is listed in.
moduleType string Module type, for module entries.
categoryList ModelMetadata.CategoryList Category list of the entry; climate categories (*clima*) are shown as climate specializations in the info panel.

ConstructionDefinition.DefinitionDisabled

record base/tealdef/gui/construction/construction_menu.d.tl:203

record DefinitionDisabled

Notes

Marks an entry as disabled.

Used in the base game: 1 time in 1 file

base/content/gui/gui/construction/construction.tl:4181

local disabled : ConstructionDefinition.DefinitionDisabled = nil

Fields

Name Type Description
message string Reason shown for the disabled entry.

ConstructionMenuActionParams

record global base/tealdef/gui/construction/construction_menu.d.tl:245

global record ConstructionMenuActionParams

Notes

Everything the construction menu needs to run the action of an entry, returned by ConstructionReactUtil.getActionParams.

Fields

Name Type Description
constructionActionParams Builtin.ConstructionActionParam Parameters of the built-in construction action.
hudIconManagerParams Builtin.HudIconManagerConfigParam<ConstructionActionHudIconParams> HUD icon manager configuration, or nil if the entry has no HUD icons.
layerConfig LayerConfig Layer configuration while the action is active.

ConstructionMenuModuleCategory

record global base/tealdef/gui/construction/construction_menu.d.tl:251

global record ConstructionMenuModuleCategory

No description in the game files yet.

Fields

Name Type Description
categoryName string
category string
icon string
modules {{string, ModuleDesc}}
typeAvailability {string : ConstructionAvailability}

ConstructionActionRepository

record global base/tealdef/gui/construction/construction_menu.d.tl:259

global record ConstructionActionRepository

Notes

Data shared by all construction menu entries, created by ConstructionReactUtil.getConstructionActionRepository.

Fields

Name Type Description
terrainModifierHeightmaps {integer} Resource ids of all stamp resources (heightmap stamps).
cargoTypes {CargoTypeId} Cargo type ids in menu order.
landUse2CargoTypes {LandUseType : {CargoTypeId}} Cargo types per land use type (from api.engine.util.town.getLandUse2CargoTypes()).
terrainToolData ConstructionToolParam.TerrainToolData Size data of the terrain tools.
hasHeightMapTextureTool boolean Whether the heightmap texture tool is available.

ConstructionToolData

record global base/tealdef/gui/construction/construction_menu.d.tl:267

global record ConstructionToolData

Notes

Data of a construction_tool resource, which adds an entry to the construction menu.

Example

-- base/content/gui/gui/construction/tools/industry_greenify_tool.res.lua
function data()
    return {
        type = "construction_tool",
        data = {
            getDefinitionFn = {
                fileName = resolve("industry_greenify_tool.script@getDefinition"),
            }
        }
    }
end

Fields

Name Type Description
getDefinitionFn ScriptRef Script function (resName, repository, params) -> ConstructionDefinition that returns the menu entry; a nil result adds nothing.
isDisabledFn ScriptRef Optional script function (resName, repository, params) -> boolean; when it returns true the tool is left out of the menu.