Skip to content

vehicle_store_window

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

Notes

The vehicle store window and its entry point, which listens for the buyVehicles, replaceVehicles and modifyVehicles GUI events.

VehicleStoreWindow

record global base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:3

global record VehicleStoreWindow

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

Notes

Vehicle store window and its entry point.

Fields

Name Type Description
VehicleStoreEntryPoint Recipe<VehicleStoreEntryPointParam> Invisible recipe that precomputes the store's vehicle data and opens the store window on the buyVehicles, replaceVehicles and modifyVehicles events. used 2× in the base game
VehicleStoreWindow Recipe<VehicleStoreWindowParam> The vehicle store window recipe (window id vehiclestore.window). used 17× in the base game

VehicleStoreWindow.LayoutStyle

enum base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:4

enum LayoutStyle

Notes

Layout of the store window; switched with a button and forced to TwoPaneSplit in gamepad mode.

Used in the base game: 5 times in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:1677

layoutStyle : VehicleStoreWindow.LayoutStyle,

Value Description
"Table" Vehicles in a sortable table.
"TwoPaneSplit" Vehicle list with a details pane (default).

VehicleStoreWindow.MuAndId

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:9

record MuAndId

Notes

Reference to a vehicle variant.

Used in the base game: 2 times in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:1890

local muAndIds : {VehicleStoreWindow.MuAndId} = variantGroup2muAndVariants[elemStatic.path]

Fields

Name Type Description
multipleUnit boolean True if id is a multiple-unit id, false for a model id.
id integer Model id or multiple-unit id.

VehicleStoreWindow.VehiclesStaticData

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:14

record VehiclesStaticData

Notes

Vehicle data computed once by the entry point for all models with transportVehicle metadata and all multiple units.

Used in the base game: 4 times in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:54

vehiclesStaticData : VehicleStoreWindow.VehiclesStaticData

Fields

Name Type Description
repId2elementStatic {integer : VehicleStoreUtil.ElementStatic} Static store element per model id or multiple-unit id.
variantGroup2muAndVariants {string : {MuAndId}} Variants per variant group (the groupFileName of the transport vehicle or multiple unit).

VehicleStoreWindow.VehicleStoreEventParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:19

record VehicleStoreEventParam

Notes

Payload of the buyVehicles, replaceVehicles and modifyVehicles GUI events that open the store window.

Example

-- from entity_window/vehicle/vehicle.tl
local tmc = line_util.getLineAndVehicleCompatibleTransportModesAndCarrier({vehicleEntityId})
react.fireEvent(nil, "replaceVehicles", {
    vehicleEntities = {vehicleEntityId},
    carrier = tmc.carrier,
    transportModes = tmc.transportModes,
    filterTags = vehicle_store_util.getVehicleFilterTags({vehicleEntityId}),
    openedFromEOW = true,
    onClose = function() replaceWindowOpen:set(false) end,
})
Used in the base game: 7 times in 3 files

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:4870

react.onEvent("buyVehicles", function(__ : string, param : VehicleStoreWindow.VehicleStoreEventParam)
base/content/gui/gui/line_vehicle_mgmt/manager_window.tl:4855
vehicleStoreEventParamState : ReactStateT<VehicleStoreWindow.VehicleStoreEventParam>
base/content/gui/gui/entity_window/vehicle/vehicle.tl:452
local replaceParam : VehicleStoreWindow.VehicleStoreEventParam = {

Fields

Name Type Description
title string Window title (used by buyVehicles; replace and modify use fixed titles).
vehicleEntities {Engine.Entity} Vehicles to replace or modify.
depot Engine.Entity Depot in which new vehicles are bought (Buy mode).
carrier Carrier Carrier of the vehicles offered.
transportModes {TransportMode : boolean} Transport modes the offered vehicles must support.
filterTags {string} Filter tags the offered vehicles must match.
openedFromEOW boolean True if opened from an entity window; changes the window style and initial position.

Functions

getFirstStopToSendTo(vehicleToSendToLine : Engine.Entity, lineToSendTo : Engine.Entity) : integer base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:29

Notes

Returns the stop index a newly bought vehicle is sent to on its line.

Returns integer

onLocate() base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:33

Notes

Called by the window's locate button (Buy mode only).

onClose() base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:34

Notes

Called when the window closes.

buyCallback(resultEntities : {{Engine.Entity, Engine.Revision}}) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:35

Notes

Called with {{entity, revision}} of bought vehicles (Buy mode only).

VehicleStoreWindow.VehicleStoreWindowParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:38

record VehicleStoreWindowParam

Notes

Parameters of the VehicleStoreWindow recipe, built by the entry point from a VehicleStoreEventParam.

Used in the base game: 5 times in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:4463

local VehicleStoreWindowContent = react.RegisterRecipe("VehicleStoreWindowContent", function(param : VehicleStoreWindow.VehicleStoreWindowParam) : TreeNodeId

Fields

Name Type Description
gameCtx GameContext Game context.
layoutStyleRef ReactRefT<VehicleStoreWindow.LayoutStyle> Shared ref holding the current layout style.
vehiclesStaticData VehiclesStaticData Precomputed vehicle data.
colorChooserColorsStaticData {Vec3f} Colours offered by the colour chooser (line colours plus grayscale).
title string Window title.
vehicleEntities {Engine.Entity} Vehicles to replace or modify; the window closes when none of them exists any more.
depot Engine.Entity Depot for new vehicles; if nil, api.engine.util.vehicle.findBestLineAndDepotForVehicle chooses one.
carrier Carrier Carrier of the vehicles offered; rail and tram allow multi-part consists in the cart, other carriers buy immediately.
transportModes {TransportMode : boolean} Transport modes the offered vehicles must support.
filterTags {string} Filter tags the offered vehicles must match.
vehicleStoreMode VehicleStore.VehicleStoreMode Buy, Replace or Modify.
locateVisible boolean Shows the window's locate button.
openedFromEOW boolean True if opened from an entity window.

Functions

getFirstStopToSendTo(vehicleToSendToLine : Engine.Entity, lineToSendTo : Engine.Entity) : integer base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:57

Notes

Returns the stop index a newly bought vehicle is sent to on its line.

Returns integer

onLocate() base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:61

Notes

Called by the locate button.

onClose() base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:62

Notes

Called when the window closes.

onAccepted({VehicleReactUtil.VehicleChange}) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:63

Notes

Called with the accepted changes after they were passed to VehicleReactUtil.HandleVehicleChanges.

buyCallback(resultEntities : {{Engine.Entity, Engine.Revision}}) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:64

Notes

Called with {{entity, revision}} of bought vehicles.

VehicleStoreWindow.VehicleStoreEntryPointParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_window.d.tl:67

record VehicleStoreEntryPointParam

Notes

Parameters of VehicleStoreEntryPoint.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_window.tl:4680

vehicle_store_window.VehicleStoreEntryPoint = react.RegisterRecipe("VehicleStoreEntryPoint", function(entryPointParam : VehicleStoreWindow.VehicleStoreEntryPoin

Fields

Name Type Description
gameCtx GameContext Game context; its window container hosts the store window.