Skip to content

entity_window_util

Source: base/tealdef/gui/entity_window/entity_window_util.d.tl

Notes

Shared React recipes and helpers for the entity windows (info windows of vehicles, stations, industries, towns, persons ...): stock bars, charts, action button bars, rating and progress bars, person tables, notification cards. Loaded with ug_require "/gui/entity_window/entity_window_util.tl".

Globals

Types

Name Definition Description
PopoverReactUtil declared here, defined in PopoverReactUtil Popover window recipes.

EntityWindowUtil

record global base/tealdef/gui/entity_window/entity_window_util.d.tl:5

global record EntityWindowUtil

Load: local entity_window_util = ug_require "/gui/entity_window/entity_window_util.tl"

Notes

Library of React recipes and helper functions shared by the entity windows.

Details

Most members are recipes (Recipe<...>): call them with their parameter record to get a TreeNodeId, e.g. entity_window_util.ProgressDisplay{ value = 0.5, text = "50%" }. Many of them poll engine state every step with engine_react_util.useStepState.

Fields

Name Type Description
VehicleCell Recipe<Builtin.TableCellParam> Table cell recipe showing the vehicle name and vehicle icon of the row's vehicle as a button that selects (opens) the vehicle. used 1× in the base game
VehicleTable Recipe<VehicleTableParams> Sortable data table of vehicles; rows come from getVehicleEntities and are refreshed every step. used 1× in the base game
VehicleCondition Recipe<VehicleConditionParams> Progress bar of the average vehicle condition (maintenance state) with condition text and trend arrow. used 1× in the base game
MaintenanceBar Recipe<MaintenanceBarParam> Info callout showing the upkeep or running cost of an entity per period: station group maintenance, vehicle running cost, or the scaled maintenance of a construction (or the parent construction of a subconstruction). Renders nothing when the cost is 0. used 5× in the base game
MaintenanceStationPoolProgressBar Recipe<MaintenanceStationPoolProgressBarParams> Progress bar of the vehicles assigned to a maintenance station against its maintenance pool size; shows "No Maintenance Pool" when the pool is 0. used 3× in the base game
EntityStockCountsWidget Recipe<StockCountsWidgetParams> List of an entity's stocks grouped by cargo class specialization, each with cargo icons, stored/capacity text and a fill bar. used 1× in the base game
CombinedStockGroupedCounts Recipe<CombinedStockGroupedCountsParam> "Input Stocks" and "Output Stocks" content cards of an entity's stock list, with compact cargo counts and an optional collapsible part. used 3× in the base game
EntityDiagramWidget Recipe<DiagramParams> Chart of an entity's logbook or account history with optional legend and time scale slider; refreshed every step. used 17× in the base game
EntityWindowButton Recipe<EntityWindowButtonParams> Icon button with tooltip.
ActionButtonBar Recipe<ActionButtonBarParams> Horizontal bar of primary buttons (icon and text) followed by secondary icon buttons. used 8× in the base game
PersonCapacityWidget Recipe<WorkplacesProgressBarWidgetParams> Person icon (tooltip "Residents", "Customers" or "Workers" by land use type) followed by a WorkplacesProgressBarWidget. used 2× in the base game
SimPersonDestinationButton Recipe<SimPersonDestinationButtonParams> Button with the destination icon that selects the sim person's destination entity of the given destination index.
InhabitantsTable Recipe<InhabitantsTableParam> Table of the sim persons of a building (name, satisfaction, whether currently there or on the way, move mode for non-residential); shows a public transport hint when empty. used 3× in the base game
WorkersTable Recipe<WorkersTableParam> Table of the workers (visitors) of an entity with the time each has left; shows a public transport hint when empty. used 2× in the base game
EnterCockpitButton Recipe2<GameContext, Engine.Entity> Primary "Enter Cockpit" button that pushes the free camera tool in cockpit mode for the given entity. used 6× in the base game
WorkplacesProgressBarWidget Recipe<WorkplacesProgressBarWidgetParams> Occupied/capacity text and progress bar of a PERSON_CAPACITY entity (number of sim persons with it as destination).
PassengersWidget Recipe<PassengerWidgetParams> Table of the sim persons in a vehicle with satisfaction and their other destinations; shows "Currently no passengers in this vehicle." when empty. used 1× in the base game
RatingBar Recipe<RatingBarParam> Segmented rating bar with optional icon, trend arrow and rating text. used 3× in the base game
SubconstructionBalance Recipe<SubconstructionBalanceParams> Money text (styled negative or positive) of the balance of a subconstruction's parent construction over the last game year. used 1× in the base game
SpeedIndicator Recipe<Engine.Entity> Status lines of a vehicle or a sim person in a car: speed, "Stopped"/"Stopping", "No Path", "Waiting for Free Path", or loading/unloading per cargo type with loading speed penalties at a terminal. used 2× in the base game
SendCommandButton Recipe<SendCommandButtonParams> Icon button that sends the command built by makeCommand when clicked and is enabled according to isActive.
NoiseAndPollution Recipe<NoiseAndPollutionParams> Text line with the current noise and pollution values. used 3× in the base game
ProgressDisplay Recipe<ProgressDisplayParam> Progress bar with optional icon, centred text, a second (extra) fill value, trend arrow and extra child. used 3× in the base game
NotificationWidget Recipe<Engine.Entity> List of cards for the persisting notifications attached to an entity; renders nothing if there are none. used 8× in the base game
ContentWidgetScrollContainer Recipe2<{TreeNodeId}, boolean> Vertical scroll area for the content widgets of an entity window; the boolean parameter adds the first style class. used 19× in the base game

