Skip to content

Engine.Component.TransportVehicle

Part of engine › Engine › Engine.Component

Source: api/tealdef/api/engine.d.tl

Engine.Component.TransportVehicle

record api/tealdef/api/engine.d.tl:1380

record TransportVehicle

Access: api.type.TransportVehicle

Represents a single transport vehicle

Used in the base game: 106 times in 43 files

base/content/game_mechanics/game_mechanics/achievements/achievements.script.tl:457

local transportVehicleComponent = api.engine.getComponent(vehicleEntity, api.type.ComponentType.TRANSPORT_VEHICLE) as Engine.Component.TransportVehicle
base/content/game_mechanics/game_mechanics/notifications/notifications.script.tl:561
local tv : Engine.Component.TransportVehicle = api.engine.getComponent(vehicleEntity, api.type.ComponentType.TRANSPORT_VEHICLE)
base/content/game_mechanics/game_mechanics/notifications/types/stuck_vehicle.script.tl:31
local tv : Engine.Component.TransportVehicle = api.engine.getComponent(notificationParams.entity.entity, api.type.ComponentType.TRANSPORT_VEHICLE)
base/content/game_mechanics/game_mechanics/towns/town_util.tl:1775
local transportVehicle : Engine.Component.TransportVehicle = api.engine.getComponent(owningVehicleInfo.owningVehicle, api.type.ComponentType.TRANSPORT_VEHICLE)
base/content/gui/gui/entity_window/entity_window_hud.tl:290
local transportVehicle : Engine.Component.TransportVehicle = api.engine.getComponent(entity, api.type.ComponentType.TRANSPORT_VEHICLE)
base/content/gui/gui/entity_window/entity_window_util.tl:2278
local transportVehicle = api.engine.getComponent(vehicleEntity, api.type.ComponentType.TRANSPORT_VEHICLE) as Engine.Component.TransportVehicle
… and 37 more files.

Fields

Name Type Description
carrier Carrier the type of transport vehicle
transportVehicleConfig TransportVehicleConfig the configuration of vehicle models in this vehicle
config Config various configuration properties for the vehicle
state TransportVehicleState current state of the vehicle
userStopped boolean whether or not the user stopped the vehicle
depot Engine.Entity if in depot, the Entity Id of the depot
sellOnArrival boolean whether or not the vehicle will be sold on arrival
line Engine.Entity the entity of the line (if assigned to one)
stopIndex integer the stop index of the line (if assigned to one)
arrivalStationTerminal StationTerminal The terminal to which the vehicle currently tries to go
arrivalStationTerminalLocked boolean If the arrivalStationTerminal is the final decision
lineStopDepartures {integer} timestamps of the last departures at each line stop
lastLineStopDeparture integer timestamp of the last departure at any line
sectionTimes {number} time taken for each section between line stops
lineStop2cargo2available {{CargoTypeId}} available capacity per cargo type for each line stop
loadState LoadState current loading state of the vehicle
timeUntilNextScheduledDeparture number how much time is left until the vehicle will start loading cargo
loadSpeedModifiers {CargoTypeId : LoadSpeedModifiers} current effective load speed modifiers per cargo type
timeUntilCloseDoors number how much time is left until the vehicle starts closing the doors
timeUntilDeparture number how much time is left until the vehicle leaves the terminal
timeUntilNextLoad {CargoTypeId : number} time until the next load per cargo type
timeUntilNextUnload {CargoTypeId : number} time until the next unload per cargo type
lastStationStockIndex integer index of the last station/stock where cargo was loaded/unloaded if multiple compatible stocks are in reach of the current terminal of the currently loading/unloading cargo type.
doorsTime integer time at which the door have been closed/open
daysInDepot integer amount of days waiting in depot
daysAtTerminal integer amount of days waiting at terminal
doorsOpen boolean whether doors should be open or closed
noPath boolean whether or not the vehicle has a path
autoDeparture boolean whether the vehicle departure is managed by the game or not
maintenanceStation Engine.Entity the maintenance station maintaining the vehicle
modifiers Modifiers modifiers applied to the transport vehicle
unloadPendingIncome PendingIncomeParams list of pending income
closestTown Engine.Entity the closest town to the vehicle
visitedStops {integer} The last stops on the line the transport vehicle stopped at The length is limited to the number of stops on the line

Functions

new() : TransportVehicle api/tealdef/api/engine.d.tl:1457

Call as api.type.TransportVehicle.new(…)

Notes

Creates a new, empty TransportVehicle.

Returns TransportVehicle

Engine.Component.TransportVehicle.Modifiers

record api/tealdef/api/engine.d.tl:1382

record Modifiers

Access: api.type.TransportVehicle.Modifiers

Contains modifiers for the entire transport vehicle

Used in the base game: 4 times in 4 files

base/content/gui/gui/entity_window/vehicle/vehicle.tl:28

