Skip to content

manager_window

Source: base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl

Notes

The Line & Vehicle Manager window and tool, its line/depot list and vehicle list APIs, and the data types of the auto-rename and "first stop to send" schemes (loaded from rename_scheme, rename_scheme_component and firstStopToSend_scheme resources).

Globals

Types

Name Definition Description
LVMMode declared here, defined in LVMMode defined in line_util.d.tl Mode of the Line & Vehicle Manager tool, stored as {mode, param}.

LVMFilterConfig

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:5

global record LVMFilterConfig

Notes

Category filter configuration of the Line & Vehicle Manager's line list.

Fields

Name Type Description
categories {StatisticsRecipeParams.Category} Filter categories offered (carrier categories).
onlyVisible StatisticsRecipeParams.OnlyVisible Configuration of the "only visible" filter.

VehicleStoreOpenInfo

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:10

global record VehicleStoreOpenInfo

Notes

Depot and line the vehicle store window was opened for from the Line & Vehicle Manager.

Fields

Name Type Description
depot Engine.Entity Depot entity.
line Engine.Entity Line that bought vehicles are sent to, or nil.
vehicleStoreMode VehicleStore.VehicleStoreMode Mode of the vehicle store (e.g. "Buy").

LineAndDepotListParams

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:16

global record LineAndDepotListParams

Notes

Parameters of the line and depot list of the Line & Vehicle Manager.

Fields

Name Type Description
filterState ReactStateT<StatisticsReactUtil.FilterState> Category, search and visibility filter.
filterConfigState ReactStateT<LVMFilterConfig> Filter configuration.
lineManagerActionButtonsRef ReactRefWrap Node of the line manager action buttons.
preferredInitialSelectionRowKey ReactStateT<Engine.Entity> Row (entity) to select initially.
scrollToNewLineRef ReactRefT<Engine.Entity> Line to scroll to once its row exists (e.g. after creating it).
commonParams CommonActionParams Shared manager state and actions.

LineAndDepotListApi

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:27

global record LineAndDepotListApi

Notes

API of the line and depot list, reached through CommonActionParams.lineAndDepotListRef.

Functions

scrollToRow(entity : Engine.Entity, forceTopAlign : boolean) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:28

Notes

Scrolls the list to the row of the entity, optionally aligning it at the top.

isLineSelected(lineEntity : Engine.Entity) : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:29

Notes

True if the line is selected.

Returns boolean

isDepotSelected(depotEntity : Engine.Entity) : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:30

Notes

True if the depot is selected.

Returns boolean

selectLine(lineEntity : Engine.Entity, selectEntity : boolean, selectSegment : integer) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:31

Notes

Selects or deselects a line; with exactly one line selected the manager switches to SEGMENT mode (at selectSegment or the last segment).

selectDepot(depotEntity : Engine.Entity, selectEntity : boolean) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:32

Notes

Selects or deselects a depot.

deselectAllLinesAndDepots() base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:33

Notes

Clears the line and depot selection.

removeLineFromList(lineEntity : Engine.Entity, deleteLine : boolean) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:34

Notes

Deselects a line and returns to MAIN mode; with deleteLine the line is also dropped from the list.

VehicleManagerParams

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:37

global record VehicleManagerParams

Notes

Parameters of the vehicle manager (vehicle list) of the Line & Vehicle Manager.

Fields

Name Type Description
gameCtx GameContext The game context.
vehicleManagerActionButtonsRef ReactRefWrap Node of the vehicle manager action buttons.
vehicleListRef ReactRefWrap Node of the vehicle list.
firstStopToSendSchemesRef ReactRefT<{FirstStopToSend.Scheme}> Available "first stop to send" schemes.
firstStopToSendSchemeMapRef ReactRefT<{Carrier : FirstStopToSend.Schemes}> Scheme names to use per carrier.
sendToLineDisabledState ReactStateT<boolean> True while sending to a line is blocked.
vehicleStoreEventParamState ReactStateT<VehicleStoreWindow.VehicleStoreEventParam> Parameters of the vehicle store window to open.
commonParams CommonActionParams Shared manager state and actions.