Functions

GetDestinationIcon(DestinationIconParams) : TreeNodeId base/tealdef/gui/entity_window/entity_window_util.d.tl:247

Call as entity_window_util.GetDestinationIcon

Notes

Creates the icon of a sim person destination (home, shop or work).

Parameter Type Description
#1 DestinationIconParams Destination index (0 home, 1 shop, 2 work), icon style class and optional tooltip.

Returns TreeNodeId: An image widget.

Used in the base game: 3 times in 1 file

base/content/gui/gui/entity_window/sim_person/sim_person_eow.script.tl:83

entity_window_util.GetDestinationIcon{

GetMoveModeIcon(MoveMode) : TreeNodeId base/tealdef/gui/entity_window/entity_window_util.d.tl:249

Call as entity_window_util.GetMoveModeIcon

Notes

Creates an icon with tooltip for a move mode (walk, car, lines).

Returns TreeNodeId: An image widget; with an empty path for other move modes.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/sim_person/sim_person_eow.script.tl:182

entity_window_util.GetMoveModeIcon(param.moveMode),

GetInhabitantsTitle(entityId : Engine.Entity, landmark? : boolean) : string base/tealdef/gui/entity_window/entity_window_util.d.tl:250

Call as entity_window_util.GetInhabitantsTitle

Notes

Returns the title for the persons of a building by its land use type.

Parameter Type Description
entityId Engine.Entity Entity with a PERSON_CAPACITY component.
landmark? boolean Use the landmark wording.

Returns string: "Residents" for residential; "Customers" (landmark: "Visitors") for commercial; "Workers" for industrial.

Used in the base game: 3 times in 2 files

base/content/gui/gui/entity_window/town_building/town_building.tl:408

title = entity_window_util.GetInhabitantsTitle(entityId),
base/content/gui/gui/entity_window/perk/perk_eow.script.tl:174
local title = entity_window_util.GetInhabitantsTitle(params.state.personCapacityEntity, true)

makeConfigureOnClickFunction(constructionEntity : Engine.Entity) : function() base/tealdef/gui/entity_window/entity_window_util.d.tl:263

Call as entity_window_util.makeConfigureOnClickFunction

Notes

Returns a click handler that opens the module builder of a construction in the construction menu.

Parameter Type Description
constructionEntity Engine.Entity Construction entity to configure.

Returns function(): Function that does nothing if the entity no longer exists or is not owned by the player.

Details

The handler fires the setModuleBuilderEntity and constructionMenuSetTab events.

Used in the base game: 6 times in 6 files

base/content/gui/gui/entity_window/station_group/station_group.tl:1050

onClick = entity_window_util.makeConfigureOnClickFunction(constructionState:old()),
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:102
onClick = entity_window_util.makeConfigureOnClickFunction(extensionParams.state.constructionEntity),
base/content/gui/gui/entity_window/warehouse/warehouse.tl:81
onClick = entity_window_util.makeConfigureOnClickFunction(constructionEntity),
base/content/gui/gui/entity_window/perk/perk.tl:121
onClick = entity_window_util.makeConfigureOnClickFunction(entityId),
base/content/gui/gui/entity_window/empty_construction/empty_construction.tl:49
onClick = entity_window_util.makeConfigureOnClickFunction(entityId),
base/content/gui/gui/entity_window/industry/industry.tl:417
onClick = entity_window_util.makeConfigureOnClickFunction(state:old().editConstructionEntity),

makeRecipeAndParam<T>(recipe : Recipe<T>, param : T) : RecipeAndParamErased base/tealdef/gui/entity_window/entity_window_util.d.tl:264

Call as entity_window_util.makeRecipeAndParam

Notes

Bundles a recipe and its parameter into a RecipeAndParamErased.

Returns RecipeAndParamErased: The bundle, e.g. for CombinedStockGroupedCountsParam.recipeAndParamInputCollapsible.

Used in the base game: 2 times in 1 file

base/content/gui/gui/entity_window/industry/industry_eow.script.tl:773

recipeAndParamInputCollapsible = entity_window_util.makeRecipeAndParam(

makeStockState(entity : Engine.Entity) : {CargoUtil.StockConfig} base/tealdef/gui/entity_window/entity_window_util.d.tl:265

Call as entity_window_util.makeStockState

Notes

Calculates the stock configurations of an entity, sorted by stock type.

Parameter Type Description
entity Engine.Entity Entity to read the STOCK_LIST component from.

Returns {CargoUtil.StockConfig}: Stock configurations, or nil if the entity has no stock list.

createStockIcon(stockConfigs : {CargoUtil.StockConfig}, entity : Engine.Entity) : TreeNodeId base/tealdef/gui/entity_window/entity_window_util.d.tl:266

Call as entity_window_util.createStockIcon

Notes

Builds cargo icons with counts for stock configurations (storage stocks per cargo type, output stocks with the stored amount).

Parameter Type Description
stockConfigs {CargoUtil.StockConfig} Stock configurations, e.g. from makeStockState.
entity Engine.Entity Entity owning the stocks.

Returns TreeNodeId: A vertical box with one row of icons per stock configuration.

getVehicleName(vehicleEntity : Engine.Entity) : string base/tealdef/gui/entity_window/entity_window_util.d.tl:267

Call as entity_window_util.getVehicleName

Notes

Returns the name of a vehicle.

Returns string: The entity name, or "Invalid" if it has none.

Used in the base game: 2 times in 1 file

base/content/gui/gui/entity_window/maintenance_station/maintenance_station_eow.script.tl:198

local aName = entity_window_util.getVehicleName(a)

getEntityLog(entity : Engine.Entity, logNames : {string}, refLogNames : {string}, keepEntries : integer, hideLogsNoChange : {string}, currentState? : EntityWindowUtil.EntityLog.LoggedState) : EntityWindowUtil.EntityLog base/tealdef/gui/entity_window/entity_window_util.d.tl:268

Call as entity_window_util.getEntityLog

Notes

Builds a change history (newest first) from an entity's logbook.

Parameter Type Description
entity Engine.Entity Entity with a LOG_BOOK component.
logNames {string} Plain logbook entries to read.
refLogNames {string} Logbook entries recorded per reference entity to read.
keepEntries integer Maximum number of changes to return.
hideLogsNoChange {string} Log names whose entries are skipped when the value did not change.
currentState? EntityWindowUtil.EntityLog.LoggedState Optional current value appended as the newest state.

Returns EntityWindowUtil.EntityLog: The change history.

Details

Logged values are divided by 100 and rounded. Consecutive states of the same place and log are merged and their durations added. Used by the sim person window (happiness history) and the vehicle window (maintenance history).

Used in the base game: 2 times in 2 files

base/content/gui/gui/entity_window/sim_person/sim_person_eow.script.tl:374

return entity_window_util.getEntityLog(params.personEntity, {happinessWalkLogName, happinessCarLogName, happinessResidentialLogName, happinessCommercialLogName,
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:692
return entity_window_util.getEntityLog(params.vehicleEntity, {unmaintainedLogName}, {maintainedLogName}, 4, {}, currState)

isConstructionModifiable(entity : Engine.Entity) : boolean base/tealdef/gui/entity_window/entity_window_util.d.tl:270

Call as entity_window_util.isConstructionModifiable

Notes

Returns whether a construction can be modified after building.

Parameter Type Description
entity Engine.Entity Construction entity.

Returns boolean: True if the construction has module slots or one of its construction parameters is postConstructionModifiable.

Used in the base game: 4 times in 4 files

base/content/gui/gui/entity_window/station_group/station_group.tl:1044

if constructionState:old() ~= nil and entity_window_util.isConstructionModifiable(constructionState:old()) then
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:33
if not entity_window_util.isConstructionModifiable(constructionEntity) then
base/content/gui/gui/entity_window/warehouse/warehouse.tl:76
actionButtonBar = entity_window_util.isConstructionModifiable(constructionEntity) and entity_window_util.ActionButtonBar(react.ref(initialFocusRef), {
base/content/gui/gui/entity_window/industry/industry.tl:186
if constructionEntity >= 0 and entity_window_util.isConstructionModifiable(constructionEntity) then

EntityWindowUtil.StockCountsWidgetParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:6

record StockCountsWidgetParams

Notes

Parameters of EntityWindowUtil.EntityStockCountsWidget.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:499

entity_window_util.EntityStockCountsWidget = react.RegisterRecipe("EntityStockCountsWidget", function(params : EntityWindowUtil.StockCountsWidgetParams) : TreeN

Fields

Name Type Description
entityId Engine.Entity Entity with a stock list (STOCK_LIST component) whose stocks are shown.
width integer
iconWidth integer
maxIcons integer Maximum number of cargo icons per row before the icons wrap into two rows; defaults to 5.
groupStocks boolean Passed to cargo_util.calculateStockConfigs to group stocks into combined entries.
addDiscardCargoButtons boolean Adds a trash button to each stock that sends a makeStockListDiscardCargoCmd command discarding all stored cargo.
addButtonsToSetStockCargoType boolean Turns the cargo icons into buttons that pin the stock to that cargo type (for stocks that allow it). The pin is stored in the construction's tagToCargoType parameter and applied by rebuilding the construction.
sortByType boolean Passed to cargo_util.calculateStockConfigs to sort the stock entries by cargo type.

EntityWindowUtil.DiagramType

enum base/tealdef/gui/entity_window/entity_window_util.d.tl:17

enum DiagramType

Notes

Data source of an EntityWindowUtil.EntityDiagramWidget chart.

Used in the base game: 7 times in 6 files

base/content/gui/gui/entity_window/station_group/station_group.tl:548

chartType : EntityWindowUtil.DiagramType
base/content/gui/gui/entity_window/maintenance_station/maintenance_station_eow.script.tl:39
chartType : EntityWindowUtil.DiagramType
base/content/gui/gui/entity_window/warehouse/warehouse_eow.script.tl:20
chartType : EntityWindowUtil.DiagramType
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:777
chartType : EntityWindowUtil.DiagramType
base/content/gui/gui/entity_window/line/line_eow.script.tl:258
chartType : EntityWindowUtil.DiagramType
base/content/gui/gui/entity_window/industry/industry_eow.script.tl:665
chartType : EntityWindowUtil.DiagramType

Value Description
"logbook" Values of the entity's logbook, read with api.engine.util.logbook.getChart; x axis labelled with years.
"logbookDiff" Differences of the entity's logbook values, read with api.engine.util.logbook.getChartDiff.
"account" Account (finance) chart of the entity, read with api.engine.util.finance.getAccountChart.

EntityWindowUtil.DiagramParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:22

record DiagramParams

Notes

Parameters of EntityWindowUtil.EntityDiagramWidget.

Used in the base game: 2 times in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:868

local function getDiagramWidgetState(params : EntityWindowUtil.DiagramParams, numYearsToDisplay : integer) : DiagramWidgetState

Fields

Name Type Description
entityId Engine.Entity Entity whose logbook or account is charted.
logNames {string} Logbook entry names to chart (one series each); used by the logbook and logbookDiff chart types.
labels {string} Series labels, also shown in the legend; index matches the series.
colors {Vec4f} Series colours (Vec4f RGBA), also used for the legend bars.
types {Builtin.SeriesParam.Type} Series type per series (e.g. "BAR"); defaults to "BAR". Bars are drawn 10 wide, other types 2.
styleClass string Extra style class added to the chart widget.
chartType DiagramType Data source of the chart, see EntityWindowUtil.DiagramType.
yMin number Lower y limit passed to logbook.getChart (only for the logbook chart type).
yMax number Upper y limit passed to logbook.getChart (only for the logbook chart type).
showTimeScaleSlider boolean Shows a "Time Scale" slider to choose how many years are displayed; defaults to true. Hidden when fewer than 4 years can be shown.
showLegend boolean Shows the legend (label and colour per series); defaults to true.
initialNumYearsToDisplay integer Number of years shown initially; defaults to 5.
minNumYearsToDisplay integer Minimum number of years (set as the chart config's minCount and as the slider limit); defaults to 3.
maxNumYearsToDisplay integer Upper limit of the time scale slider, in years; defaults to 50.
legendOrientation Builtin.Type.Orientation Orientation of the widget's outer box layout.
yStepScale number Set as yStepScale of the chart config when given.
currentValueFns {function() : number} Optional functions, one per series, returning the current value; the result replaces the last value of that series (api.engine.util.chart.setLastValue), so the chart shows live values.
focusSlider boolean When true the time scale slider can take gamepad/keyboard focus (and the chart cannot).

Functions

yAxisLabelFormatter(number) : string base/tealdef/gui/entity_window/entity_window_util.d.tl:32

Notes

Formats y axis labels; defaults to lang_util.formatNumber(val, 0).

Returns string

EntityWindowUtil.ActionBarButton

record base/tealdef/gui/entity_window/entity_window_util.d.tl:44

record ActionBarButton

Notes

One button of an EntityWindowUtil.ActionButtonBar.

Used in the base game: 5 times in 3 files

base/content/gui/gui/entity_window/entity_window_util.tl:1116

local makeActionButtonElement = function(buttonParam : EntityWindowUtil.ActionBarButton, isPrimary : boolean) : TreeNodeId
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:82
local primaryButtons : {EntityWindowUtil.ActionBarButton} = {}
base/content/gui/gui/entity_window/vehicle/vehicle.tl:392
local primaryButtons : {EntityWindowUtil.ActionBarButton} = {}

Fields

Name Type Description
isSpacer boolean Inserts a horizontal spacer instead of a button.
icon string Image path of the button icon.
description string Button text for primary buttons; tooltip for secondary buttons.
tag string Tag set on the button widget (used to find it, e.g. by the guide system).
customItem TreeNodeId Ready-made widget used instead of a generated button.
sound Sound Click sound, see EntityWindowUtil.ActionBarButton.Sound.
toggleButton boolean Creates a toggle button instead of a normal button; use value and onValueChange.
value boolean Current state of a toggle button.

Functions

onClick() base/tealdef/gui/entity_window/entity_window_util.d.tl:54

Notes

Called when a normal (non-toggle) button is clicked.

onValueChange(boolean) base/tealdef/gui/entity_window/entity_window_util.d.tl:60

Notes

Called with the new state when a toggle button changes.

EntityWindowUtil.ActionBarButton.Sound

enum base/tealdef/gui/entity_window/entity_window_util.d.tl:45

enum Sound

Notes

Sound style of an action bar button (mapped to the style classes buy-sfx, send-to-depot-sfx, sell-sfx).

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1122

local sound2style <total> : {EntityWindowUtil.ActionBarButton.Sound:string} = {

Value Description
"Buy" Plays the buy sound (buy-sfx style class).
"SendToDepot" Plays the send-to-depot sound (send-to-depot-sfx style class).
"Sell" Plays the sell sound (sell-sfx style class).

EntityWindowUtil.ActionButtonBarParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:64

record ActionButtonBarParams

Notes

Parameters of EntityWindowUtil.ActionButtonBar.

Used in the base game: 3 times in 3 files

base/content/gui/gui/entity_window/entity_window_util.tl:1187

entity_window_util.ActionButtonBar = react.RegisterRecipe("ActionButtonBar", function(param : EntityWindowUtil.ActionButtonBarParams) : TreeNodeId
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:185
local actionButtonBarParam : entity_window_util.ActionButtonBarParams = {
base/content/gui/gui/entity_window/vehicle/vehicle.tl:540
local actionButtonBarParam : entity_window_util.ActionButtonBarParams = {

Fields

Name Type Description
primaryButtons {ActionBarButton} Buttons shown first, with icon and text (primary style).
secondaryButtons {ActionBarButton} Icon-only buttons after a spacer, with the description as tooltip (secondary style).
nextUpFocusRef ReactRefWrap Widget reference that gets focus when navigating up (IA_NAV_UP) from the bar.

EntityWindowUtil.EntityWindowButtonParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:70

record EntityWindowButtonParams

Notes

Parameters of EntityWindowUtil.EntityWindowButton.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1103

entity_window_util.EntityWindowButton = react.RegisterRecipe("EntityWindowButton", function(params : EntityWindowUtil.EntityWindowButtonParams) : TreeNodeId

Fields

Name Type Description
tooltip string Tooltip of the button.
icon string Image path of the button icon.

Functions

onClick() base/tealdef/gui/entity_window/entity_window_util.d.tl:73

Notes

Called when the button is clicked.

EntityWindowUtil.WorkplacesProgressBarWidgetParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:76

record WorkplacesProgressBarWidgetParams

Notes

Parameters of EntityWindowUtil.WorkplacesProgressBarWidget and EntityWindowUtil.PersonCapacityWidget.

Used in the base game: 2 times in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1235

entity_window_util.WorkplacesProgressBarWidget = react.RegisterRecipe("WorkplacesProgressBarWidget", function(params : EntityWindowUtil.WorkplacesProgressBarWid

Fields

Name Type Description
entityId Engine.Entity Entity with a PERSON_CAPACITY component.
progressBarThresholds {number} Threshold marks drawn on the progress bar (fractions 0 to 1).

EntityWindowUtil.SimPersonDestinationButtonParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:81

record SimPersonDestinationButtonParams

Notes

Parameters of EntityWindowUtil.SimPersonDestinationButton.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1310

entity_window_util.SimPersonDestinationButton = react.RegisterRecipe("SimPersonDestinationButton", function(params : EntityWindowUtil.SimPersonDestinationButton

Fields

Name Type Description
simPersonEntityId Engine.Entity Sim person entity whose destination is shown.
destinationIndex integer Note: this is a LandUseType
addIconIfMissing boolean Shows the destination icon (without button) when the person has no such destination.

EntityWindowUtil.InhabitantsTableParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:87

record InhabitantsTableParam

Notes

Parameters of EntityWindowUtil.InhabitantsTable.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1511

entity_window_util.InhabitantsTable = react.RegisterRecipe("InhabitantsTable", function(param : EntityWindowUtil.InhabitantsTableParam) : TreeNodeId

Fields

Name Type Description
landmark boolean Uses the landmark hint text ("... enable residents to visit it") when the table is empty.
headquarters boolean Uses the headquarters hint text ("... allow residents to work here") when the table is empty.
personCapacityEntityId Engine.Entity Entity with a PERSON_CAPACITY component whose sim persons are listed.

EntityWindowUtil.WorkersTableParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:93

record WorkersTableParam

Notes

Parameters of EntityWindowUtil.WorkersTable.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1602

entity_window_util.WorkersTable = react.RegisterRecipe("WorkersTable", function(param : EntityWindowUtil.WorkersTableParam) : TreeNodeId

Fields

Name Type Description
personCapacityEntityId Engine.Entity Entity whose visitors (from industry_productivity_util.getVisitors) are listed.

EntityWindowUtil.DestinationIconParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:97

record DestinationIconParams

Notes

Parameters of EntityWindowUtil.GetDestinationIcon.

Fields

Name Type Description
destinationIndex integer Destination whose icon is shown (0 home, 1 shop, 2 work, matching the land use type).
iconClass string Style class of the icon.
tooltipOverride string Tooltip used instead of the default "Home" / "Shop" / "Work".

EntityWindowUtil.PassengerWidgetParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:103

record PassengerWidgetParams

Notes

Parameters of EntityWindowUtil.PassengersWidget.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1659

entity_window_util.PassengersWidget = react.RegisterRecipe("PassengersWidget", function(vehicleEntity : EntityWindowUtil.PassengerWidgetParams) : TreeNodeId

Fields

Name Type Description
vehicleEntity Engine.Entity Vehicle whose passengers are listed.

EntityWindowUtil.VehicleTableColumn

record base/tealdef/gui/entity_window/entity_window_util.d.tl:107

record VehicleTableColumn

Notes

Column definition of an EntityWindowUtil.VehicleTable.

Fields

Name Type Description
name string Column header text.
recipe Recipe<Builtin.TableCellParam> Cell recipe; the cell's rowKey is the vehicle entity (e.g. EntityWindowUtil.VehicleCell).
headerStyleClass string Style class of the column header; not passed on to the table by EntityWindowUtil.VehicleTable.
weight number Width weight of the column; not passed on to the table by EntityWindowUtil.VehicleTable.

Functions

sortOrder(Engine.Entity, Engine.Entity) : boolean base/tealdef/gui/entity_window/entity_window_util.d.tl:110

Notes

Comparison of two vehicle entities used when the table is sorted by this column.

Returns boolean

EntityWindowUtil.VehicleTableParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:115

record VehicleTableParams

Notes

Parameters of EntityWindowUtil.VehicleTable.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/maintenance_station/maintenance_station_eow.script.tl:189

local vehicleTableParams : entity_window_util.VehicleTableParams = {

Fields

Name Type Description
entityId Engine.Entity Entity passed to getVehicleEntities, e.g. a line or depot.
columns {VehicleTableColumn} Table columns.

Functions

getVehicleEntities(Engine.Entity) : {Engine.Entity} base/tealdef/gui/entity_window/entity_window_util.d.tl:117

Notes

Returns the vehicles (table rows) for entityId; polled every step.

Returns {Engine.Entity}

EntityWindowUtil.VehicleConditionParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:125

record VehicleConditionParams

Notes

Parameters of EntityWindowUtil.VehicleCondition.

Fields

Name Type Description
entityId Engine.Entity Vehicle (or line) passed to vehicle_util.getAvgMaintenanceState.
addIcon boolean Shows a tools icon in front of the bar.

EntityWindowUtil.MaintenanceStationPoolProgressBarParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:132

record MaintenanceStationPoolProgressBarParams

Notes

Parameters of EntityWindowUtil.MaintenanceStationPoolProgressBar.

Fields

Name Type Description
entityId Engine.Entity Maintenance station (entity with a VEHICLE_DEPOT component).

EntityWindowUtil.SubconstructionBalanceParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:136

record SubconstructionBalanceParams

Notes

Parameters of EntityWindowUtil.SubconstructionBalance.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:2165

entity_window_util.SubconstructionBalance = react.RegisterRecipe("SubconstructionBalance", function(params : EntityWindowUtil.SubconstructionBalanceParams) : Tr

Fields

Name Type Description
entityId Engine.Entity Subconstruction; the balance of its parent construction is shown.
stepTimer boolean Polls with useStepStateTimer instead of every step.
maintenanceType JournalEntry.Maintenance Maintenance journal entry type passed to api.engine.util.finance.calculateBalance.

EntityWindowUtil.SendCommandButtonParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:142

record SendCommandButtonParams

Notes

Parameters of EntityWindowUtil.SendCommandButton.

Fields

Name Type Description
iconPath string Image path of the button icon.
tooltip string | function() : string Tooltip text, or a function returning it.
isPrimary boolean Uses the primary button style.
tag string Tag set on the button widget.

Functions

makeCommand() : Command<ICommandData> base/tealdef/gui/entity_window/entity_window_util.d.tl:145

Notes

Builds the command that is sent when the button is clicked.

Returns Command<ICommandData>

isActive() : boolean base/tealdef/gui/entity_window/entity_window_util.d.tl:146

Notes

Returns whether the button is enabled; polled every step. Without it the button is always enabled.

Returns boolean

EntityWindowUtil.RecipeAndParamErased

record base/tealdef/gui/entity_window/entity_window_util.d.tl:151

record RecipeAndParamErased

Notes

A recipe together with its parameter, with the parameter type erased; created with EntityWindowUtil.makeRecipeAndParam.

Used in the base game: 2 times in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:25

entity_window_util.makeRecipeAndParam = function<T>(recipe : Recipe<T>, param : T) : EntityWindowUtil.RecipeAndParamErased

Fields

Name Type Description
recipe Recipe<any> The recipe.
param any Parameter to call the recipe with.

EntityWindowUtil.EntityLog

record base/tealdef/gui/entity_window/entity_window_util.d.tl:156

record EntityLog

Notes

Change history built from an entity's logbook by EntityWindowUtil.getEntityLog.

Used in the base game: 4 times in 3 files

base/content/gui/gui/entity_window/entity_window_util.tl:2516

hideLogsNoChange : {string}, currentState? : EntityWindowUtil.EntityLog.LoggedState) : EntityWindowUtil.EntityLog
base/content/gui/gui/entity_window/sim_person/sim_person_eow.script.tl:314
local state = engine_react_util.useStepState(function() : EntityWindowUtil.EntityLog
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:684
local state = engine_react_util.useStepState(function() : EntityWindowUtil.EntityLog

Fields

Name Type Description
entries {Entry} Changes, newest first.

EntityWindowUtil.EntityLog.Entry

record base/tealdef/gui/entity_window/entity_window_util.d.tl:157

record Entry

Notes

One change in an EntityWindowUtil.EntityLog.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:2603

local entry : EntityWindowUtil.EntityLog.Entry = {

Fields

Name Type Description
durationSeconds integer Time the previous state lasted before this change, in seconds (game time).
change integer Change of the logged value (in tenths of a percent).
logName string Logbook entry name of the change.
place Engine.Entity Reference entity the change was logged for; -1 for entries of the plain (non-reference) logs.

EntityWindowUtil.EntityLog.LoggedState

record base/tealdef/gui/entity_window/entity_window_util.d.tl:163

record LoggedState

Notes

One logged value, used internally and as the optional current state passed to getEntityLog.

Used in the base game: 6 times in 3 files

base/content/gui/gui/entity_window/entity_window_util.tl:2516

hideLogsNoChange : {string}, currentState? : EntityWindowUtil.EntityLog.LoggedState) : EntityWindowUtil.EntityLog
base/content/gui/gui/entity_window/sim_person/sim_person_eow.script.tl:315
local getCurrentState = function() : EntityWindowUtil.EntityLog.LoggedState
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:687
local currState : EntityWindowUtil.EntityLog.LoggedState = {

Fields

Name Type Description
time integer Game time of the value, in milliseconds; filled with the current game time when nil.
place Engine.Entity Reference entity of the value; -1 for plain logs.
logName string Logbook entry name.
state integer 10x percent

EntityWindowUtil.MaintenanceBarParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:172

record MaintenanceBarParam

Notes

Parameters of EntityWindowUtil.MaintenanceBar.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:143

entity_window_util.MaintenanceBar = react.RegisterRecipe("MaintenanceBar", function(param : EntityWindowUtil.MaintenanceBarParam) : TreeNodeId

Fields

Name Type Description
entity Engine.Entity maintenance : integer Entity whose cost is shown; a station group (upkeep), a transport vehicle (running cost), or a construction or subconstruction (maintenance of the construction).
maintenancePeriodText string Period text shown after the cost, as in "{maintenanceCost}/{maintenancePeriod}".
initialCalloutText string Initial text of the info callout around the bar.
gameCtx GameContext Game context, passed to the info callout.
showOnRightSide boolean Shows the info callout on the right side.
nextUpFocusRef ReactRefWrap Widget reference that gets focus when navigating up (IA_NAV_UP).

EntityWindowUtil.CombinedStockGroupedCountsParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:182

record CombinedStockGroupedCountsParam

Notes

Parameters of EntityWindowUtil.CombinedStockGroupedCounts.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:732

entity_window_util.CombinedStockGroupedCounts = react.RegisterRecipe("CombinedStockGroupedCounts", function(param : EntityWindowUtil.CombinedStockGroupedCountsP

Fields

Name Type Description
initialCalloutTextInputPermanent string Callout text of the always visible part of the "Input Stocks" card.
initialCalloutTextInputCollapsible string Callout text of the collapsible part of the "Input Stocks" card.
recipeAndParamInputCollapsible RecipeAndParamErased Content of the collapsible part of the "Input Stocks" card.
initialCalloutTextOutputPermanent string Callout text of the always visible part of the "Output Stocks" card.
initialCalloutTextOutputCollapsible string Callout text of the collapsible part of the "Output Stocks" card.
recipeAndParamOutputCollapsible RecipeAndParamErased Content of the collapsible part of the "Output Stocks" card.
cardKey string Key prefix of the two cards; "-Input" / "-Output" is appended.
gameCtx GameContext Game context, passed to the content cards.
showOnRightSide boolean Shows the info callouts on the right side.
showSimplifiedOnly boolean Shows only the expanded stock table per card, without the compact view and the collapsible part.
entityId Engine.Entity Entity with a stock list, e.g. an industry.

Functions

setCollapsibleExpanded(string, boolean) base/tealdef/gui/entity_window/entity_window_util.d.tl:192

Notes

Called with the card key and the new expanded state when a collapsible part is toggled.

getCollapsibleExpanded(string) base/tealdef/gui/entity_window/entity_window_util.d.tl:193

Notes

Returns the stored expanded state for a card key.

EntityWindowUtil.IconQualityType

enum base/tealdef/gui/entity_window/entity_window_util.d.tl:201

enum IconQualityType

No description in the game files yet.

Value Description
"Happy"
"Aloof"
"Sad"
"Positive"
"Negative"

EntityWindowUtil.RatingBarParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:208

record RatingBarParam

Notes

Parameters of EntityWindowUtil.RatingBar.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:33

entity_window_util.RatingBar = react.RegisterRecipe("RatingBar", function(param : EntityWindowUtil.RatingBarParam) : TreeNodeId

Fields

Name Type Description
icon TreeNodeId Ready-made icon widget shown in front of the bar (takes precedence over iconPath).
iconPath string Image path of the icon, used when icon is not set.
tooltip string Tooltip of the icon built from iconPath.
ratingText string Text shown after the bar.
barTooltip string Tooltip of the bar.
value number Rating from 0 to 1.
valueChange number Trend; draws an arrow (one to three steps depending on size, thresholds 0.01 and 0.1) pointing right for positive and left for negative values.
numFractions integer Number of segments of the bar; must be larger than 0.
snapValueToFractions boolean Rounds the displayed value to the segments.
hideText boolean Hides the rating text.
showIcon boolean Shows the icon; must be true for the icon to appear.

Functions

getRatingLabel(RatingLevel) : string base/tealdef/gui/entity_window/entity_window_util.d.tl:213

Notes

Builds the text from the rating level (town_util.getFactorRatingLevel(value)) when ratingText is not set.

Returns string

onClick() base/tealdef/gui/entity_window/entity_window_util.d.tl:219

Notes

Makes the bar a button calling this function.

EntityWindowUtil.NoiseAndPollutionParams

record base/tealdef/gui/entity_window/entity_window_util.d.tl:224

record NoiseAndPollutionParams

Notes

Parameters of EntityWindowUtil.NoiseAndPollution.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:2488

entity_window_util.NoiseAndPollution = react.RegisterRecipe("NoiseAndPollution", function(params : EntityWindowUtil.NoiseAndPollutionParams) : TreeNodeId

Fields

Name Type Description
noise integer Noise value shown as "Current Noise".
pollution integer Pollution value shown as "Current Pollution".

EntityWindowUtil.ProgressDisplayParam

record base/tealdef/gui/entity_window/entity_window_util.d.tl:229

record ProgressDisplayParam

Notes

Parameters of EntityWindowUtil.ProgressDisplay.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/entity_window_util.tl:1810

entity_window_util.ProgressDisplay = react.RegisterRecipe("ProgressDisplay", function(param : EntityWindowUtil.ProgressDisplayParam) : TreeNodeId

Fields

Name Type Description
path string Image path of an icon shown in front of the bar.
text string optional
tooltip string Tooltip of the icon and the bar.
value number Fill of the bar from 0 to 1.
extraValue number optional
trend number optional
extraChild TreeNodeId optional