local state = engine_react_util.useStepState(function() : Engine.Component.TransportVehicle.Modifiers
base/content/gui/gui/entity_window/vehicle/vehicle_eow.script.tl:469
modifiers : Engine.Component.TransportVehicle.Modifiers
base/content/gui/gui/line_vehicle_mgmt/vehicle_store_util.tl:124
modifiers? : Engine.Component.TransportVehicle.Modifiers
base/content/vehicle/vehicle_modifier.script.tl:3
local function getVehicleModifiers(allModifier : { string : { VehicleModifierChanger.Modification : number } }) : Engine.Component.TransportVehicle.Modifiers

Fields

Name Type Description
topSpeedScale number allows scaling the transport vehicle top speed
noiseScale number allows scaling the transport vehicle noise
pollutionScale number allows scaling the transport vehicle pollution
comfortScale number allows scaling the transport vehicle comfort

Functions

new() : Modifiers api/tealdef/api/engine.d.tl:1383

Call as api.type.TransportVehicle.Modifiers.new(…)

Notes

Creates a new, empty Modifiers.

Returns Modifiers

Used in the base game: 3 times in 2 files

base/content/gui/gui/entity_window/vehicle/vehicle.tl:31

return api.type.TransportVehicle.Modifiers.new(tv.modifiers)
base/content/vehicle/vehicle_modifier.script.tl:17
local result = api.type.TransportVehicle.Modifiers.new()

new(Modifiers) : Modifiers api/tealdef/api/engine.d.tl:1384

Call as api.type.TransportVehicle.Modifiers.new(…)

Notes

Creates a new, empty Modifiers.

Returns Modifiers

Used in the base game: 3 times in 2 files

base/content/gui/gui/entity_window/vehicle/vehicle.tl:31

return api.type.TransportVehicle.Modifiers.new(tv.modifiers)
base/content/vehicle/vehicle_modifier.script.tl:17
local result = api.type.TransportVehicle.Modifiers.new()

Engine.Component.TransportVehicle.LoadSpeedModifiers

record api/tealdef/api/engine.d.tl:1397

record LoadSpeedModifiers

Access: api.type.TransportVehicle.LoadSpeedModifiers

Contains current effective modifiers for the transport vehicle load speed.

Used in the base game: 2 times in 1 file

base/content/gui/gui/main/cargo_react_util.tl:51

cargo_react_util.makeTooltipStockCompatibility = function(compatibility : Engine.Component.TransportVehicle.LoadSpeedModifiers) : string

Fields

Name Type Description
vehicleOverlength number the modifier poriton because of overlength with the terminal
stockCompatibility number the compatibility with the stock
vehicleCompatibility number the compatibility with the terminal
vehicleIncompatibility number the incompatibility with the terminal

Functions

getTotalPenalty(LoadSpeedModifiers) : number api/tealdef/api/engine.d.tl:1408

Call as loadSpeedModifiers:getTotalPenalty(…) (method)

computed total penalty from all modifiers

Returns number

Used in the base game: 2 times in 2 files

base/content/gui/gui/entity_window/entity_window_util.tl:2222

local totalPenalty = loadSpeedModifiers ~= nil and loadSpeedModifiers:getTotalPenalty() or 0.0
base/content/gui/gui/main/cargo_react_util.tl:52
local total = 1 / compatibility:getTotalPenalty()

Engine.Component.TransportVehicle.Config

record api/tealdef/api/engine.d.tl:1412

record Config

Access: api.type.TransportVehicle.Config

Contains additional data for the transport vehicle

Fields

Name Type Description
transportModes {TransportMode : boolean}
allCaps {CargoTypeId} Capacity per cargo type, indexed by cargo type id + 1 (Lua arrays are 1-based). The base game checks config.allCaps[cargoTypeId + 1] > 0 to see whether a vehicle can carry a cargo type.
capacities {CargoTypeId} all cargo capacities of the vehicle
loadSpeeds {number}
reversible boolean

Functions

new() : Config api/tealdef/api/engine.d.tl:1413

Call as api.type.TransportVehicle.Config.new(…)

Notes

Creates a new, empty Config.

Returns Config

Engine.Component.TransportVehicle.LoadState

record api/tealdef/api/engine.d.tl:1424

record LoadState

Access: api.type.TransportVehicle.LoadState

Contains additional data for the transport vehicle

Fields

Name Type Description
None LoadState Not in a loading cycle at a terminal.
Arrived LoadState Arrived at the terminal.
Unloading LoadState Unloading cargo. used 3× in the base game
Loading LoadState Loading cargo. used 4× in the base game
WaitForScheduledDeparture LoadState Waiting for the scheduled departure; the base game shows "Ensuring safe distance". used 1× in the base game
Departing LoadState Departing from the terminal.

Functions

new() : LoadState api/tealdef/api/engine.d.tl:1425

Call as api.type.TransportVehicle.LoadState.new(…)

Notes

Creates a new, empty LoadState.

Returns LoadState

Engine.Component.TransportVehicle.PendingIncomeParams

record api/tealdef/api/engine.d.tl:1436

record PendingIncomeParams

Access: api.type.TransportVehicle.PendingIncomeParams

Contains information about pending split income for the transport vehicle

Fields

Name Type Description
amount integer total income pending to be unloaded
carrier Carrier the carrier for which the income is pending
vehicleEntity Engine.Entity accounted vehicle entity id
lineEntity Engine.Entity accounted line entity id

Functions

new() : PendingIncomeParams api/tealdef/api/engine.d.tl:1437

Call as api.type.TransportVehicle.PendingIncomeParams.new(…)

Notes

Creates a new, empty PendingIncomeParams.

Returns PendingIncomeParams

Engine.Component.TransportVehicle.PendingIncomeParams.EntityRev0

record api/tealdef/api/engine.d.tl:1440

record EntityRev0

Access: api.type.TransportVehicle.PendingIncomeParams.EntityRev0

Contains information about entity and revision for the pending income

Fields

Name Type Description
entity Engine.Entity the entity id
rev0 integer the revision 0 of the entity