Functions

afterSendingToLineFixup(sentEntities : {Engine.Entity}) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:45

Notes

Called with the vehicles that were sent to a line.

scrollToRow(row : Engine.Entity, forceTopAlign : boolean) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:46

Notes

Scrolls the vehicle list to a vehicle.

VehicleManagerApi

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:54

global record VehicleManagerApi

Notes

API of the vehicle manager, reached through CommonActionParams.vehicleManagerRef.

Functions

addVehiclesToVehicleListAndSelect(vehicleEntities : {Engine.Entity}) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:55

Notes

Adds vehicles that are not yet in the list, as selected.

removeVehiclesFromVehicleList(vehicleEntities : {Engine.Entity}) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:56

Notes

Removes vehicles from the list.

isVehicleInVehicleList(vehicleEntity : Engine.Entity) : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:57

Notes

True if the vehicle is in the list (selected or not).

Returns boolean

areAnyVehiclesInVehicleList() : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:58

Notes

True if the list is not empty.

Returns boolean

selectVehicles(vehicleEntities : {Engine.Entity}, selectEntities : boolean) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:59

Notes

Selects or deselects vehicles that are in the list.

isVehicleSelected(vehicleEntity : Engine.Entity) : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:60

Notes

True if the vehicle is selected.

Returns boolean

numberSelectedVehicles() : integer base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:61

Notes

Number of selected vehicles.

Returns integer

sendVehiclesToLine(selection : {Engine.Entity}, lineEntity : Engine.Entity, sendScheme : FirstStopToSend.Scheme, callback : function(sentEntities : {Engine.Entity})) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:62

Notes

Sends the vehicles to the line with api.cmd.makeVehicleSetLineCmd, starting at the stop chosen by the scheme; callback receives the vehicles sent.

sendVehiclesToDepot(selection : {Engine.Entity}, depotEntity : Engine.Entity) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:68

Notes

Sends each vehicle to a depot with api.cmd.makeVehicleSendToDepotCmd (the depot argument is not used).

clearVehicleList() base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:69

Notes

Empties the vehicle list.

closeVehicleStore() base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:70

Notes

Closes the vehicle store window.

VehicleManagerState

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:73

global record VehicleManagerState

Notes

Contents of the vehicle list; kept between openings of the manager.

Fields

Name Type Description
vehicleListEntitiesSelected {EntityUtil.EntityAndRevision} Selected vehicles in the list.
vehicleListEntitiesUnselected {EntityUtil.EntityAndRevision} Unselected vehicles in the list.
carriers {Carrier} Carriers of the vehicles in the list.

LineManagerState

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:79

global record LineManagerState

Notes

Selection of the line and depot list.

Fields

Name Type Description
lineListEntitiesSelected {EntityUtil.EntityAndRevision} Selected lines.
lineListEntitiesUnselected {EntityUtil.EntityAndRevision} Unselected lines.
depotListEntitiesSelected {EntityUtil.EntityAndRevision} Selected depots.
depotListEntitiesUnselected {EntityUtil.EntityAndRevision} Unselected depots.

AutoRename

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:86

global record AutoRename

Notes

Data types of the line auto-rename schemes (resources of type rename_scheme and rename_scheme_component).

Details

A scheme's formatString (e.g. "{key1} - {key2}") is filled with lang_util.format; each key in formatParams names a scheme component whose renameFnDefinition script function returns that part of the name. Base-game components: town, cargo, carrier, firststop, laststop (gui/line_vehicle_mgmt/auto_rename/).

Example

function data()
    return {
        type = "rename_scheme",
        data = {
            schemeNameRaw = "town_cargo",
            schemeNameTranslated = _("Town - Cargo"),
            sortKey = 21,
            formatString = "{key1} - {key2}",
            formatParams = {
                ["key1"] = "town",
                ["key2"] = "cargo",
            },
        },
    }
end

AutoRename.RenameParams

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:87

record RenameParams

Notes

Argument of a scheme component's rename function.

Used in the base game: 6 times in 6 files

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

