VehicleStateSnapshot
An immutable snapshot of shared settings and supported damage condition for one active networked vehicle. Use it to read the current state or to restore that state after creating a replacement.
Definition
Section titled “Definition”type VehicleStateSnapshot = Readonly<{ vehicleId: number; isEngineOn: boolean; headlights: VehicleHeadlightMode; windows: Readonly<Partial<Record<VehicleWindowName, boolean>>>; doors: Readonly<Partial<Record<VehicleDoorName, boolean>>>; isHoodOpen?: boolean; isTrunkOpen?: boolean; isLocked: boolean; isSirenOn: boolean; condition?: VehicleCondition;}>;Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
vehicleId |
number |
The vehicle’s network ID. |
isEngineOn |
boolean |
Whether its engine is on. Bicycles, trailers and train carriages have none: setting it does nothing. |
headlights |
VehicleHeadlightMode |
The headlight mode. |
windows |
Partial<Record<VehicleWindowName, boolean>> |
Open state for supported windows only. Helicopters and planes have none. |
doors |
Partial<Record<VehicleDoorName, boolean>> |
Open state for supported passenger doors only. |
isHoodOpen |
boolean |
Present only when the model supports a hood. Helicopters and planes have none. |
isTrunkOpen |
boolean |
Present only when the model supports a trunk. Helicopters and planes have none. |
isLocked |
boolean |
Whether it is locked. A locked vehicle of any kind, a bike or a boat included, keeps every player out. |
isSirenOn |
boolean |
The persistent siren or alarm setting. |
condition |
VehicleCondition |
Health and supported damage condition, when available. |
The previous engineOn, hoodOpen, trunkOpen, locked and sirenOn fields remain available as deprecated aliases for
this minor version. Reading one logs a warning; use the is… field instead.
Related
Section titled “Related”vehicles.getState: read a snapshotvehicles.restoreState: restore it after spawningVehicleStateUpdate: partial values to set