Skip to content

statistics

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

Notes

The statistics window (lists of lines, vehicles, stations, towns, industries, warehouses and depots) and the parameter types of its tabs, loaded with ug_require "/gui/statistics/statistics.tl".

Example

-- from gui/game_bar/game_bar.tl
react.fireEvent(nil, "openStatisticsWindow", "Town")

StatisticsRecipeParams

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

global record StatisticsRecipeParams

Notes

Parameters the statistics window passes to the recipe of each tab (for example gui/statistics/statistic_lines.tl).

Fields

Name Type Description
searchString string Current text of the search field ("" for none).
filterShowOnlyVisible boolean Whether only objects visible in the 3D view should be listed.
filterShowCategories {integer : boolean} Enabled category buttons, by index into the categories the tab declared.
initialSortColumn {integer, boolean} Sort column to start with, as {columnIndex, ascending}; remembered while the game runs.
filterIaComp ReactRefWrap Reference to the filter bar's input action component; tabs use it as source of the keybinding hint for focusing the filters.

Functions

onSortColumnChange(columnIndex : integer, ascending : boolean) base/tealdef/gui/statistics/statistics.d.tl:34

Notes

Called when the player changes the sort column, so the window can remember it.

deleteLineFeedback(message : string, mode : string, dialogData : FeedbackListUtil.FeedbackDialogParam, id : number) base/tealdef/gui/statistics/statistics.d.tl:37

No description in the game files yet.

declareFilterOnMount(categories : {Category}, onlyVisible : OnlyVisible) base/tealdef/gui/statistics/statistics.d.tl:38

Notes

Tells the window which category buttons and which "show only visible" toggle the tab needs. Tabs call it on mount.

Parameter Type Description
categories {Category} Category buttons of the tab.
onlyVisible OnlyVisible Object kind for the "show only visible" toggle; nil for no toggle.

StatisticsRecipeParams.TabKey

enum base/tealdef/gui/statistics/statistics.d.tl:4

enum TabKey

Notes

Tab of the statistics window.

Used in the base game: 35 times in 3 files

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

local statisticsSorted : {StatisticsRecipeParams.TabKey} = {
base/content/gui/gui/main/game.tl:255
local statisticsEnabled : {StatisticsRecipeParams.TabKey : boolean} = {
base/content/gui/gui/statistics/statistics.tl:27
initialTabKey : StatisticsRecipeParams.TabKey

Value Description
"Line" Lines tab.
"Vehicle" Vehicles tab.
"Station" Stations tab.
"Town" Towns tab.
"Industry" Industries tab.
"Warehouse" Warehouses tab.
"Depot" Depots tab.

StatisticsRecipeParams.Category

record base/tealdef/gui/statistics/statistics.d.tl:14

record Category

Notes

A category toggle button in the filter bar of a tab.

Used in the base game: 11 times in 7 files

base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:2489

local filterCategories : {StatisticsRecipeParams.Category} = {
base/content/gui/gui/statistics/statistic_depots.tl:184
local categories : {StatisticsRecipeParams.Category} = {
base/content/gui/gui/statistics/statistic_lines.tl:301
local categories : {StatisticsRecipeParams.Category} = {
base/content/gui/gui/statistics/statistic_stations.tl:292
local categories : {StatisticsRecipeParams.Category} = {
base/content/gui/gui/statistics/statistics.tl:177
categories : { StatisticsRecipeParams.Category }
base/content/gui/gui/statistics/statistics_react_util.tl:122
statistics_react_util.createCarrierCategoryFilter = function(categories : {StatisticsRecipeParams.Category},
… and 1 more files.

Fields

Name Type Description
imageFile string Icon of the button.
tooltip string Tooltip of the button.
carrier Carrier Carrier the category stands for, used to filter the line display in the 3D view; nil for categories that are not carriers.

StatisticsRecipeParams.OnlyVisible

enum base/tealdef/gui/statistics/statistics.d.tl:20

enum OnlyVisible

Notes

Kind of objects named in the tooltip of the "show only visible" toggle of a tab.

Used in the base game: 7 times in 3 files

base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:2517

local declareFilterOnMount = function(categories : {StatisticsRecipeParams.Category}, onlyVisible : StatisticsRecipeParams.OnlyVisible)
base/content/gui/gui/statistics/statistics.tl:178
onlyVisible : StatisticsRecipeParams.OnlyVisible
base/content/gui/gui/statistics/statistics_react_util.tl:43
local createShowOnlyVisibleButton = function(statsType : StatisticsRecipeParams.OnlyVisible, state : boolean, setState : function(boolean)) : TreeNodeId

Value Description
"Lines" Lines.
"Vehicles" Vehicles.
"Depots" Depots.
"Stations" Stations.
"Industries" Industries.
"Towns" Towns.
"Warehouses" Warehouses.

StatisticsRecipeApi

record global base/tealdef/gui/statistics/statistics.d.tl:41

global record StatisticsRecipeApi

Notes

API of the lines tab, used by the statistics window to draw the listed lines in the 3D view.

Functions

getVisualizeLines() : {Builtin.Type.LineVisualization} base/tealdef/gui/statistics/statistics.d.tl:42

Notes

Returns the line visualizations of the lines currently listed (after filtering), or nil.

Returns {Builtin.Type.LineVisualization}

Statistics

record global base/tealdef/gui/statistics/statistics.d.tl:45

global record Statistics

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

Notes

The statistics module.

Fields

Name Type Description
StatisticsEntryPoint Recipe<StatisticsEntryPointParam> Invisible recipe that opens the statistics window as a tool on the openStatisticsWindow event and the configured input actions, and keeps the filter settings of the tabs between openings. used 2× in the base game

Statistics.StatisticsEntryPointParam

record base/tealdef/gui/statistics/statistics.d.tl:46

record StatisticsEntryPointParam

Notes

Parameters of StatisticsEntryPoint.

Used in the base game: 1 time in 1 file

base/content/gui/gui/statistics/statistics.tl:670

statistics.StatisticsEntryPoint = react.RegisterRecipe("StatisticsEntryPoint", function(param : Statistics.StatisticsEntryPointParam) : TreeNodeId

Fields

Name Type Description
gameCtx GameContext The in-game GUI context; its tool stack is used to open the window.
statisticsInputActionMapping {string : StatisticsRecipeParams.TabKey} Input action ids mapped to the tab they open, for example ["IA_SELECT_STATISTICS_LINES"] = "Line". Pressing the action of the open tab closes the window.
statisticsEnabled {StatisticsRecipeParams.TabKey : boolean} Tabs that are shown. The base game disables the line, vehicle and station tabs in the map editor.