local renameFn = util.useFn(sc.renameFnDefinition.fileName) as function(params : AutoRename.RenameParams) : string
base/content/gui/gui/line_vehicle_mgmt/auto_rename/scheme_components/scheme_component_cargo.script.tl:4
renameFn = function(renameParams : AutoRename.RenameParams) : string
base/content/gui/gui/line_vehicle_mgmt/auto_rename/scheme_components/scheme_component_firststop.script.tl:4
renameFn = function(renameParams : AutoRename.RenameParams) : string
base/content/gui/gui/line_vehicle_mgmt/auto_rename/scheme_components/scheme_component_town.script.tl:2
renameFn = function(renameParams : AutoRename.RenameParams) : string
base/content/gui/gui/line_vehicle_mgmt/auto_rename/scheme_components/scheme_component_laststop.script.tl:4
renameFn = function(renameParams : AutoRename.RenameParams) : string
base/content/gui/gui/line_vehicle_mgmt/auto_rename/scheme_components/scheme_component_carrier.script.tl:2
renameFn = function(renameParams : AutoRename.RenameParams) : string

Fields

Name Type Description
lineEntity Engine.Entity Line being renamed.
reactLine Line.ReactLine The line as Line.ReactLine (from LineUtil.getReactLineFromGameState).

AutoRename.SchemeComponent

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:92

record SchemeComponent

Notes

Data of a rename_scheme_component resource; one part of an auto-generated line name.

Used in the base game: 7 times in 1 file

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

autoRenameSchemeComponentsMapRef : ReactRefT<{string : AutoRename.SchemeComponent}>

Fields

Name Type Description
schemeComponentNameRaw string Identifier that schemes reference in formatParams.
schemeComponentNameTranslated string Display name.
renameFnDefinition ScriptRef Script function function(AutoRename.RenameParams) : string returning the name part.

AutoRename.Scheme

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:98

record Scheme

Notes

Data of a rename_scheme resource; a pattern for auto-generated line names.

Used in the base game: 14 times in 1 file

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

autoRenameSchemesRef : ReactRefT<{AutoRename.Scheme}>

Fields

Name Type Description
schemeNameRaw string Identifier of the scheme.
schemeNameTranslated string Display name.
sortKey integer Sort order in the scheme list (then by schemeNameRaw); the first scheme is the default.
formatString string Name pattern with {key} placeholders.
formatParams {string : string} key : schemeComponentNameRaw

FirstStopToSend

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:107

global record FirstStopToSend

Notes

Data types of the "first stop to send" schemes (resources of type firstStopToSend_scheme), which decide at which stop vehicles start when sent to a line.

Details

Base-game schemes: evenlydistributed, firstcargocompatiblestop, firststop, nextreachable (gui/line_vehicle_mgmt/first_stop_to_send/). The manager picks the scheme per carrier and by whether the vehicles can carry passengers (road, air and water: evenlydistributed for passengers, firststop for cargo only; rail and tram: nextreachable).

Example

local Ret = {
    firstStopToSendFn = function(sendParams : FirstStopToSend.SendParams) : {Engine.Entity : integer}
        local vehicle2stopIndex : {Engine.Entity : integer} = {}
        for __, vehicleEntity in ipairs(sendParams.vehicleEntities) do
            vehicle2stopIndex[vehicleEntity] = 0
        end
        return vehicle2stopIndex
    end,
}
return Ret

FirstStopToSend.SendParams

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:108

record SendParams

Notes

Argument of a scheme's send function, which returns the stop index per vehicle ({Engine.Entity : integer}, 0 = first stop).

Used in the base game: 7 times in 5 files

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

