# CyberM.vehicles — client runtime

Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.

6 functions.

## all

```lua
CyberM.vehicles.all()
```

`GAME` — Requires a live game instance.

Lists every vehicle currently streamed to this client.

Requires `vehicles.read`. Returns an empty array when permission or the projection backend is unavailable. Every entry has the exact shape returned by `CyberM.vehicles.get`; server vehicles outside the client's streaming interest set are intentionally absent.

Returns: `array of vehicle snapshots`

Registered in `ResourceHost.cpp` (line 6691) as `LuaVehiclesAll`.

## get

```lua
CyberM.vehicles.get(id)
```

`GAME` — Requires a live game instance.

Reads one streamed server-owned vehicle.

Client read-only API requiring `vehicles.read`. The snapshot contains durable state (`health`, flags, six door bits, four open-window bits, tyre/glass/light masks and the 30-cell body grid), authority and occupants, an ephemeral generation-checked local entity handle, plus the latest drivetrain and wheel telemetry. Open windows and broken glass are separate states. Creation, repair and arbitrary mutation are server-only; the complete 43-method server surface is documented in `wiki/vehicles.md`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |

Returns: `table { id, record, entity, engineEntity, revision, physicsOwner, authorityEpoch, flags, health, doors, windows, tires, bodyDamage, brokenGlass, brokenLights, damage, speed, rpm, rpmMax, throttle, brake, steering, wheelRotation, suspensionLongitudinal, suspensionTransversal, burnout, gear, onGround, reversing, streamed, locallyOwned, occupants }, or nil`

Registered in `ResourceHost.cpp` (line 6690) as `LuaVehicleGet`.

## isDoorOpen

```lua
CyberM.vehicles.isDoorOpen(id, door)
```

`GAME` — Requires a live game instance.

Reads a canonical vehicle door, trunk, or hood state.

Client read-only API requiring `vehicles.read`. Accepts index 0..5, a standard camelCase/snake_case name, or a `CyberM.vehicles.doors` constant. This reads the replicated reversible opening mask.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `door` | `integer|string` | required | — |

Returns: `boolean, or nil when denied, unavailable, or unknown`

Registered in `ResourceHost.cpp` (line 6692) as `LuaVehicleIsDoorOpen`.

## isWindowOpen

```lua
CyberM.vehicles.isWindowOpen(id, window)
```

`GAME` — Requires a live game instance.

Reads a canonical openable side-window state.

Client read-only API requiring `vehicles.read`. Windows use indexes 0..3 and names `frontLeft`, `frontRight`, `backLeft`, and `backRight`. This does not report shattered glass; inspect `brokenGlass` or `damage.glass` in the vehicle snapshot for that.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `window` | `integer|string` | required | — |

Returns: `boolean, or nil when denied, unavailable, or unknown`

Registered in `ResourceHost.cpp` (line 6693) as `LuaVehicleIsWindowOpen`.

## taskPlayerEnterVehicle

```lua
CyberM.vehicles.taskPlayerEnterVehicle(playerId, vehicleId, seat)
```

`GAME` — Requires a live game instance.

Reserved animated presentation path for a replicated occupant.

Requires `vehicles.presentation` and an already-authorized occupancy tuple. The first native NPC `MountAIEvent` implementation could dereference an absent workspot object on remote player proxies, so this method currently fails closed with `animated_entry_unsupported`. Use `warpPlayerIntoVehicle` until the staged door/workspot implementation is validated on two clients.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer|string` | required | — |
| `vehicleId` | `integer|string` | required | — |
| `seat` | `string|integer` | required | — |

Returns: `false`, `animated_entry_unsupported or another validation reason`

Registered in `ResourceHost.cpp` (line 6695) as `LuaVehicleTaskPlayerEnter`.

## warpPlayerIntoVehicle

```lua
CyberM.vehicles.warpPlayerIntoVehicle(playerId, vehicleId, seat)
```

`GAME` — Requires a live game instance.

Presents a replicated player instantly in an authoritative vehicle seat.

Requires `vehicles.presentation`. This is a visual client operation for an existing server-owned vehicle and occupancy assignment; it does not claim the seat or physics authority. The exact `(player, vehicle, seat)` tuple must already exist in the replicated ledger or the call fails with `occupancy_mismatch`. Seats accept canonical names, common aliases, or FiveM-compatible -1..2 indices.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer|string` | required | — |
| `vehicleId` | `integer|string` | required | — |
| `seat` | `string|integer` | required | — |

Returns: `true on success, otherwise false`, `reason`

Registered in `ResourceHost.cpp` (line 6694) as `LuaVehicleWarpPlayer`.

