Skip to content

vehicle_store_util

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

Notes

Helpers of the vehicle store: collect displayable vehicle data from model metadata, filter vehicles, match depot filter tags and transport modes, and small filter widgets.

VehicleStoreUtil

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

global record VehicleStoreUtil

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

Notes

Helpers of the vehicle store.

Fields

Name Type Description
EngineToggle Recipe<EngineToggleParam> Toggle button for one engine group of the engine filter. used 3× in the base game
SizeFilter Recipe<SizeFilterParam> Small / Large toggles for ships and aircraft; restricts the filter to SMALL_SHIP/SMALL_AIRCRAFT or SHIP/AIRCRAFT. used 1× in the base game
CargoTypes Recipe<CargoTypesParam> Cargo type toggles of the store (passengers, all cargo, and one toggle per cargo type). used 1× in the base game
LightRailFilter Recipe<LightRailFilterParam> Light Rail toggle (sets onlyLightrail), shown for tram depots. used 1× in the base game

Functions

makeSingleVehicle(model : Model) : Vehicle base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:165

Call as vehicle_store_util.makeSingleVehicle

Notes

Collects the metadata of one vehicle model into a Vehicle record.

Parameter Type Description
model Model Model with transportVehicle metadata (e.g. from api.res.modelRep.get).

Returns Vehicle

Used in the base game: 6 times in 2 files

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

local vehicle : VehicleStoreUtil.Vehicle = vehicle_store_util.makeSingleVehicle(model)
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:94
local vehicle : VehicleStoreUtil.Vehicle = vehicle_store_util.makeSingleVehicle(model)

makeMultipleVehicles(mu : MultipleUnit) : {Vehicle} base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:166

Call as vehicle_store_util.makeMultipleVehicles

Notes

Builds a Vehicle record for every part of a multiple unit.

Returns {Vehicle}

Used in the base game: 1 time in 1 file

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

local vehicles = vehicle_store_util.makeMultipleVehicles(mu)

makeMultipleVehiclesFromParts(configs : {{TransportVehiclePart}}) : {Vehicle} base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:167

Call as vehicle_store_util.makeMultipleVehiclesFromParts

Notes

Builds Vehicle records for all parts of a list of parts lists (e.g. the vehicles in the cart).

Returns {Vehicle}

Used in the base game: 1 time in 1 file

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

local vehiclePartsLists2 = vehicle_store_util.makeMultipleVehiclesFromParts(vehicleParts)

collectVehicleData(vehicles : {Vehicle}, modifiers? : Engine.Component.TransportVehicle.Modifiers) : VehicleData base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:168

Call as vehicle_store_util.collectVehicleData

Notes

Combines the metadata of several vehicle parts into one VehicleData record (capacity, speed, power, emissions, price, years, ...).

Parameter Type Description
vehicles {Vehicle} Parts of the vehicle or consist.
modifiers? Engine.Component.TransportVehicle.Modifiers Optional modifiers of an existing transport vehicle; scale noise, pollution, comfort and top speed into the ...Adjusted fields.

Returns VehicleData

Example

-- from entity_window/vehicle/vehicle_eow.script.tl
local vehicles = {}
for i, modelId in ipairs(modelIds) do
    local vehicle = vehicle_store_util.makeSingleVehicle(api.res.modelRep.get(modelId))
    vehicle.maintenanceState = maintenanceStates[i]
    table.insert(vehicles, vehicle)
end
local vehicleData = vehicle_store_util.collectVehicleData(vehicles, modifiers)
Used in the base game: 4 times in 2 files

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

return vehicle_store_util.collectVehicleData(vehicles)
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:483
local vehicleData = vehicle_store_util.collectVehicleData(vehicles, param.modifiers)

goodnessToTextString(value : number) : string base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:172

Call as vehicle_store_util.goodnessToTextString

Notes

Translated rating for a 0 to 1 value - Very Poor (< 0.2), Poor, Mediocre, Good, Very Good (>= 0.8).

Returns string: The rating text; "" for negative values.

Used in the base game: 9 times in 3 files

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

vehicle_store_util.goodnessToTextString(noisePercentage),
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:128
text = vehicle_store_util.goodnessToTextString(comfortFactorPercentage),
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:579
ratingText = vehicle_store_util.goodnessToTextString(noisePercentage),

getRangesFromData(vehicleData : VehicleData, carrier : Carrier, year : integer) : VehicleUtil.Ranges base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:173

