Skip to main content

Vehicle

A vehicle is an extension of the Entity class.

Example

// Get the vehicle a player is driving.
const vehicle = alt.Vehicle.all.find(veh => veh.driver && veh.driver.name === 'Stuyk');
if (!vehicle) {
console.log('Stuyk is not driving a vehicle');
} else {
console.log('Stuyk is driving a vehicle.')
const player = vehicle.driver;
}

Export

Hierarchy

  • Entity
    • Vehicle

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Vehicle(model: string | number, x: number, y: number, z: number, rx: number, ry: number, rz: number, streamingDistance?: number): Vehicle
  • new Vehicle(model: string | number, pos: IVector3, rot: IVector3, streamingDistance?: number): Vehicle

Properties

publicreadonlyaccelerationLevel

accelerationLevel: number

publicactiveRadioStation

activeRadioStation: RadioStation

Gets or sets the active radio station.

Example

const someVehicle = alt.Vehicle.all[0];
const stationNumber = someVehicle.activeRadioStation;
console.log(`Current Station: ${stationNumber}`);

someVehicle.activeRadioStation = 255;
console.log(`Vehicle radio station was turned off.`);

publicreadonlyattached

attached: null | Vehicle

Gets a vehicle that is attached to the vehicle instance.

publicreadonlyattachedTo

attachedTo: null | Vehicle

Gets a vehicle where the vehicle is attached to.

publicboatAnchorActive

boatAnchorActive: boolean

Gets or sets the status of the boat anchor.

publicbodyAdditionalHealth

bodyAdditionalHealth: number

Gets or sets the additional body health.

publicbodyHealth

bodyHealth: number

Gets or sets the body health.

publicreadonlybrakeLevel

brakeLevel: number

publiccollision

collision: boolean

publiccounterMeasureCount

counterMeasureCount: number

publiccustomPrimaryColor

customPrimaryColor: RGBA

Gets or sets the custom primary color as a RGBA type.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
someVehicle.customPrimaryColor = new alt.RGBA(255, 0, 0);
console.log(`Vehicle custom primary color was set to red`);

publiccustomSecondaryColor

customSecondaryColor: RGBA

Gets or sets the custom secondary color as a RGBA type.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
someVehicle.customSecondaryColor = new alt.RGBA(255, 0, 0);
console.log(`Vehicle custom secondary color was set to red`);

publiccustomTires

customTires: boolean

Gets or sets if the vehicle instance has custom tires.

publicdarkness

darkness: number

Applies some decoration effects to the vehicle (e.g.: It makes the hydra looking rusty or applies snow to the front bumper of policeold1). Does not work on every vehicle model.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
someVehicle.darkness = 500;

publicdashboardColor

dashboardColor: number

Gets or sets the dashboard color of the vehicle.

Dash board colors range from 0 to 159.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
someVehicle.dashboardColor = 139;

publicreadonlydaylightOn

daylightOn: boolean

Gets the current state of the daylights.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
if (someVehicle.daylightOn) {
console.log('Vehicle daylights are on');
} else {
console.log('Vehicle daylights are off');
}

publicreadonlydestroyed

destroyed: boolean

Gets if a vehicle is destroyed.

Destroyed is set to true when specific game activities cause the engine to stop. Explosions, being underwater, crashing too much, etc.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);

if (someVehicle.destroyed) {
console.log(`The elegy has been destroyed.`);
}

publicdimension

dimension: number

Object dimension.

Remarks

Check https://docs.altv.mp/articles/dimensions.html to understand how it works.

publicdirtLevel

dirtLevel: number

Gets or sets the dirt level of the vehicle.

publicdriftModeEnabled

driftModeEnabled: boolean

Gets or sets the drift mode state of the vehicle.

publicreadonlydriver

driver: null | Player

Gets the current driver of the vehicle. It returns null, if there is no driver.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
const driver = someVehicle.driver;

if (driver) {
console.log(`There is currently a player driving this car. ${driver.name}`);
}

publicengineHealth

engineHealth: number

Gets or sets the current engine health.

Default maximum engine health is 1000. The vehicle.repair() function should be used to repair a vehicle if the engine health is less than or equal to zero.

This example demonstrates that when you drive through a ColShape it will repair the vehicle.

Example

const someColShape = new alt.ColshapeCircle(-1295.9208984375, 86.0835189819336, 2);
someColShape.repairVehicles = true;

