line_react_util¶
Source: base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl
Notes
Small React widgets and helpers used by the Line & Vehicle Manager and the entity windows: line colour dots and colour picker, name labels with rename and locate buttons, line balance, transported items, cargo display and vehicle line/depot indicators.
LineReactUtil¶
record global base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:3
global record LineReactUtil
Load: local line_react_util = ug_require "/gui/line_vehicle_mgmt/line_react_util.tl"
Notes
React widgets for lines and vehicles. Load with ug_require "/gui/line_vehicle_mgmt/line_react_util.tl".
Fields
| Name | Type | Description |
|---|---|---|
ManagerNotificationWidget |
Recipe<Engine.Entity> |
Icons of the entity's persisting "Problem" and "Caution" notifications, as shown in the Line & Vehicle Manager. |
VehicleInstructionsIcon |
Recipe<Engine.Entity> |
For a vehicle, the colour dot of its line (en route or at terminal) or the icon of its depot. used 1× in the base game |
VehicleInstructionsName |
Recipe2<Engine.Entity, boolean> |
For a vehicle, its line name (en route or at terminal) or "Going to Depot" / "In Depot". used 1× in the base game |
LocateButton |
Recipe<LocateButtonParam> |
Button that moves the camera to an entity, position or edge position. used 4× in the base game |
ColorWidget |
Recipe<ColorWidgetParam> |
Colour dot of a line (or other entity with a colour). used 7× in the base game |
NameTextView |
Recipe<NameTextViewParams> |
Name of an entity as a button that opens its entity window, with optional locate and rename buttons. used 19× in the base game |
LineOrDepotButton |
Recipe3<Engine.Entity, function(Engine.Entity, boolean), string> |
For a vehicle, a button showing its line colour, or a depot icon when it is going to or in a depot. |
LineColorPicker |
Recipe2<Engine.Entity, boolean> |
Colour chooser button that changes a line's colour (palette from line_colors.gres plus grayscale) with api.cmd.makeEntitySetColorCmd. used 1× in the base game |
LineBalance |
Recipe<LineBalanceParams> |
Balance of a line over the last game year (api.engine.util.finance.calculateBalance), formatted as money and styled positive or negative. used 2× in the base game |
LineTransported |
Recipe<LineTransportedParams> |
Items transported by a line per year (logbook value itemsTransported). used 1× in the base game |
LineCargoDisplay |
Recipe<LineCargoDisplayParams> |
Passenger icon and up to three cargo icons of a line or of one stop, on the line colour. used 1× in the base game |
Functions
getSlimDepotIconPath(depotEntity : Engine.Entity) : string base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:28
Call as line_react_util.getSlimDepotIconPath
Notes
Returns the slim depot icon matching the depot's transport modes (bus/truck, tram, train, ...), or a generic depot icon.
Returns string
makeTooltip(text : string) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:29
Call as line_react_util.makeTooltip
Notes
Returns a tooltip node with the text in the manager tooltip style (inline input hints supported).
Returns TreeNodeId
makeTerminalIndicator(terminalNumber : integer, slim : boolean, labelOverride? : string) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:30
Call as line_react_util.makeTerminalIndicator
Notes
Returns a text node with a terminal number in the terminal indicator style.
| Parameter | Type | Description |
|---|---|---|
terminalNumber |
integer |
Terminal number shown. |
slim |
boolean |
Use the slim style. |
labelOverride? |
string |
Text shown instead of the number. |
Returns TreeNodeId
Used in the base game: 4 times in 4 files
base/content/gui/gui/line_vehicle_mgmt/line_manager_panel.tl:344
base/content/gui/gui/line_vehicle_mgmt/manager_hud_util.tl:568
base/content/gui/gui/main/hud_icon_toolbox.tl:125
base/content/gui/gui/entity_window/station_group/station_group.tl:244
makeTerminalStopIndicator(terminalNumber : integer, stopName : string) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:35
Call as line_react_util.makeTerminalStopIndicator
Notes
Returns a text node "
Returns TreeNodeId
makeEntityWindowButton(text : string, entity : Engine.Entity, tabIndex? : integer, content? : TreeNodeId, stack? : boolean, onClickOverride? : function(Engine.Entity), tooltip? : string, styleClass? : string) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:40
Call as line_react_util.makeEntityWindowButton
Notes
Returns a button (with the text or the given content) that opens the entity window of an entity via the selectEntity event.
| Parameter | Type | Description |
|---|---|---|
text |
string |
Button text, used when content is nil. |
entity |
Engine.Entity |
Entity to open. |
tabIndex? |
integer |
Not used. |
content? |
TreeNodeId |
Node shown instead of the text. |
stack? |
boolean |
Whether the window opens stacked (default true). |
onClickOverride? |
function(Engine.Entity) |
Called with the entity instead of opening the window. |
tooltip? |
string |
Button tooltip. |
styleClass? |
string |
Style class of the text (default font-scale-body). |
Returns TreeNodeId
Used in the base game: 2 times in 2 files
base/content/gui/gui/entity_window/town/town.tl:201
base/content/gui/gui/entity_window/industry/industry_eow.script.tl:209
LineReactUtil.NameTextViewParams¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:4
record NameTextViewParams
Notes
Parameters of LineReactUtil.NameTextView.
Used in the base game: 1 time in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:310
Fields
| Name | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Entity whose name is shown and renamed; clicking opens its entity window. |
locationButton |
boolean |
Shows a locate button before the name. |
stackEntityOpen |
boolean |
Whether the entity window opens stacked (default true). |
nameEntity |
Engine.Entity |
Entity whose name is displayed instead of entity's. |
editMode |
boolean |
Shows a rename (pencil) button that turns the name into a text field. |
tooltip |
string |
Tooltip of the name button. |
styleClass |
string |
Style class of the name text (default font-scale-body). |
maxLength |
integer |
Maximum name length in the text field (default 50). |
Functions
onClickOverride(Engine.Entity) base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:9
Notes
Called with the entity instead of opening its entity window.
LineReactUtil.LocateButtonParam¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:20
record LocateButtonParam
Notes
Parameters of LineReactUtil.LocateButton; set one of entity, position or edgePos.
Used in the base game: 1 time in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:209
Fields
| Name | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Entity the camera follows. |
position |
Vec3f |
World position the camera focuses. |
edgePos |
EdgePos |
Position on a transport network edge the camera focuses. |
tooltip |
string |
Tooltip (default "Locate"). |
iconPathOverride |
string |
Icon instead of ::/gui/line_vehicle_mgmt/icons/symbol_locate.tga. |
LineReactUtil.ColorWidgetParam¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:51
record ColorWidgetParam
Notes
Parameters of LineReactUtil.ColorWidget.
Fields
| Name | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Entity with a COLOR component; its colour is shown and kept up to date when color is nil. |
color |
Vec3f |
Fixed colour to show instead of the entity's. |
tooltip |
string |
Tooltip of the dot. |
Functions
onClick() base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:55
Notes
If set, the dot becomes a button calling it.
LineReactUtil.LineBalanceParams¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:65
record LineBalanceParams
Notes
Parameters of LineReactUtil.LineBalance.
Used in the base game: 1 time in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:621
Fields
| Name | Type | Description |
|---|---|---|
entity |
Engine.Entity |
The line entity. |
stepTimer |
boolean |
Update on the step timer instead of every step. |
LineReactUtil.LineTransportedParams¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:71
record LineTransportedParams
Notes
Parameters of LineReactUtil.LineTransported.
Used in the base game: 1 time in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:642
Fields
| Name | Type | Description |
|---|---|---|
entity |
Engine.Entity |
The line entity. |
stepTimer |
boolean |
Update on the step timer instead of every step. |
LineReactUtil.LineCargoDisplayParams¶
record base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:77
record LineCargoDisplayParams
Notes
Parameters of LineReactUtil.LineCargoDisplay.
Used in the base game: 1 time in 1 file
base/content/gui/gui/line_vehicle_mgmt/line_react_util.tl:660
Fields
| Name | Type | Description |
|---|---|---|
lineEntity |
Engine.Entity |
The line entity. |
stopIndex |
integer |
0-based stop index, used when stopCargoDisplay is true. |
neutralBackground |
boolean |
Use a neutral background instead of the line colour. |
stopCargoDisplay |
boolean |
otherwise whole line |
configureStopButton |
boolean |
Makes the cargo icons a toggle button ("Configure Stop"). |
toggled |
boolean |
State of the configure toggle. |
Functions
onValueChange(val : boolean) base/tealdef/gui/line_vehicle_mgmt/line_react_util.d.tl:84
Notes
Called when the configure toggle changes.