local sendFn = util.useFn(firstStopToSendScheme.firstStopToSendFnDefinition.fileName) as function(params : FirstStopToSend.SendParams) : {Engine.Entity : intege
base/content/gui/gui/line_vehicle_mgmt/first_stop_to_send/scheme_firststop.script.tl:2
firstStopToSendFn = function(sendParams : FirstStopToSend.SendParams) : {Engine.Entity : integer}
base/content/gui/gui/line_vehicle_mgmt/first_stop_to_send/scheme_nextreachable.script.tl:2
firstStopToSendFn = function(sendParams : FirstStopToSend.SendParams) : {Engine.Entity : integer}
base/content/gui/gui/line_vehicle_mgmt/first_stop_to_send/scheme_firstcargocompatiblestop.script.tl:2
firstStopToSendFn = function(sendParams : FirstStopToSend.SendParams) : {Engine.Entity : integer}
base/content/gui/gui/line_vehicle_mgmt/first_stop_to_send/scheme_evenlydistributed.script.tl:4
firstStopToSendFn = function(sendParams : FirstStopToSend.SendParams) : {Engine.Entity : integer}

Fields

Name Type Description
vehicleEntities {Engine.Entity} Vehicles being sent.
lineEntity Engine.Entity Target line.

FirstStopToSend.Scheme

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:113

record Scheme

Notes

Data of a firstStopToSend_scheme resource.

Used in the base game: 20 times in 1 file

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

firstStopToSendSchemesRef : ReactRefT<{FirstStopToSend.Scheme}>

Fields

Name Type Description
schemeNameRaw string Identifier of the scheme.
schemeNameTranslated string Display name.
sortKey integer Sort order (then by schemeNameRaw); the first scheme is the fallback.
firstStopToSendFnDefinition ScriptRef Script function function(FirstStopToSend.SendParams) : {Engine.Entity : integer}.

FirstStopToSend.Schemes

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:120

record Schemes

schemeNameRaw

Used in the base game: 8 times in 1 file

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

firstStopToSendSchemeMapRef : ReactRefT<{Carrier : FirstStopToSend.Schemes}>

Fields

Name Type Description
supportsPassengers string Scheme name used when the vehicles can carry passengers.
cargoOnly string Scheme name used for cargo-only vehicles.

FirstStopToSend.VehicleData

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:125

record VehicleData

Notes

Properties of the vehicles being sent, used to choose the scheme.

Used in the base game: 1 time in 1 file

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

local getVehicleDataForScheme = function(selectionToLine : {Engine.Entity}) : FirstStopToSend.VehicleData

Fields

Name Type Description
carrier Carrier Carrier of the first existing vehicle.
supportsPassengers boolean True if any of the vehicles can load passengers.

DuplicateVehiclesParam

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:131

global record DuplicateVehiclesParam

Notes

Parameter of the duplicateVehicles event, which buys copies of vehicles (new purchase time, full maintenance state) and sends them to the best line and depot.

Example

react.fireEvent(nil, "duplicateVehicles", {
    vehicleEntities = {vehicleEntityId},
    addFeedback = addFeedback,
    onBuy = function(__ : {{Engine.Entity, Engine.Revision}}) end,
})

Fields

Name Type Description
vehicleEntities {Engine.Entity} Vehicles to duplicate.

Functions

addFeedback(message : string, mode : string, dialogData : FeedbackListUtil.FeedbackDialogParam, id : number) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:133

Notes

Shows an error message (e.g. a mission refusing the purchase).

onBuy(resultEntities : {{Engine.Entity, Engine.Revision}}) base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:139

Notes

Called with the bought vehicle entities and revisions.

ManagerWindow

record global base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:142

global record ManagerWindow

Load: local manager_window = ug_require "/gui/line_vehicle_mgmt/manager_window.tl"

Notes

The Line & Vehicle Manager tool and window. Open it by firing the openVehicleManager event; closeVehicleManager closes it.

Example

local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
    openWithVehicleEntities = {vehicleEntityId},
    sendToLineMode = true,
}
react.fireEvent(nil, "openVehicleManager", openManagerParam)

Fields

Name Type Description
ManagerEntryPoint Recipe<ManagerEntryPointParam> Invisible recipe placed in the game GUI (gui/main/game.tl) that loads the scheme resources and handles the openVehicleManager, closeVehicleManager and duplicateVehicles events. used 2× in the base game
ManagerTool ReactToolDefinition<ManagerToolParam> Tool definition of the Line & Vehicle Manager, pushed onto the game context's tool stack.
ManagerToolWindow Recipe<ToolReactUtil.IToolWindowParam<ManagerToolParam>> Singleton window of the manager tool.
ManagerWindowContent Recipe<ToolReactUtil.ToolWindowParamPayload<ManagerToolParam>> Content of the manager window.