alt.on('entityEnterColshape', (colshape, entity) => {
// Check if the entity is a vehicle or not.
if (!(entity instanceof alt.Vehicle)) {
return;
}

// Check if it's the right colshape to do this.
if (!colshape.repairVehicles) {
return;
}

if (entity.destroyed) {
entity.repair();
console.log('Repaired Destroyed Vehicle');
return;
}

entity.engineHealth = 1000;
console.log('Repaired Vehicle')
});

publicengineOn

engineOn: boolean

Gets or sets the engine state of the vehicle.

The functionality of the vehicle engine can be triggered on either client-side or server-side. If you want to trigger the engine on client-side use native.setVehicleEngineOn.

Example

const vehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
vehicle.engineOn = true;

publicreadonlyflamethrowerActive

flamethrowerActive: boolean

Gets if a flamethrower of a vehicle is active on vehicle models like cerberus.

publicreadonlyfrontWheels

frontWheels: number

Gets the type of the front wheels.

publicfrozen

frozen: boolean

publicreadonlyhandbrakeActive

handbrakeActive: boolean

Gets if the handbrake of a car is active.

publicreadonlyhasArmoredWindows

hasArmoredWindows: boolean

Gets if the car has armored windows.

publicreadonlyhasTimedExplosion

hasTimedExplosion: boolean

publicheadlightColor

headlightColor: number

Gets or sets the headlight color of a vehicle.

publichornActive

hornActive: boolean

publichybridExtraActive

hybridExtraActive: boolean

publichybridExtraState

hybridExtraState: number

publicreadonlyid

id: number

publicinteriorColor

interiorColor: number

Gets or sets the interior color of a vehicle.

publicisMissionTrain

isMissionTrain: boolean

Gets or sets if the created train is a mission train.

publicisTrainCaboose

isTrainCaboose: boolean

Gets or sets if the train is a caboose.

publicisTrainEngine

isTrainEngine: boolean

Gets or sets if the train is the engine of the train.

publiclightState

lightState: number

publiclightsMultiplier

lightsMultiplier: number

Gets or sets the lights intensity and distance of a vehicle.

publiclivery

livery: number

Gets or sets the livery of a vehicle.

publiclockState

lockState: VehicleLockState

Gets or sets the lock state of a vehicle.

publicmanualEngineControl

manualEngineControl: boolean

Enables or disables the manual engine control.

publicmodKit

modKit: number

Gets or sets the current mod kit of a vehicle.

publicreadonlymodKitsCount

modKitsCount: number

Gets the maximum amount of vehicle mod kits available.

publicneon

neon: IVehicleNeon

Enables or disables a neon light on a specific position.

publicneonColor

neonColor: RGBA

Gets or sets the color of the neon lights.

publicreadonlynetOwner

netOwner: null | Player

Network owner of the entity.

Remarks

Network owner is responsible for syncing entity with the server. It changes when actual network owner passes the migration range, then the new one is determined based on distance from the entity (if entity is a vehicle, then the driver will take priority for becoming network owner). Disabling migration range will stop this process from happening until turned on again.

publicreadonlynightlightOn

nightlightOn: boolean

Gets the current state of the nightlights.

publicnumberPlateIndex

numberPlateIndex: NumberPlateStyle

Gets or sets the current number plate style.

publicnumberPlateText

numberPlateText: string

Gets or sets the current text displayed on the number plate.

publicreadonlypassengers

passengers: IVehiclePassenger

Gets all passengers of the vehicle including the driver itself.

Example

const someVehicle = new alt.Vehicle('elegy', 0, 0, 0, 0, 0, 0);
const passengers = someVehicle.passengers;

for (const [seat, player] of Object.entries(passengers)) {
alt.log(`Seat: ${seat} - Player: ${player.name}`);
}

publicpearlColor

pearlColor: number

Gets or sets the pearl color of a vehicle.

publicpetrolTankHealth

petrolTankHealth: number

Gets or sets the current health amount of the petrol tank.

publicpos

pos: Vector3

Object position.

publicprimaryColor

primaryColor: number

Gets or sets the current primary color of a vehicle.

publicquaternion

quaternion: Quaternion

Gets or sets the vehicles rotation with a quaternion.

publicreadonlyrearWheels

rearWheels: number

Gets the type of the rear wheels.

publicreadonlyrefCount

