Skip to content

vehicle_store

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

Notes

Shared types of the vehicle store (buy / replace / modify vehicles window): store mode, browser filter and sort settings, and the shopping-cart API.

VehicleStore

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

global record VehicleStore

Notes

Shared types of the vehicle store window.

VehicleStore.VehicleStoreMode

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

enum VehicleStoreMode

Notes

What the store window does with the chosen vehicles.

Used in the base game: 7 times in 2 files

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

vehicleStoreMode : VehicleStore.VehicleStoreMode
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:10
vehicleStoreMode : VehicleStore.VehicleStoreMode

Value Description
"Buy" Buy new vehicles (opened by the buyVehicles event).
"Modify" Change the composition of existing vehicles (opened by the modifyVehicles event).
"Replace" Replace existing vehicles; their depreciated value is refunded (opened by the replaceVehicles event).

VehicleStore.CanBuy

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:10

record CanBuy

Notes

Result of VehicleCartApi.canBuyVehicle.

Used in the base game: 3 times in 1 file

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

local canBuyState : ReactStateT<VehicleStore.CanBuy> = react.useState({

Fields

Name Type Description
canBuy boolean False if the player lacks the money or a mission forbids the purchase.
missionError string Message returned by the mission GUI script event vehicleStore/mission.buyVehicle, or nil.
totalPrice integer Price of the model (metadata.cost.price) times the amount.

VehicleStore.VehicleBrowserFilter

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:16

record VehicleBrowserFilter

Notes

Current filter of the vehicle browser; evaluated per vehicle by VehicleStoreUtil.vehicleFilter.

Used in the base game: 27 times in 2 files

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

filter : VehicleStore.VehicleBrowserFilter
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:693
filter : VehicleStore.VehicleBrowserFilter

Fields

Name Type Description
text string Search text; vehicles whose name does not contain it are hidden. Empty string for no search.
transportModes {TransportMode : boolean} Transport modes of the depot or vehicles; a vehicle must share at least one enabled mode.
carrier Carrier Carrier the vehicles must use.
cargoFilters {CargoTypeId : boolean} Selected cargo types; a vehicle must be able to carry all of them.
engines {VehicleEngineType | string : boolean} Selected engine types (VehicleEngineType); if any is set, a vehicle must have at least one of them.
multipleUnits boolean Include multiple units.
onlyMultipleUnits boolean Show only multiple units.
onlyLightrail boolean Show only vehicles all of whose parts can run on tram tracks (set by the Light Rail toggle in tram depots).
singleVehicles boolean Include single vehicles (not multiple units).
filterTags {string} Filter tags of the depot or of the vehicles being replaced; see VehicleStoreUtil.depotMatchesVehicleFilterTags.
withEngine boolean If not nil, a vehicle must (true) or must not (false) have an engine.
withCapacity boolean If not nil, a vehicle must (true) or must not (false) have capacity.
withPassengerCapacity boolean Set by the tab handlers to select passenger vehicles; with withCargoCapacity it chooses the table layout and whether cargo filters are shown.
withCargoCapacity boolean Set by the tab handlers to select cargo vehicles; makes the cargo filters visible and chooses the cargo table layout.
vehicleFilter GameContext.Filters.VehicleFilter Global enabled / disabled vehicle lists from the game context (matched against the model or multiple-unit path).

VehicleStore.VehicleBrowserSort

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:36

record VehicleBrowserSort

Notes

Sort order of the vehicle browser.

Used in the base game: 14 times in 1 file

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

sort : VehicleStore.VehicleBrowserSort

Fields

Name Type Description
mode VehicleBrowserSortMode Sort mode.
ascending boolean Sort ascending.
groupTypes boolean Set to true by the store window; not read by base-game code.

VehicleStore.VehicleBrowserSort.VehicleBrowserSortMode

enum base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:37

enum VehicleBrowserSortMode

Notes

Value the vehicles are sorted by. Vehicles are first grouped into buckets (no capacity, passengers, mixed, cargo); see VehicleStoreUtil.getPrimaryBucket.

Used in the base game: 1 time in 1 file

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

mode : VehicleStore.VehicleBrowserSort.VehicleBrowserSortMode

Value Description
"Alphabetical" By name.
"Speed" By top speed.
"Capacity" By total capacity.
"Cost" By purchase price.
"RunningCosts" By running costs.
"Noise" By noise score.
"Pollution" By pollution score.
"Comfort" By comfort factor.
"Power" By engine power.
"Thrust" By thrust (aircraft).
"Weight" By empty weight.
"Length" By length.
"LoadingSpeed" By loading speed.
"YearFrom" By first year of availability (the store's default, ascending).

VehicleStore.CartInfo

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:58

record CartInfo

Notes

Price information for the buy button of a vehicle row in the store table.

Used in the base game: 2 times in 2 files

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

getCartInfo = function(canBuy : VehicleStore.CanBuy) : VehicleStore.CartInfo
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:248
local cartInfoState = engine_react_util.useStepState(function() : VehicleStore.CartInfo

Fields

Name Type Description
amount integer Number of vehicles bought at once (the replace amount); filled in by the table cell.
totalPrice integer Total price.
refund integer Depreciated value of the vehicles in the cart (and, in Replace mode, of the vehicles being replaced).
notEnoughMoney boolean True if the player cannot pay totalPrice.
viable boolean False if a vehicle in the cart has neither power nor thrust.
missionError string Mission message that blocks the purchase, or nil; filled in by the table cell.

VehicleStore.VehicleCartApi

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

record VehicleCartApi

Notes

API of the store's shopping cart node; the browser and the table call it.

Used in the base game: 9 times in 2 files

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

cartRef : ReactRefWrapApi0<VehicleStore.VehicleCartApi>
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:12
cartRef : ReactRefWrapApi0<VehicleStore.VehicleCartApi>

Functions

getVehiclesFromCart(index? : integer) : {{TransportVehiclePart}} base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:68

Notes

Parts of one cart entry, grouped per parts list (one list per single vehicle or multiple unit).

Parameter Type Description
index? integer One-based cart entry; default 1.

Returns {{TransportVehiclePart}}: The parts lists, or nil if the cart is empty.

selectVehicleForBuying(modelId : integer, muFileName : string, color : Vec3f) base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:69

Notes

Remembers the model, multiple-unit file and colour that the "buy immediately" action will buy.

canBuyVehicle(modelId : integer, amount : integer) : CanBuy base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:70

Notes

Checks money and mission restrictions for buying amount vehicles of a model.

Returns CanBuy: A CanBuy record.

addVehicleToCart(modelId : integer, multipleUnit : boolean, multipleUnitFileName : string, color : Vec3f, buyImmediately : boolean, amount : integer) base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:71

Notes

Adds a vehicle or multiple unit to the cart, or buys it immediately.

Parameter Type Description
modelId integer Model id, or multiple-unit id if multipleUnit is true.
multipleUnit boolean True if modelId is a multiple unit.
multipleUnitFileName string File name of the multiple unit.
color Vec3f Colour of the new parts.
buyImmediately boolean If true, buys amount vehicles (or replaces all vehicles to replace) right away instead of adding to the cart.
amount integer Number of vehicles to buy immediately.

getReplaceAmount() : integer base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:79

Notes

Number of vehicles being replaced (1 outside Replace mode).

Returns integer

getCartInfo(canBuy : VehicleStore.CanBuy) : VehicleStore.CartInfo base/tealdef/gui/line_vehicle_mgmt/vehicle_store.d.tl:80

Notes

Builds price information from a CanBuy result.

Returns VehicleStore.CartInfo: CartInfo with totalPrice, refund, notEnoughMoney and viable set.