ManagerWindow.ManagerWindowEventParam

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:143

record ManagerWindowEventParam

Notes

Parameter of the openVehicleManager event.

Used in the base game: 8 times in 8 files

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

react.onEvent("openVehicleManager", function(__ : string, param : ManagerWindow.ManagerWindowEventParam)
base/content/gui/gui/statistics/statistic_depots.tl:34
local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
base/content/gui/gui/statistics/statistic_lines.tl:49
local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
base/content/gui/gui/entity_window/view_manager.tl:562
local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:90
local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
base/content/gui/gui/entity_window/vehicle/vehicle.tl:400
local openManagerParam : ManagerWindow.ManagerWindowEventParam = {
… and 2 more files.

Fields

Name Type Description
openWithLineEntity Engine.Entity Line to select when the manager opens.
openWithDepotEntity Engine.Entity Depot to select when the manager opens.
openWithVehicleEntities {Engine.Entity} Vehicles to put in the vehicle list when the manager opens.
sendToLineMode boolean Open in send-to-line mode for the given vehicles.

ManagerWindow.ManagerToolParam

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:150

record ManagerToolParam is ToolReactUtil.IToolParam

Notes

Parameters the entry point pushes onto the tool stack with ManagerWindow.ManagerTool.

Used in the base game: 15 times in 1 file

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

function(params : ToolReactUtil.ToolWindowParamPayload<ManagerWindow.ManagerToolParam>) : TreeNodeId

Fields

Name Type Description
openWithLineEntity Engine.Entity From ManagerWindowEventParam.openWithLineEntity.
openWithVehicleEntities {Engine.Entity} From ManagerWindowEventParam.openWithVehicleEntities.
openWithDepotEntity Engine.Entity From ManagerWindowEventParam.openWithDepotEntity.
sendToLineMode boolean From ManagerWindowEventParam.sendToLineMode.
vehicleManagerStateRef ReactRefT<VehicleManagerState> Vehicle list contents, owned by the entry point.
lineManagerStateRef ReactRefT<LineManagerState> Line and depot selection, owned by the entry point.
lvmFilterStateRef ReactRefT<StatisticsReactUtil.FilterState> Line list filter (category, search, only visible).
storedLVMModeRef ReactRefT<{LVMMode, any}> Last manager mode.
autoRenameSchemeComponentsMapRef ReactRefT<{string : AutoRename.SchemeComponent}> All rename_scheme_component resources by schemeComponentNameRaw.
autoRenameSchemesRef ReactRefT<{AutoRename.Scheme}> All rename_scheme resources, sorted by sortKey.
autoRenameSchemeRef ReactRefT<AutoRename.Scheme> Currently chosen auto-rename scheme.
firstStopToSendSchemesRef ReactRefT<{FirstStopToSend.Scheme}> All firstStopToSend_scheme resources, sorted by sortKey.
firstStopToSendSchemeMapRef ReactRefT<{Carrier : FirstStopToSend.Schemes}> Scheme names per carrier.

Functions

needsToUpdateThenConsumeUpdate() : boolean base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:164

Notes

Returns true once after each openVehicleManager event.

Returns boolean

onBack() base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:165

No description in the game files yet.

ManagerWindow.ManagerEntryPointParam

record base/tealdef/gui/line_vehicle_mgmt/manager_window.d.tl:168

record ManagerEntryPointParam

Notes

Parameters of ManagerWindow.ManagerEntryPoint.

Used in the base game: 1 time in 1 file

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

manager_window.ManagerEntryPoint = react.RegisterRecipe("ManagerEntryPoint", function(entryPointParam : ManagerWindow.ManagerEntryPointParam) : TreeNodeId

Fields

Name Type Description
gameCtx GameContext The game context.