refCount: number

Returns the ref count of the entity.

Remarks

It’s only available in debug-mode.

publicreadonlyrepairsCount

repairsCount: number

Gets how often a vehicle got repaired.

publicrocketRefuelSpeed

rocketRefuelSpeed: number

publicroofClosed

roofClosed: boolean

Opens or closes the vehicle roof (if vehicle has this feature, otherwise it is always true).

Example

const surano = new alt.Vehicle('surano', 0, 0, 72, 0, 0, 0);
surano.roofClosed = false; // Hides the roof of the car

publicroofLivery

roofLivery: number

Gets or sets the roof livery of a vehicle.

publicroofState

roofState: boolean

Gets or sets the roof state of a vehicle (closed or open).

Deprecated

Use roofClosed instead.

publicrot

rot: Vector3

Entity rotation.

Remarks

Values are provided in radians.

publicscriptMaxSpeed

scriptMaxSpeed: number

Remarks

Value is in meters per second.

publicsecondaryColor

secondaryColor: number

Gets or sets the current secondary color.

publicsirenActive

sirenActive: boolean

Gets or sets the siren state of a vehicle.

publicreadonlysteeringAngle

steeringAngle: number

publicstreamed

streamed: boolean

Whether the entity should be streamed for other entities.

publicstreamingDistance

streamingDistance: number

publicreadonlytimedExplosionCulprit

timedExplosionCulprit: Player

publicreadonlytimedExplosionTime

timedExplosionTime: number

publicreadonlytimestamp

timestamp: number

publictireSmokeColor

tireSmokeColor: RGBA

Gets or sets the color of the tire smoke.

publictrainCarriageConfigIndex

trainCarriageConfigIndex: number

Gets or sets the config index of the train’s carriage.

publictrainConfigIndex

trainConfigIndex: number

Gets or sets the trains config index.

Remarks

You can find a list of all possible config indices in the trains.xml. Valid indices are between 1 and 25.

publictrainCruiseSpeed

trainCruiseSpeed: number

Gets or sets the cruise speed of the train.

publictrainDirection

trainDirection: boolean

Gets or sets the direction of the train.

publictrainDistanceFromEngine

trainDistanceFromEngine: number

Gets or sets the distance of the trains to the engine.

publicreadonlytrainEngineId

trainEngineId: null | Vehicle

Gets the engine of the train.

publictrainForceDoorsOpen

trainForceDoorsOpen: boolean

Gets or sets if the doors of the trains should be forced open.

publicreadonlytrainLinkedToBackwardId

trainLinkedToBackwardId: null | Vehicle

Gets another train that is linked to the back of the train. Returns null if there is no linked train.

publicreadonlytrainLinkedToForwardId

trainLinkedToForwardId: null | Vehicle

Gets another train that is linked to the back of the train. Returns null if there is no linked train in front.

publictrainPassengerCarriages

trainPassengerCarriages: boolean

Gets or sets if the train is a passenger carriage.

publictrainRenderDerailed

trainRenderDerailed: boolean

Gets or sets if the trains is rendered derailed.

publictrainTrackId

trainTrackId: number

Gets or sets the track id of the train.

Remarks

Valid track ids are between 0 and 11.

publictrainUnk1

trainUnk1: boolean

publictrainUnk2

trainUnk2: boolean

publictrainUnk3

trainUnk3: boolean

publicreadonlytype

type: BaseObjectType

Type of the object.

publicreadonlyvalid

valid: boolean

Object usability.

Returns

False if object is no longer usable.

publicreadonlyvelocity

velocity: Vector3

Gets the velocity vector of a vehicle.

publicvisible

visible: boolean

Whether the entity is visible.

publicwheelColor

wheelColor: number

Gets or sets the wheel color.

publicreadonlywheelType

wheelType: number

Gets the wheel type.

publicreadonlywheelsCount

wheelsCount: number

Gets the amount of wheels of a vehicle.

publicwindowTint

windowTint: WindowTint

Gets or sets the window tint of a vehicle.

publicstaticreadonlyall

all: readonly Vehicle[]

Array with all vehicles.

Remarks

This creates a clone of the array everytime it is called. It is advised to call this once and store the result in a variable, before iterating over it.

Example