Call as vehicle_store_util.getRangesFromData

Notes

Value ranges for a vehicle via VehicleUtil.getRanges, using the passenger-only ranges when the vehicle carries only passengers.

Returns VehicleUtil.Ranges

Used in the base game: 2 times in 1 file

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

ranges = vehicle_store_util.getRangesFromData(

getPrimaryBucket(elem : ElementStatic) : integer base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:178

Call as vehicle_store_util.getPrimaryBucket

Notes

Sort bucket of a store entry - 1 no capacity, 2 passengers only, 3 passengers and cargo, 4 cargo only. The store sorts by bucket before the chosen sort mode.

Returns integer

Used in the base game: 2 times in 1 file

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

local bucket_a = vehicle_store_util.getPrimaryBucket(a.static)

vehicleFilter(elemStatic : VehicleStoreUtil.ElementStatic, filterParams : FilterParams, filter : VehicleStore.VehicleBrowserFilter) : boolean base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:179

Call as vehicle_store_util.vehicleFilter

Notes

Tells whether a store entry passes the browser filter.

Returns boolean: True if the entry is shown.

Details

Checks, in order: filter tags, multiple-unit / light-rail flags, the game context's enabled / disabled vehicle lists, single vehicle vs. multiple unit, availability years, carrier, transport modes, search text, cargo filters, capacity, engine types and withEngine.

Used in the base game: 4 times in 2 files

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

if skipFilter or vehicle_store_util.vehicleFilter(
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:513
if vehicle_store_util.vehicleFilter(

showCargoFilters(VehicleStore.VehicleBrowserFilter) : boolean base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:184

Call as vehicle_store_util.showCargoFilters

Notes

True if the cargo filter toggles are shown for the filter (withCargoCapacity or withCapacity is set).

Returns boolean

Used in the base game: 2 times in 1 file

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

local showFilters = vehicle_store_util.showCargoFilters(param.filter)

acceptsMultiVehicle(carrier : Carrier) : boolean base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:185

Call as vehicle_store_util.acceptsMultiVehicle

Notes

True for carriers whose vehicles are composed in a cart (rail and tram). For other carriers the store buys vehicles immediately.

Returns boolean

Used in the base game: 5 times in 2 files

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

local multipleVehiclesPossible = vehicle_store_util.acceptsMultiVehicle(params.vehicleStoreParams.filter.carrier)
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:560
local buyImmediately = not vehicle_store_util.acceptsMultiVehicle(params.filter.carrier)

makeVehicleData(repId : integer, multipleUnit : boolean) : VehicleData base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:186

Call as vehicle_store_util.makeVehicleData

Notes

collectVehicleData for a model id or a multiple-unit id.

Returns VehicleData

Used in the base game: 3 times in 1 file

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

local vehicleData = vehicle_store_util.makeVehicleData(modelId, false)

getVehicleNameAndIcons(repId : integer, multipleUnit : boolean, small : boolean) : VehicleNameAndIcon base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:187

Call as vehicle_store_util.getVehicleNameAndIcons

Notes

Name and part icons of a model or multiple unit.

Parameter Type Description
repId integer Model id or multiple-unit id.
multipleUnit boolean True if repId is a multiple unit.
small boolean For a single model, use icon20 instead of iconSmall.

Returns VehicleNameAndIcon

Used in the base game: 4 times in 1 file

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

local image : string = vehicle_store_util.getVehicleNameAndIcons(

makeVehicleProgressBarRow(progressBarIcon : string, tooltip : string, percentage : number, progressBarText : string, comparisonPercentage? : number) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:192

Call as vehicle_store_util.makeVehicleProgressBarRow

Notes

Builds a row with icon, progress bar and text for a vehicle property; with a comparison value both bars are shown, coloured good or bad.

Parameter Type Description
progressBarIcon string
tooltip string
percentage number Bar value, clamped to 0 to 1.
progressBarText string
comparisonPercentage? number Optional value to compare with (e.g. the vehicle being replaced).

Returns TreeNodeId

Used in the base game: 7 times in 1 file

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

rowsLeft[#rowsLeft + 1] = vehicle_store_util.makeVehicleProgressBarRow(

makeVehiclePropertyRow(tooltip : string, text : string, propertyIcon : string, percentage : number, comparisonPercentage? : number, higherIsBetter? : boolean) : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:199

Call as vehicle_store_util.makeVehiclePropertyRow

Notes

Builds a row with icon and text for a vehicle property; the text is coloured good or bad when a comparison value differs.

Parameter Type Description
tooltip string
text string
propertyIcon string
percentage number
comparisonPercentage? number
higherIsBetter? boolean Pass false if a lower value is better; default true.

Returns TreeNodeId

Used in the base game: 5 times in 1 file

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

rowsRight[#rowsRight + 1] = vehicle_store_util.makeVehiclePropertyRow(

makeVehiclePropertyPlaceholder() : TreeNodeId base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:207

Call as vehicle_store_util.makeVehiclePropertyPlaceholder

Notes

Empty component with the property-placeholder style, used to keep rows aligned.

Returns TreeNodeId

Used in the base game: 1 time in 1 file

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

rowsLeft[#rowsLeft + 1] = vehicle_store_util.makeVehiclePropertyPlaceholder()

handleRailCarrier(vehicleBrowserFilter : VehicleStore.VehicleBrowserFilter, id2index : {string : integer}, index : integer) : VehicleStore.VehicleBrowserFilter base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:208

Call as vehicle_store_util.handleRailCarrier

Notes

Sets the browser filter for the selected tab of a rail depot (locomotive, wagon, multiple unit).

Parameter Type Description
vehicleBrowserFilter VehicleStore.VehicleBrowserFilter
id2index {string : integer} Tab id to tab index.
index integer Index of the selected tab.

Returns VehicleStore.VehicleBrowserFilter: The changed filter.

Used in the base game: 1 time in 1 file

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

return vehicle_store_util.handleRailCarrier(newState, id2indexLocal, index)

handleTramCarrier(vehicleBrowserFilter : VehicleStore.VehicleBrowserFilter, id2index : {string : integer}, index : integer) : VehicleStore.VehicleBrowserFilter base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:213

Call as vehicle_store_util.handleTramCarrier

Notes

Sets the browser filter for the selected tab of a tram depot (railcar, locomotive, wagon).

Returns VehicleStore.VehicleBrowserFilter: The changed filter.

Used in the base game: 1 time in 1 file

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

return vehicle_store_util.handleTramCarrier(newState, id2indexLocal, index)

handleDefaultCarrier(vehicleBrowserFilter : VehicleStore.VehicleBrowserFilter) : VehicleStore.VehicleBrowserFilter base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:218

Call as vehicle_store_util.handleDefaultCarrier

Notes

Resets the browser filter for carriers without tabs (road, water, air).

Returns VehicleStore.VehicleBrowserFilter

Used in the base game: 1 time in 1 file

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

return vehicle_store_util.handleDefaultCarrier(newState)

getTransportModeMapForVehicles(vehicleEntities : {Engine.Entity}) : {TransportMode : boolean} base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:221

Call as vehicle_store_util.getTransportModeMapForVehicles

Notes

Union of the enabled transport modes of the given vehicles.

Returns {TransportMode : boolean}

Used in the base game: 7 times in 3 files

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

local transportModeMapVehicle = vehicle_store_util.getTransportModeMapForVehicles({selectedVehicle})
base/content/gui/gui/line_vehicle_mgmt/line_util.tl:1532
local transportModeMap = vehicle_store_util.getTransportModeMapForVehicles({vehicleEntity})
base/content/gui/gui/line_vehicle_mgmt/manager_hud_util.tl:1119
local transportModeMap = vehicle_store_util.getTransportModeMapForVehicles({selectedVehicle})

depotMatchesVehicleFilterTags(depotFilterTags : {string}, vehicleFilterTags : {string}) : boolean base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:224

Call as vehicle_store_util.depotMatchesVehicleFilterTags

Notes

Tells whether one filter-tag list contains all tags of another; used to match vehicles to depots.

Returns boolean: True if the vehicle is allowed.

Details

The implementation treats the second argument as the required tag list and the first as the tags to check: every tag of the second list must appear in the first. If the second argument is nil, everything matches; if it is an empty list, only a non-empty first list matches. Mind the argument order: the definition names the first parameter depotFilterTags, the store's vehicleFilter passes (vehicle tags, depot tags), while the availability notification script passes (depot tags, vehicle tags).

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/notifications/types/availability.script.tl:100

if not opened and vehicle_store_util.depotMatchesVehicleFilterTags(depotFilterTags, tv.filterTags)

depotMatchesVehicleTransportModes(depotTransportModes : {TransportMode : boolean}, vehicleTransportModes : {TransportMode : boolean}) : boolean base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:225

Call as vehicle_store_util.depotMatchesVehicleTransportModes

Notes

True if the two transport-mode maps share at least one enabled mode (or the second map is nil).

Returns boolean

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/notifications/types/availability.script.tl:101

and vehicle_store_util.depotMatchesVehicleTransportModes(depotTransportModes, vehicleTransportModes) then

getVehicleFilterTags(vehicleEntities : {Engine.Entity}) : {string} base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:227

Call as vehicle_store_util.getVehicleFilterTags

Notes

Filter tags of the given vehicles, from their models' transportVehicle.filterTags and the filter tags of their multiple units.

Returns {string}

Used in the base game: 4 times in 2 files

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

filterTags = vehicle_store_util.getVehicleFilterTags(vehicleEntities),
base/content/gui/gui/entity_window/vehicle/vehicle.tl:456
filterTags = vehicle_store_util.getVehicleFilterTags({vehicleEntityId}),

getDepotFilterTags(depotEntity : Engine.Entity) : {string} base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:228

Call as vehicle_store_util.getDepotFilterTags

Notes

Filter tags of a vehicle depot (VEHICLE_DEPOT component).

Returns {string}

Used in the base game: 2 times in 2 files

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

filterTags = vehicle_store_util.getDepotFilterTags(depotEntity),
base/content/game_mechanics/game_mechanics/notifications/types/availability.script.tl:98
local depotFilterTags = vehicle_store_util.getDepotFilterTags(e)

VehicleStoreUtil.Vehicle

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:4

record Vehicle

Notes

Metadata of one vehicle model, gathered by makeSingleVehicle.

Used in the base game: 20 times in 3 files

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

local vehicles : {VehicleStoreUtil.Vehicle} = {}
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:12
vehicle_store_util.makeSingleVehicle = function(model : Model) : VehicleStoreUtil.Vehicle
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:91
local vehicles : {VehicleStoreUtil.Vehicle} = {}

Fields

Name Type Description
tv ModelMetadata.TransportVehicle transportVehicle metadata of the model.
landVehicle ModelMetadata.LandVehicle landVehicle metadata, or nil.
waterVehicle ModelMetadata.WaterVehicle waterVehicle metadata, or nil.
airVehicle ModelMetadata.AirVehicle airVehicle metadata, or nil.
cost ModelMetadata.Cost cost metadata.
maintenance ModelMetadata.Maintenance maintenance metadata.
emissions ModelMetadata.Emissions emissions metadata.
desc ModelMetadata.Description description metadata (name and icons).
availability ModelMetadata.Availability availability metadata (years).
length number Length of the model's bounding box along x (extent.bbMax.x - extent.bbMin.x).
maintenanceState number Optional maintenance state of an existing vehicle part; if set, collectVehicleData fills the ...Adjusted values.

VehicleStoreUtil.VehicleData

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:20

record VehicleData

Notes

Combined, displayable data of a vehicle or consist, computed by collectVehicleData.

Details

Values are summed over all parts unless noted. The ...Adjusted fields are only set when a part has a maintenanceState (and the matching maintenance-effect option of the base config is on) or when modifiers scale the value.

Used in the base game: 28 times in 3 files

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

vehicleData : VehicleStoreUtil.VehicleData
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:126
local vehicleData : VehicleStoreUtil.VehicleData = {
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:421
vehicleData : vehicle_store_util.VehicleData

Fields

Name Type Description
allCargoTypes {CargoTypeId : integer} Capacity per cargo type, summed over all compartments.
cargoClasses {string} Cargo classes the vehicle can load (without duplicates).
engines {VehicleEngineType : boolean} Engine types of the land-vehicle engines.
variantGroup string Variant group (transportVehicle.groupFileName) of the parts, or "".
anyCargo boolean True if any part carries cargo other than passengers.
passengers boolean True if any part carries passengers.
isReversible boolean transportVehicle.reversible (of the last part).
isLightrail boolean True if every part can run on tram tracks.
speed number Lowest top speed of all parts.
speedAdjusted number Top speed after maintenance penalty and topSpeedScale modifier.
maxIndividualSpeed number Highest top speed of any part.
noise number Highest noise score of the parts, as 0 to 1 (score / 100).
noiseAdjusted number Noise after maintenance penalty and noiseScale modifier.
pollution number Highest pollution score of the parts, as 0 to 1 (score / 100).
pollutionAdjusted number Pollution after maintenance penalty and pollutionScale modifier.
comfortFactor number Lowest non-zero comfort factor of the parts.
comfortFactorAdjusted number Average comfort of the parts after the maintenance penalty, scaled by the comfortScale modifier.
runningCosts number Sum of maintenance.runningCosts.
runningCostsAdjusted number Running costs after the maintenance penalty.
numCompartments integer Number of compartments.
loadingSpeed number Highest loadSpeed of the parts; 0 if the vehicle has no capacity.
weight number Sum of weightEmpty times 1e-3.
weightMaxPayload number Sum of weightMaxPayload times 1e-3.
length number Sum of part lengths.
totalCapacity integer Total capacity (per compartment the largest capacity of any cargo type).
totalCapacityPassengers integer Passenger capacity.
totalCapacityCargo integer Cargo capacity (non-passenger).
price integer Sum of cost.price.
tractiveEffort number Sum of the first engine's tractive effort of each land-vehicle part.
thrust number Sum of airVehicle.maxThrust times 1e-3.
thrustAdjusted number Thrust after the maintenance penalty.
rollingFriction number Sum of landVehicle.friction (0.1 per aircraft part).
power number Sum of engine power (first engine of land vehicles, availPower times 1e-3 for ships).
powerAdjusted number Power after the maintenance penalty.
yearFrom integer Latest availability.yearFrom of the parts (-1 if none).
yearTo integer Earliest availability.yearTo of the parts (5000 if none).
noCblendMask boolean False if any part has a colour-blend mask.

VehicleStoreUtil.ElementDynamic

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

record ElementDynamic

Notes

Per-refresh data of a store entry.

Fields

Name Type Description
ranges VehicleUtil.Ranges Value ranges used to scale the entry's progress bars.
sortKey any Value of the current sort mode (number, or string for alphabetical).
variantCountFiltered integer Number of the entry's variants that pass the current filter.

VehicleStoreUtil.ElementStatic

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:73

record ElementStatic

Notes

Data of a store entry (model or multiple unit) computed once by VehicleStoreEntryPoint.

Used in the base game: 8 times in 2 files

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

local DetailsTitle = react.RegisterRecipe("DetailsTitle", function(elemStatic : VehicleStoreUtil.ElementStatic) : TreeNodeId
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:428
vehicle_store_util.getPrimaryBucket = function(elem: VehicleStoreUtil.ElementStatic): integer

Fields

Name Type Description
repId integer Model id, or multiple-unit id.
multipleUnit boolean True for a multiple unit.
name string Display name.
names {string} Names of the parts.
icons {string} Small icons of the parts.
iconsBlend {string} Colour-blend masks of the part icons.
iconOrientations {boolean} Per part, true if the part is reversed (multiple units only).
vehicleData VehicleStoreUtil.VehicleData Combined vehicle data.
engineKey integer Sum of engine-type weights (horse 2, steam 4, diesel 6, electric 8).
path string Model or multiple-unit file path; also the key into the variant groups.
variantCount integer Number of variants whose variant group is this entry's path.
isVariant boolean True if the vehicle belongs to a variant group.
variantGroupOnly boolean True for a model that has variants but no filter tags; it is only shown as group head, not as a buyable entry of its own.
carriersMap {Carrier : boolean} Carriers of the parts.
transportModes {TransportMode : boolean} Transport modes of the parts.
engineTypes {VehicleEngineType : boolean} Engine types of the land-vehicle parts.
hasEngine boolean True if any land-vehicle part has an engine; always true for water and air vehicles.
filterTags {string} Filter tags of the parts (multiple unit's own tags for multiple units).

VehicleStoreUtil.Element

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:94

record Element

Notes

One entry of the vehicle store list.

Used in the base game: 70 times in 2 files

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

elementMain : VehicleStoreUtil.Element -- main vehicle list element
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:11
elements : {vehicle_store_util.Element}

Fields

Name Type Description
dynamic ElementDynamic Per-refresh data.
static ElementStatic Precomputed data.

VehicleStoreUtil.FilterParams

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:99

record FilterParams

Notes

Context for vehicleFilter.

Used in the base game: 3 times in 3 files

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

filterParams : vehicle_store_util.FilterParams
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:692
filterParams : VehicleStoreUtil.FilterParams,
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_table.tl:497
local filterParams : vehicle_store_util.FilterParams = {

Fields

Name Type Description
year integer Current game year; vehicles outside their availability years are hidden.
anyCargoFilterSet boolean True if any cargo filter is selected.
passengerCargoTypeId integer Cargo type id of passengers.

VehicleStoreUtil.VehicleNameAndIcon

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:105

record VehicleNameAndIcon

Notes

Result of getVehicleNameAndIcons.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:449

) : VehicleStoreUtil.VehicleNameAndIcon

Fields

Name Type Description
name string Model or multiple-unit name.
names {string} Names of the parts.
icons {string} Part icons (iconSmall, or icon20 when small icons are requested for a single model).
iconsBlend {string} Matching colour-blend masks.
iconOrientations {boolean} Per part, true if reversed (multiple units only; empty for single models).
largeIcon string The icon3d of the (first) model.

VehicleStoreUtil.EngineType

enum base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:115

enum EngineType

Notes

Engine groups of the store's engine filter toggles.

Used in the base game: 2 times in 1 file

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

local modesState : ReactStateT<{VehicleStoreUtil.EngineType : boolean}> = react.useState({

Value Description
"Steam" Steam engines.
"Diesel" Diesel engines.
"Electric" Electric engines.

VehicleStoreUtil.EngineToggleParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:121

record EngineToggleParam

Notes

Parameters of EngineToggle.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:902

vehicle_store_util.EngineToggle = react.RegisterRecipe("EngineToggle", function(param : VehicleStoreUtil.EngineToggleParam) : TreeNodeId

Fields

Name Type Description
type EngineType Engine group this toggle controls.
modes {EngineType : boolean} Current on/off state of all engine groups.

Functions

setModes({EngineType : boolean}) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:124

Notes

Called with the updated state when the toggle changes.

VehicleStoreUtil.SizeFilterParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:127

record SizeFilterParam

Notes

Parameters of SizeFilter.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:925

vehicle_store_util.SizeFilter = react.RegisterRecipe("SizeFilter", function(param : VehicleStoreUtil.SizeFilterParam) : TreeNodeId

Fields

Name Type Description
showFilters boolean Initial visibility state of the filters.
filter VehicleStore.VehicleBrowserFilter Current browser filter.
transportModes {TransportMode : boolean} Transport modes available (of the depot or vehicles).

Functions

setFilterSort(newFilter : VehicleStore.VehicleBrowserFilter, newSort : VehicleStore.VehicleBrowserSort, forceUpdate : boolean) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:130

Notes

Applies the new filter.

VehicleStoreUtil.CargoTypesParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:138

record CargoTypesParam

Notes

Parameters of CargoTypes.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:1042

vehicle_store_util.CargoTypes = react.RegisterRecipe("CargoTypes", function(param : VehicleStoreUtil.CargoTypesParam) : TreeNodeId

Fields

Name Type Description
filter VehicleStore.VehicleBrowserFilter Current browser filter.
allCargo {CargoTypeId : boolean} Cargo types offered as toggles.

Functions

setFilterSort(newFilter : VehicleStore.VehicleBrowserFilter, newSort : VehicleStore.VehicleBrowserSort, forceUpdate : boolean) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:140

Notes

Applies the new filter.

VehicleStoreUtil.LightRailFilterParam

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:148

record LightRailFilterParam

Notes

Parameters of LightRailFilter.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:1006

vehicle_store_util.LightRailFilter = react.RegisterRecipe("LightRailFilter", function(param : VehicleStoreUtil.LightRailFilterParam) : TreeNodeId

Fields

Name Type Description
showFilters boolean Initial visibility state of the filters.
filter VehicleStore.VehicleBrowserFilter Current browser filter.
transportModes {TransportMode : boolean} Transport modes available.

Functions

setFilterSort(newFilter : VehicleStore.VehicleBrowserFilter, newSort : VehicleStore.VehicleBrowserSort, forceUpdate : boolean) base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:151

Notes

Applies the new filter.

VehicleStoreUtil.TransportModesAndCarrier

record base/tealdef/gui/line_vehicle_mgmt/vehicle_store_util.d.tl:159

record TransportModesAndCarrier

Notes

Transport modes and carrier compatible with a set of vehicles; returned by LineUtil.getLineAndVehicleCompatibleTransportModesAndCarrier.

Used in the base game: 1 time in 1 file

base/content/gui/gui/line_vehicle_mgmt/line_util.tl:1631

) : VehicleStoreUtil.TransportModesAndCarrier

Fields

Name Type Description
transportModes {TransportMode : boolean} Compatible transport modes.
carrier Carrier Carrier.