Skip to content

vehicle_modifier

Source: base/tealdef/vehicle/vehicle_modifier.d.tl

Notes

Types of the VehicleModifier game script (/vehicle/vehicle_modifier.script.tl), which combines speed, noise, pollution and comfort modifiers from several sources per vehicle.

VehicleModifierChanger

record global base/tealdef/vehicle/vehicle_modifier.d.tl:3

global record VehicleModifierChanger

Notes

Payload of the ChangeModifier event of the VehicleModifier game script.

Details

Each source (id) sets its own modifiers for a vehicle. The script adds up the deviations from 1.0 of all sources and applies the result with api.cmd.makeVehicleSetModifiersCmd.

Example

-- from base/content/landmarks/landmarks.script.tl
local vehicleChanger = { entity = entity, modifications = { Comfort = 1.25 }, id = "landmarks.script" }
api.cmd.sendCommand(api.cmd.makeScriptingSendEventCmd("", "VehicleModifier", "ChangeModifier", vehicleChanger))

Fields

Name Type Description
entity Engine.Entity The vehicle.
modifications {Modification : number} Factors by property, 1.0 = unchanged; an empty table removes this source's modifiers.
id string Name of the source, e.g. "landmarks.script"; a later event with the same id replaces the earlier modifiers.

VehicleModifierChanger.Modification

enum base/tealdef/vehicle/vehicle_modifier.d.tl:4

enum Modification

Notes

Vehicle property a modifier changes.

Used in the base game: 3 times in 2 files

base/content/vehicle/vehicle_modifier.script.tl:3

local function getVehicleModifiers(allModifier : { string : { VehicleModifierChanger.Modification : number } }) : Engine.Component.TransportVehicle.Modifiers
base/content/mission/mission/tasks/vehicle_util/vehicle_modifier.tl:14
local validTypes<total> : { VehicleModifierChanger.Modification : boolean } = {

Value Description
"TopSpeed" Top speed scale.
"Noise" Noise scale.
"Pollution" Pollution scale.
"Comfort" Comfort scale.

VehicleModifierState

record global base/tealdef/vehicle/vehicle_modifier.d.tl:15

global record VehicleModifierState

Notes

State of the VehicleModifier game script.

Fields

Name Type Description
modificationMap {Engine.Entity : {string : {VehicleModifierChanger.Modification : number}}} Modifiers per vehicle and source id.