const vehicles = alt.Vehicle.all; // Store it in a variable, so it doesn't create a copy of the array on each iteration
for(let i = 0; i < vehicles.length; i++)
{
alt.log(`${vehicles[i].model}`); // Logs the model of every vehicle
}

publicstaticreadonlycount

count: number

Accessors

publicmodel

  • get model(): number

    Getter

  • Get the entity model hash.

    Example

    const comparisonHash = alt.hash('infernus');
    if (comparisonHash === someVehicle.model) {
    console.log('This vehicle is an infernus.');
    } else {
    console.log('This vehicle is not an infernus.');
    }

    Remarks

    Vehicle doesn’t provide a setter.

Methods

publicattachTo

  • attachTo(entity: Entity, entityBone: string | number, ownBone: string | number, pos: IVector3, rot: IVector3, enableCollisions: boolean, noFixedRotation: boolean): void
  • Attaches this entity to another entity.

publicdeleteMeta

  • deleteMeta(key: string): void
  • deleteMeta<K>(key: K): void

publicdeleteStreamSyncedMeta

  • deleteStreamSyncedMeta(key: string): void
  • deleteStreamSyncedMeta<K>(key: K): void

publicdeleteSyncedMeta

  • deleteSyncedMeta(key: string): void
  • deleteSyncedMeta<K>(key: K): void

publicdestroy

  • destroy(): void
  • Removes the object from the world.

publicdetach

  • detach(): void
  • Detaches this entity if attached to another entity.

publicdoesWheelHasTire

  • doesWheelHasTire(wheelId: number): boolean
  • Returns if a specific wheel has a tire.

publicgetAppearanceDataBase64

  • getAppearanceDataBase64(): string
  • Returns the appearance of a vehicle as a base64 string.

publicgetArmoredWindowHealth

  • getArmoredWindowHealth(windowId: number): number
  • Returns the health of a specific armored window.

publicgetArmoredWindowShootCount

  • getArmoredWindowShootCount(windowId: number): number
  • Returns the amount of shoots that a specific armoured window received.

publicgetBumperDamageLevel

  • getBumperDamageLevel(bumperId: VehicleBumper): VehicleBumperDamage
  • getBumperDamageLevel<T, V>(bumperId: T): V
  • Returns the damage level of a specific bumper.

publicgetDamageStatusBase64

  • getDamageStatusBase64(): string
  • Returns the damage status of a vehicle as a base64 string.

publicgetDoorState

  • getDoorState(doorId: VehicleDoor): VehicleDoorState
  • getDoorState<T, V>(doorId: T): V
  • Returns the state of a specific door.

publicgetExtra

  • getExtra(extraId: number): boolean
  • Returns the state of a specific extra of a vehicle.

    Remarks

    Extras are not available on every vehicle model.

publicgetGamestateDataBase64

  • getGamestateDataBase64(): string
  • Returns the game state data of a vehicle as a base64 string.

publicgetHealthDataBase64

  • getHealthDataBase64(): string
  • Returns the health data of a vehicle as a base64 string.

publicgetMeta

  • getMeta<K>(key: Exclude<K, never>): unknown
  • getMeta<K>(key: K): undefined | ICustomVehicleMeta[K]
  • getMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetMetaDataKeys

  • getMetaDataKeys(): readonly string[]

publicgetMod

  • getMod(modType: VehicleModType): number
  • getMod<T>(modType: T): number
  • Returns the mod value for a specific mod type.

publicgetModsCount

  • getModsCount(modType: VehicleModType): number
  • getModsCount<T>(modType: T): number
  • Returns the amount of possible mod values for a specific mod type.

publicgetPartBulletHoles

  • getPartBulletHoles(partId: VehiclePart): number
  • getPartBulletHoles<T>(partId: T): number
  • Returns the amount of bullet holes of a vehicle part.

publicgetPartDamageLevel

  • getPartDamageLevel(partId: VehiclePart): VehiclePartDamage
  • getPartDamageLevel<T, V>(partId: T): V
  • Returns the damage level of a vehicle part.

publicgetScriptDataBase64

  • getScriptDataBase64(): string
  • Returns the script data of a vehicle as a base64 string.

publicgetStreamSyncedMeta

  • getStreamSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getStreamSyncedMeta<K>(key: K): undefined | ICustomVehicleStreamSyncedMeta[K]
  • getStreamSyncedMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetStreamSyncedMetaKeys

  • getStreamSyncedMetaKeys(): readonly string[]

publicgetSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getSyncedMeta<K>(key: K): undefined | ICustomVehicleSyncedMeta[K]
  • getSyncedMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetSyncedMetaKeys

  • getSyncedMetaKeys(): readonly string[]

publicgetWeaponCapacity

  • getWeaponCapacity(weaponIndex: number): number

publicgetWheelHealth

  • getWheelHealth(wheelId: number): number
  • Returns the health of a specific wheel.

publichasMeta

  • hasMeta(key: string): boolean
  • hasMeta<K>(key: K): boolean

publichasStreamSyncedMeta

  • hasStreamSyncedMeta(key: string): boolean
  • hasStreamSyncedMeta<K>(key: K): boolean

publichasSyncedMeta

  • hasSyncedMeta(key: string): boolean
  • hasSyncedMeta<K>(key: K): boolean

publicisLightDamaged

  • isLightDamaged(lightId: number): boolean
  • Returns if a specific light is damaged.

publicisSpecialLightDamaged

  • isSpecialLightDamaged(specialLightId: number): boolean
  • Returns if a specific special light is damaged.

publicisWheelBurst

  • isWheelBurst(wheelId: number): boolean
  • Returns if a specific wheel is burst.

publicisWheelDetached

  • isWheelDetached(wheelId: number): boolean
  • Returns if a specific wheel is detached.

publicisWheelOnFire

  • isWheelOnFire(wheelId: number): boolean
  • Returns if a specific wheel is on fire.

publicisWindowDamaged

  • isWindowDamaged(windowId: number): boolean
  • Returns if a specific window is damaged.

publicisWindowOpened

  • isWindowOpened(windowId: number): boolean
  • Returns if a specific window is open.

publicrepair

  • repair(): void

publicresetNetOwner

  • resetNetOwner(disableMigration?: boolean): void
  • Resets overwritten network owner.

    Remarks

    See Entity~netOwner to understand how network owner works.

    <p><b> Keep in mind that disabling migration can lead to unexpected behaviour when the network owner gets out of the streaming range. </b></p>

publicsetAppearanceDataBase64

  • setAppearanceDataBase64(data: string): void
  • Sets the appearance of a vehicle with a base64 string.

publicsetArmoredWindowHealth

  • setArmoredWindowHealth(windowId: number, health: number): void
  • Sets the health of a specific armored window.

publicsetArmoredWindowShootCount

  • setArmoredWindowShootCount(windowId: number, count: number): void
  • Sets the shoot count of a specific armoured window.

setBadge

  • setBadge(textureDictionary: number, texture: number, pos: VehicleBadgePosition, pos2?: VehicleBadgePosition, pos3?: VehicleBadgePosition, pos4?: VehicleBadgePosition): void

publicsetBumperDamageLevel

  • setBumperDamageLevel(bumperId: VehicleBumper, level: VehicleBumperDamage): void
  • setBumperDamageLevel<T, V>(bumperId: T, level: V): void
  • Sets the damage level of a specific bumper.

publicsetDamageStatusBase64

  • setDamageStatusBase64(data: string): void
  • Sets the damage status of a vehicle based on a base64 string.

publicsetDoorState

  • setDoorState(doorId: VehicleDoor, state: VehicleDoorState): void
  • setDoorState<T, V>(doorId: T, state: V): void
  • Sets the state of a specific door

publicsetExtra

  • setExtra(extraId: number, state: boolean): void
  • Sets the state of an extra of a vehicle.

    Remarks

    Setting extras on vehicle does not work for every vehicle model. For example you can change the light bar of a police car with this method.

publicsetGamestateDataBase64

  • setGamestateDataBase64(data: string): void
  • Sets the game state data of a vehicle with a given base64 string.

publicsetHealthDataBase64

  • setHealthDataBase64(data: string): void
  • Sets the health data of a vehicle with a given base64 string.

publicsetLightDamaged

  • setLightDamaged(lightId: number, isDamaged: boolean): void
  • Sets a specific light of the vehicle either damaged or not.

publicsetMeta

  • setMeta<K>(key: K, value: InterfaceValueByKey<ICustomVehicleMeta, K, unknown, void>): void
  • setMeta<K>(key: K, value: ICustomVehicleMeta[K]): void
  • setMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomVehicleMeta, K, V, void>): void
  • Type parameters

    • K: string

publicsetMod

  • setMod(modType: VehicleModType, modId: number): void
  • setMod<T>(modType: T, modId: number): void
  • Applies a specific mod of a given mod type.

publicsetNetOwner

  • setNetOwner(player: Player, disableMigration?: boolean): void
  • Changes network owner to the specified player.

    Remarks

    See Entity~netOwner to understand how network owner works.

    <p><b> Keep in mind that disabling migration can lead to unexpected behaviour when the network owner gets out of the streaming range. </b></p>

publicsetPartBulletHoles

  • setPartBulletHoles(partId: VehiclePart, count: number): void
  • setPartBulletHoles<T>(partId: T, count: number): void
  • Applies bullet holes to a specific vehicle part.

publicsetPartDamageLevel

  • setPartDamageLevel(partId: VehiclePart, level: VehiclePartDamage): void
  • setPartDamageLevel<T, V>(partId: T, level: V): void
  • Sets the damage level of a vehicle part.

publicsetRearWheels

  • setRearWheels(wheelId: number): void
  • Sets type of the rear wheels.

publicsetScriptDataBase64

  • setScriptDataBase64(data: string): void
  • Sets the script data of a vehicle based on a base64 string.

publicsetSearchLightTo

  • setSearchLightTo(entity: Entity, state: boolean): void
  • Activates the searchlight and follows the target.

    Remarks

    Entity parameter isn’t working for now and this can only be used for helicopter searchlights.

publicsetSpecialLightDamaged

  • setSpecialLightDamaged(specialLightId: number, isDamaged: boolean): void
  • Sets if a special light is damaged.

publicsetStreamSyncedMeta

  • setStreamSyncedMeta<K>(key: K, value: InterfaceValueByKey<ICustomVehicleStreamSyncedMeta, K, unknown, void>): void
  • setStreamSyncedMeta<K>(key: K, value: ICustomVehicleStreamSyncedMeta[K]): void
  • setStreamSyncedMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomVehicleStreamSyncedMeta, K, V, void>): void
  • Type parameters

    • K: string

publicsetSyncedMeta

  • setSyncedMeta<K>(key: K, value: InterfaceValueByKey<ICustomVehicleSyncedMeta, K, unknown, void>): void
  • setSyncedMeta<K>(key: K, value: ICustomVehicleSyncedMeta[K]): void
  • setSyncedMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomVehicleSyncedMeta, K, V, void>): void
  • Type parameters

    • K: string

publicsetTimedExplosion

  • setTimedExplosion(state: boolean, culprit: Player, time: number): void

publicsetTrainEngineId

  • setTrainEngineId(vehicle: null | Vehicle): void
  • Set a train as an engine of a train.

publicsetTrainLinkedToBackwardId

  • setTrainLinkedToBackwardId(vehicle: null | Vehicle): void
  • Links another train to the back of the train.

publicsetTrainLinkedToForwardId

  • setTrainLinkedToForwardId(vehicle: null | Vehicle): void
  • Links another train to the front of the train.

publicsetWeaponCapacity

  • setWeaponCapacity(weaponIndex: number, capacity: number): void

publicsetWheelBurst

  • setWheelBurst(wheelId: number, state: boolean): void
  • Sets if a specific wheel is burst.

publicsetWheelDetached

  • setWheelDetached(wheelId: number, state: boolean): void
  • Sets a wheel either detached or attached.

publicsetWheelFixed

  • setWheelFixed(wheelId: number): void
  • Repairs a specific wheel.

publicsetWheelHasTire

  • setWheelHasTire(wheelId: number, state: boolean): void
  • Sets if a specific wheel has a tire.

publicsetWheelHealth

  • setWheelHealth(wheelId: number, health: number): void
  • Sets the health of a specific wheel.

publicsetWheelOnFire

  • setWheelOnFire(wheelId: number, state: boolean): void
  • Sets a wheel either on fire or not

publicsetWheels

  • setWheels(wheelType: number, wheelId: number): void
  • Applies a wheel style based on the type and variation.

publicsetWindowDamaged

  • setWindowDamaged(windowId: number, isDamaged: boolean): void
  • Sets if a specific window is damaged.

publicsetWindowOpened

  • setWindowOpened(windowId: number, state: boolean): void
  • Sets if a specific window is open.

publicstaticgetByID

  • getByID(id: number): null | Vehicle
  • Retrieves the vehicle from the pool.