# OPEN//77 Lua API reference

258 registered functions across 38 namespaces, generated from the platform bindings.

Functions are grouped by runtime. A name that appears in both runtimes is not the same function: the server entry is authoritative, the client entry is a local projection.

## Server runtime

Runs on the dedicated server and is authoritative: state written here is the truth every client is told about.

### CyberM.vehicles — server runtime

Runs on the dedicated server and is authoritative: state written here is the truth every client is told about.

43 functions.

#### all

```lua
CyberM.vehicles.all([bucket])
```

`NETWORK` — Uses the network backend.

Lists authoritative server vehicles.

Returns snapshots ordered by CyberM ID. An optional routing bucket filters the result; omitting it returns every vehicle visible to the resource.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `bucket` | `integer` | optional | — |

Returns: `array of vehicle tables`

Registered in `LuaResourceRuntime.cs` (line 2769) as `LuaResourceRuntime.Bootstrap`.

#### breakAllGlass

```lua
CyberM.vehicles.breakAllGlass(id, [count])
```

`NETWORK` — Uses the network backend.

Breaks a range of vehicle glass elements.

Requires `world.vehicles`. Breaks the first `count` destructible-glass bits. The optional count defaults to all 32 and must be in 0..32.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `count` | `integer` | optional | `32` |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2712) as `LuaResourceRuntime.Bootstrap`.

#### breakGlass

```lua
CyberM.vehicles.breakGlass(id, glass)
```

`NETWORK` — Uses the network backend.

Breaks one vehicle glass element.

Requires `world.vehicles`. Convenience wrapper over `setGlassBroken(id, glass, true)`; the canonical bit is replicated and retained for late joiners.

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

Returns: `boolean success`

```lua
CyberM.vehicles.breakGlass(vehicleId, 0)
```

Registered in `LuaResourceRuntime.cs` (line 2710) as `LuaResourceRuntime.Bootstrap`.

#### breakLight

```lua
CyberM.vehicles.breakLight(id, index)
```

`NETWORK` — Uses the network backend.

Breaks one vehicle light.

Requires `world.vehicles`. Convenience wrapper over `setLightBroken(id, index, true)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2719) as `LuaResourceRuntime.Bootstrap`.

#### breakTire

```lua
CyberM.vehicles.breakTire(id, index)
```

`NETWORK` — Uses the network backend.

Breaks one vehicle tire.

Requires `world.vehicles`. Convenience wrapper over `setTireBroken(id, index, true)`. Tire indexes are 0..3.

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

Returns: `boolean success`

```lua
CyberM.vehicles.breakTire(vehicleId, 0)
```

Registered in `LuaResourceRuntime.cs` (line 2724) as `LuaResourceRuntime.Bootstrap`.

#### closeDoor

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

`NETWORK` — Uses the network backend.

Closes a door, trunk, or hood.

Requires `world.vehicles`. Convenience wrapper over `setDoorOpen(id, door, false)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2737) as `LuaResourceRuntime.Bootstrap`.

#### closeWindow

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

`NETWORK` — Uses the network backend.

Closes one side window.

Requires `world.vehicles`. Convenience wrapper over `setWindowOpen(id, window, false)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2747) as `LuaResourceRuntime.Bootstrap`.

#### create

```lua
CyberM.vehicles.create(definition)
```

`NETWORK` — Uses the network backend.

Creates a server-owned network vehicle.

Requires `world.vehicles`. The definition selects the record, transform, routing bucket, appearance, colors, flags, health, and optional initial damage. The server allocates the CyberM ID and replicates the canonical vehicle to interested clients.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `definition` | `table` | required | — |

Returns: `vehicle ID, or `nil, reason``

```lua
local id, reason = CyberM.vehicles.create({
  record = "Vehicle.v_standard2_thorton_galena_player",
  position = { x = -1671.2, y = -710.3, z = 49.9 },
  yaw = 90.0,
})
```

Registered in `LuaResourceRuntime.cs` (line 2677) as `LuaResourceRuntime.Bootstrap`.

#### damageBodyCell

```lua
CyberM.vehicles.damageBodyCell(id, cell, amount)
```

`NETWORK` — Uses the network backend.

Adds damage to one body cell.

Requires `world.vehicles`. Adds the amount to the current normalized cell and clamps the result to 0..1.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `cell` | `integer` | required | — |
| `amount` | `number` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2697) as `LuaResourceRuntime.Bootstrap`.

#### damageBodyZone

```lua
CyberM.vehicles.damageBodyZone(id, zone, amount)
```

`NETWORK` — Uses the network backend.

Adds damage across a body zone.

Requires `world.vehicles`. Adds the amount to each selected body cell and clamps every result to 0..1.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `zone` | `string|table` | required | — |
| `amount` | `number` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2703) as `LuaResourceRuntime.Bootstrap`.

#### get

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

`NETWORK` — Uses the network backend.

Returns one authoritative server vehicle snapshot.

Reads canonical identity, transform, flags, colors, damage, openings, occupants, and authority state. Returns `nil` for an unknown ID.

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

Returns: `vehicle table, or `nil``

Registered in `LuaResourceRuntime.cs` (line 2768) as `LuaResourceRuntime.Bootstrap`.

#### getDamage

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

`NETWORK` — Uses the network backend.

Returns the canonical damage snapshot.

Reads the server-owned body grid and broken glass, light, and tire masks. It returns `nil` when the vehicle ID is unknown.

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

Returns: `damage table, or `nil``

Registered in `LuaResourceRuntime.cs` (line 2693) as `LuaResourceRuntime.Bootstrap`.

#### getDamageProfile

```lua
CyberM.vehicles.getDamageProfile(record)
```

`NETWORK` — Uses the network backend.

Returns a resource-local vehicle damage profile.

Reads the profile registered by the current server resource for the specified vehicle record. Profiles are not shared implicitly between resources.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `record` | `string` | required | — |

Returns: `profile table, or `nil``

Registered in `LuaResourceRuntime.cs` (line 2758) as `LuaResourceRuntime.Bootstrap`.

#### isDoorOpen

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

`NETWORK` — Uses the network backend.

Reads one canonical door opening state.

Server-side authoritative query covering four doors, trunk, and hood. Returns `nil` for an unknown vehicle ID.

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

Returns: `boolean, or `nil``

Registered in `LuaResourceRuntime.cs` (line 2738) as `LuaResourceRuntime.Bootstrap`.

#### isWindowOpen

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

`NETWORK` — Uses the network backend.

Reads one canonical side-window opening state.

Server-side authoritative query for indexes 0..3. It does not report broken glass and returns `nil` for an unknown vehicle.

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

Returns: `boolean, or `nil``

Registered in `LuaResourceRuntime.cs` (line 2748) as `LuaResourceRuntime.Bootstrap`.

#### openDoor

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

`NETWORK` — Uses the network backend.

Opens a door, trunk, or hood.

Requires `world.vehicles`. Convenience wrapper over `setDoorOpen(id, door, true)`.

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

Returns: `boolean success`

```lua
CyberM.vehicles.openDoor(vehicleId, CyberM.vehicles.doors.trunk)
```

Registered in `LuaResourceRuntime.cs` (line 2736) as `LuaResourceRuntime.Bootstrap`.

#### openWindow

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

`NETWORK` — Uses the network backend.

Opens one side window.

Requires `world.vehicles`. Convenience wrapper over `setWindowOpen(id, window, true)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2746) as `LuaResourceRuntime.Bootstrap`.

#### registerDamageProfile

```lua
CyberM.vehicles.registerDamageProfile(record, profile)
```

`NETWORK` — Uses the network backend.

Registers resource-local named damage zones and glass parts.

Requires `world.vehicles`. Profiles are scoped to the calling server resource VM and can extend or override the default body-zone mapping for one vehicle record.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `record` | `string` | required | — |
| `profile` | `table` | required | — |

Returns: ``true``

Registered in `LuaResourceRuntime.cs` (line 2753) as `LuaResourceRuntime.Bootstrap`.

#### remove

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

`NETWORK` — Uses the network backend.

Removes a server-owned network vehicle.

Requires `world.vehicles`. Only the resource that created the vehicle may remove it. Removal clears occupancy and authority before notifying streamed clients.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2767) as `LuaResourceRuntime.Bootstrap`.

#### repair

```lua
CyberM.vehicles.repair(id, [scope])
```

`NETWORK` — Uses the network backend.

Repairs a selected vehicle damage scope.

Requires `world.vehicles`. Supported scopes are `glass`, `body`, `lights`, `tires`, `visual`, `mechanical`, and `full`. The default is `full`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `scope` | `string` | optional | `full` |

Returns: `boolean success`

```lua
CyberM.vehicles.repair(vehicleId, "visual")
```

Registered in `LuaResourceRuntime.cs` (line 2752) as `LuaResourceRuntime.Bootstrap`.

#### repairAllGlass

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

`NETWORK` — Uses the network backend.

Repairs all vehicle glass.

Requires `world.vehicles`. Clears the complete canonical broken-glass mask.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2716) as `LuaResourceRuntime.Bootstrap`.

#### repairAllLights

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

`NETWORK` — Uses the network backend.

Repairs every vehicle light.

Requires `world.vehicles`. Clears the complete canonical broken-light mask.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2721) as `LuaResourceRuntime.Bootstrap`.

#### repairAllTires

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

`NETWORK` — Uses the network backend.

Repairs all four vehicle tires.

Requires `world.vehicles`. Clears the complete canonical broken-tire mask.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2726) as `LuaResourceRuntime.Bootstrap`.

#### repairBodyCell

```lua
CyberM.vehicles.repairBodyCell(id, cell)
```

`NETWORK` — Uses the network backend.

Repairs one body cell.

Requires `world.vehicles`. Sets the selected 1-based body cell to zero damage and replicates the repaired state.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2701) as `LuaResourceRuntime.Bootstrap`.

#### repairBodyZone

```lua
CyberM.vehicles.repairBodyZone(id, zone)
```

`NETWORK` — Uses the network backend.

Repairs every body cell in a zone.

Requires `world.vehicles`. Clears all cells selected by a registered zone name or explicit index array.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2704) as `LuaResourceRuntime.Bootstrap`.

#### repairGlass

```lua
CyberM.vehicles.repairGlass(id, glass)
```

`NETWORK` — Uses the network backend.

Repairs one vehicle glass element.

Requires `world.vehicles`. Convenience wrapper over `setGlassBroken(id, glass, false)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2711) as `LuaResourceRuntime.Bootstrap`.

#### repairLight

```lua
CyberM.vehicles.repairLight(id, index)
```

`NETWORK` — Uses the network backend.

Repairs one vehicle light.

Requires `world.vehicles`. Convenience wrapper over `setLightBroken(id, index, false)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2720) as `LuaResourceRuntime.Bootstrap`.

#### repairTire

```lua
CyberM.vehicles.repairTire(id, index)
```

`NETWORK` — Uses the network backend.

Repairs one vehicle tire.

Requires `world.vehicles`. Convenience wrapper over `setTireBroken(id, index, false)`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2725) as `LuaResourceRuntime.Bootstrap`.

#### setBodyCell

```lua
CyberM.vehicles.setBodyCell(id, cell, value)
```

`NETWORK` — Uses the network backend.

Sets one body-damage cell.

Requires `world.vehicles`. Lua body-cell indexes are 1..30 and the value is clamped or validated in the normalized 0..1 range.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `cell` | `integer` | required | — |
| `value` | `number` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2696) as `LuaResourceRuntime.Bootstrap`.

#### setBodyDamage

```lua
CyberM.vehicles.setBodyDamage(id, values)
```

`NETWORK` — Uses the network backend.

Replaces the complete body-damage grid.

Requires `world.vehicles`. The table must contain exactly 30 normalized finite values in the range 0..1.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2695) as `LuaResourceRuntime.Bootstrap`.

#### setBodyZone

```lua
CyberM.vehicles.setBodyZone(id, zone, value)
```

`NETWORK` — Uses the network backend.

Sets all body cells in a zone.

Requires `world.vehicles`. The zone may be a registered zone name or an explicit array of cell indexes. Every selected cell receives the normalized value.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `zone` | `string|table` | required | — |
| `value` | `number` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2702) as `LuaResourceRuntime.Bootstrap`.

#### setDamage

```lua
CyberM.vehicles.setDamage(id, damage)
```

`NETWORK` — Uses the network backend.

Replaces multiple canonical damage components at once.

Requires `world.vehicles`. Accepts a combined damage table and validates body cells and bit masks before publishing one authoritative update.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2694) as `LuaResourceRuntime.Bootstrap`.

#### setDoorMask

```lua
CyberM.vehicles.setDoorMask(id, mask)
```

`NETWORK` — Uses the network backend.

Replaces the vehicle opening mask.

Requires `world.vehicles`. The six-bit mask covers four doors, trunk, and hood. Valid values are 0..63.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2727) as `LuaResourceRuntime.Bootstrap`.

#### setDoorOpen

```lua
CyberM.vehicles.setDoorOpen(id, door, opened)
```

`NETWORK` — Uses the network backend.

Sets one door, trunk, or hood opening state.

Requires `world.vehicles`. `door` is an index 0..5 or one of the constants in `CyberM.vehicles.doors`.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2732) as `LuaResourceRuntime.Bootstrap`.

#### setGlassBroken

```lua
CyberM.vehicles.setGlassBroken(id, glass, broken)
```

`NETWORK` — Uses the network backend.

Sets or clears one broken-glass bit.

Requires `world.vehicles`. `glass` may be a numeric 0..31 index or a name supplied by the resource's registered damage profile.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `glass` | `integer|string` | required | — |
| `broken` | `boolean` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2706) as `LuaResourceRuntime.Bootstrap`.

#### setGlassMask

```lua
CyberM.vehicles.setGlassMask(id, mask)
```

`NETWORK` — Uses the network backend.

Replaces the broken-glass bit mask.

Requires `world.vehicles`. The 32-bit mask describes destructible glass records, not the four reversible side-window opening states.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2705) as `LuaResourceRuntime.Bootstrap`.

#### setLightBroken

```lua
CyberM.vehicles.setLightBroken(id, index, broken)
```

`NETWORK` — Uses the network backend.

Sets or clears one broken-light bit.

Requires `world.vehicles`. The light index must be in 0..31.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `index` | `integer` | required | — |
| `broken` | `boolean` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2718) as `LuaResourceRuntime.Bootstrap`.

#### setLightMask

```lua
CyberM.vehicles.setLightMask(id, mask)
```

`NETWORK` — Uses the network backend.

Replaces the broken-light bit mask.

Requires `world.vehicles`. Replaces the complete 32-bit canonical broken-light mask.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2717) as `LuaResourceRuntime.Bootstrap`.

#### setTireBroken

```lua
CyberM.vehicles.setTireBroken(id, index, broken)
```

`NETWORK` — Uses the network backend.

Sets or clears one broken tire.

Requires `world.vehicles`. Mutates one tire index in 0..3 and replicates the canonical state to streamed observers.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `integer` | required | — |
| `index` | `integer` | required | — |
| `broken` | `boolean` | required | — |

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2723) as `LuaResourceRuntime.Bootstrap`.

#### setTireMask

```lua
CyberM.vehicles.setTireMask(id, mask)
```

`NETWORK` — Uses the network backend.

Replaces the broken-tire bit mask.

Requires `world.vehicles`. Only the lower four bits are valid and correspond to tire indexes 0..3.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2722) as `LuaResourceRuntime.Bootstrap`.

#### setTransform

```lua
CyberM.vehicles.setTransform(id, transform)
```

`NETWORK` — Uses the network backend.

Moves a vehicle authoritatively.

Requires `world.vehicles`. Updates position and yaw, revokes any active physics lease, and publishes the new canonical transform to current viewers.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2760) as `LuaResourceRuntime.Bootstrap`.

#### setWindowOpen

```lua
CyberM.vehicles.setWindowOpen(id, window, opened)
```

`NETWORK` — Uses the network backend.

Sets one reversible side-window opening state.

Requires `world.vehicles`. This controls the four openable side windows and is separate from destructible broken-glass state.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2742) as `LuaResourceRuntime.Bootstrap`.

#### update

```lua
CyberM.vehicles.update(id, patch)
```

`NETWORK` — Uses the network backend.

Updates canonical durable vehicle fields.

Requires `world.vehicles`. Applies only supplied fields, such as health, flags, colors, door/window/tire masks, body damage, broken glass, or broken lights. The authoritative result is persisted and replicated to current viewers and late joiners.

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

Returns: `boolean success`

Registered in `LuaResourceRuntime.cs` (line 2692) as `LuaResourceRuntime.Bootstrap`.


## Client runtime

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

### Globals — client runtime

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

19 functions.

#### AddEventHandler

```lua
AddEventHandler(event, handler)
```

`SHARED` — Available without a live game instance.

Listens for a local event.

Registers a callback on the current resource's local event bus. The handler is owned by the current resource generation and is discarded automatically when that generation stops or reloads; it never receives network traffic unless the event was separately registered as a network event.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `handler id`

Registered in `ResourceHost.cpp` (line 6490) as `LuaAddEventHandler`.

#### ClearTimeout

```lua
ClearTimeout(id)
```

`SHARED` — Available without a live game instance.

Cancels a timer created by `SetTimeout`.

Cancels a pending timeout owned by the current resource generation. It returns `false` when the id is unknown or the callback has already begun; cancelling cannot interrupt a callback that is currently running.

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

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6489) as `LuaClearTimeout`.

#### CreateThread

```lua
CreateThread(body)
```

`SHARED` — Available without a live game instance.

Starts a coroutine managed by the host.

Its body may call `Wait`, which an ordinary function cannot.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `body` | `function` | required | — |

```lua
CreateThread(function()
    while true do
        print(CyberM.character.speed())
        Wait(1000)
    end
end)
```

Registered in `ResourceHost.cpp` (line 6486) as `LuaCreateThread`.

#### DeleteResourceKvp

```lua
DeleteResourceKvp(key)
```

`SHARED` — Available without a live game instance.

FiveM-style alias for `CyberM.kvp.delete`.

FiveM-familiar alias for `CyberM.kvp.delete`. It atomically removes only the named key owned by the calling resource and reports whether that key existed.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6502) as `LuaKvpDelete`.

#### exports

```lua
exports(name, body)
```

`SHARED` — Available without a live game instance.

Declares a function callable by other resources.

Publishes a named function from the current resource so another resource can call it through `CyberM.exports.call`. The registration is tied to the current generation, so stale functions cannot survive a stop or hot reload.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `name` | `string` | required | — |
| `body` | `function` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6495) as `LuaRegisterExport`.

#### GetCurrentResourceName

```lua
GetCurrentResourceName()
```

`SHARED` — Available without a live game instance.

Name of the current resource.

Returns the immutable manifest name of the resource whose Lua VM is executing. Use it for diagnostics and namespacing, not as a mutable display label.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6496) as `LuaResourceName`.

#### GetInvokingResource

```lua
GetInvokingResource()
```

`SHARED` — Available without a live game instance.

Real caller of the currently executing export.

Returns nil outside an export callback. Use this value for service ownership instead of accepting a forgeable owner argument.

Returns: `resource name, or nil`

Registered in `ResourceHost.cpp` (line 6497) as `LuaInvokingResource`.

#### GetInvokingResourceGeneration

```lua
GetInvokingResourceGeneration()
```

`SHARED` — Available without a live game instance.

Generation of the resource invoking the current export.

Returns nil outside an export callback. A changed generation lets a service retire handles left by an older VM.

Returns: `integer, or nil`

Registered in `ResourceHost.cpp` (line 6498) as `LuaInvokingResourceGeneration`.

#### GetResourceKvp

```lua
GetResourceKvp(key, [default])
```

`SHARED` — Available without a live game instance.

FiveM-style alias for `CyberM.kvp.get`.

FiveM-familiar alias for `CyberM.kvp.get`. It returns the original stored Lua type or nil when absent and stays inside the active connection-address and calling-resource namespace.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `default` | `any` | optional | — |

Returns: `value or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6501) as `LuaKvpGet`.

#### GetResourceState

```lua
GetResourceState(resource)
```

`SHARED` — Available without a live game instance.

State of a resource.

Reads the lifecycle state currently known by the client resource host. This is a snapshot only: it does not start, stop, or wait for the target resource.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | required | — |

Returns: `string`

Registered in `ResourceHost.cpp` (line 6499) as `LuaGetResourceState`.

#### print

```lua
print(…)
```

`SHARED` — Available without a live game instance.

Writes to the CyberM log, prefixed with the resource name.

Writes a resource-prefixed line to the CyberM log. Values are converted with bounded formatting; this does not send a chat message or write into a WebUI page.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `…` | `any` | required | — |

Registered in `ResourceHost.cpp` (line 6484) as `LuaPrint`.

#### RegisterNetEvent

```lua
RegisterNetEvent(event, [handler])
```

`NETWORK` — Uses the network backend.

Allows an event to arrive from the server.

Allows an authenticated server event with this name to enter the current resource, and optionally attaches a handler in the same call. Registration is generation-scoped, requires `network.events`, and does not turn arbitrary client events into server events.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | optional | — |

Returns: `handler id`

Registered in `ResourceHost.cpp` (line 6493) as `LuaRegisterNetEvent`.

#### RemoveEventHandler

```lua
RemoveEventHandler(event, handler)
```

`SHARED` — Available without a live game instance.

Removes a handler.

Removes the exact callback previously registered for the named local event. It returns `false` when that event/callback pair is not owned by the current resource generation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6491) as `LuaRemoveEventHandler`.

#### require

```lua
require(module)
```

`SHARED` — Available without a live game instance.

Loads a module from the resource.

Loads a Lua module declared inside the current resource and caches its result for that resource generation. Resolution stays inside the sandbox: it does not expose the host filesystem, native `package` loaders, or modules from another resource.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `module` | `string` | required | — |

Returns: `whatever the module returns`

Registered in `ResourceHost.cpp` (line 6485) as `LuaRequire`.

#### SetResourceKvp

```lua
SetResourceKvp(key, value)
```

`SHARED` — Available without a live game instance.

FiveM-style alias for `CyberM.kvp.set`.

FiveM-familiar alias for `CyberM.kvp.set`. It stores one typed value in the calling resource's persistent namespace for the active connection address; it cannot select another server or resource.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `value` | `any` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6500) as `LuaKvpSet`.

#### SetTimeout

```lua
SetTimeout(milliseconds, body)
```

`SHARED` — Available without a live game instance.

Runs a function once, later.

Schedules a Lua callback after at least the requested number of milliseconds without blocking the game thread. The timer belongs to the current resource generation and is cancelled automatically on stop or hot reload.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `milliseconds` | `integer` | required | — |
| `body` | `function` | required | — |

Returns: `timer id`

Registered in `ResourceHost.cpp` (line 6488) as `LuaSetTimeout`.

#### TriggerEvent

```lua
TriggerEvent(event, [payload])
```

`SHARED` — Available without a live game instance.

Fires a local event.

Dispatches an event only inside the client resource runtime. Arguments must fit the runtime's bounded script-value representation; use `TriggerServerEvent` for traffic that must cross the network.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6492) as `LuaTriggerEvent`.

#### TriggerServerEvent

```lua
TriggerServerEvent(event, [payload])
```

`NETWORK` — Uses the network backend.

Sends an event to the server.

Serializes and sends an event to the connected server with the caller's authenticated player identity. It requires `network.events`; tables must be serializable and payload limits are enforced before anything is queued.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6494) as `LuaTriggerServerEvent`.

#### Wait

```lua
Wait(milliseconds)
```

`SHARED` — Available without a live game instance.

Suspends the current coroutine.

Only usable inside a `CreateThread`.

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

Registered in `ResourceHost.cpp` (line 6487) as `LuaWait`.


### CyberM.animations — client runtime

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

5 functions.

#### current

```lua
CyberM.animations.current(entity)
```

`GAME` — Requires a live game instance.

The clip a body is currently playing.

Returns false when it is playing nothing — which is a state, not an error.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | required | — |

Returns: `clip name, or false`, `reason, when applicable`

Registered in `ResourceHost.cpp` (line 6591) as `LuaAnimationCurrent`.

#### play

```lua
CyberM.animations.play(entity, animation)
```

`GAME` — Requires a live game instance.

Plays a named animation on a body.

Does not work on the local player: their body cannot hold a workspot. Use `CyberM.animations.playSelf` for that, which stands a double in for them.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | required | — |
| `animation` | `string` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
local ok, reason = CyberM.animations.play(entityId, "emote_smoke")
if not ok then print("refused: " .. reason) end
```

Registered in `ResourceHost.cpp` (line 6587) as `LuaAnimationPlay`.

#### playSelf

```lua
CyberM.animations.playSelf(animation, [thirdPerson])
```

`GAME` — Requires a live game instance.

Plays an emote on the local player, through a stand-in body.

The player's own body cannot hold a workspot, so an invisible double takes their place for the length of the clip. This is a separate call rather than `play` with the player's id because the mechanism is genuinely different.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `animation` | `string` | required | — |
| `thirdPerson` | `boolean` | optional | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6588) as `LuaSelfEmotePlay`.

#### stop

```lua
CyberM.animations.stop(entity)
```

`GAME` — Requires a live game instance.

Stops whatever a body is playing and releases what was set up for it.

Stops the workspot animation currently managed by CyberM for the selected body and releases its native animation state. It does not claim or stop arbitrary game animations that CyberM does not own.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6590) as `LuaAnimationStop`.

#### stopSelf

```lua
CyberM.animations.stopSelf()
```

`GAME` — Requires a live game instance.

Stops the local player's emote and removes the stand-in.

Ends the local-player emote created by `playSelf` and removes its stand-in body. Cleanup is idempotent and is also performed when the owning resource generation stops.

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6589) as `LuaSelfEmoteStop`.


### CyberM.appearance — client runtime

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

5 functions.

#### apply

```lua
CyberM.appearance.apply(snapshot)
```

`GAME` — Requires a live game instance.

Applies a previously captured appearance snapshot to the local player.

Requires `player.appearance.edit`. The runtime validates the schema, build, catalog digest, gender, option identities, choice bounds, and duplicates before touching the game.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `snapshot` | `table` | required | — |

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

Registered in `ResourceHost.cpp` (line 6635) as `LuaAppearanceApply`.

#### capture

```lua
CyberM.appearance.capture()
```

`GAME` — Requires a live game instance.

Captures the local player's complete validated appearance snapshot.

Requires `player.appearance.read`. The snapshot is bound to schema version 1, game build 2.31, a catalog digest, gender hash, and at most 256 head/body/arms options.

Returns: `table { schemaVersion, gameBuild, catalogDigest, gender, options }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6634) as `LuaAppearanceCapture`.

#### finishCommit

```lua
CyberM.appearance.finishCommit()
```

`GAME` — Requires a live game instance.

Finishes the current appearance commit transaction.

Requires `player.appearance.edit`. Call after a successful apply/persistence flow so the native editor can release its commit state.

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

Registered in `ResourceHost.cpp` (line 6636) as `LuaAppearanceFinish`.

#### isOpen

```lua
CyberM.appearance.isOpen()
```

`GAME` — Requires a live game instance.

Whether the local appearance editor is open.

Requires `player.appearance.read`; returns false when the permission or backend is unavailable.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6633) as `LuaAppearanceIsOpen`.

#### open

```lua
CyberM.appearance.open([options])
```

`GAME` — Requires a live game instance.

Opens the local Cyberpunk appearance editor.

Requires `player.appearance.edit`. The optional value may be a mode string or `{ mode = string }`; `ripperdoc` is used by default.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `options` | `string|table` | optional | — |

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

Registered in `ResourceHost.cpp` (line 6632) as `LuaAppearanceOpen`.


### CyberM.assets — client runtime

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

2 functions.

#### list

```lua
CyberM.assets.list()
```

`SHARED` — Available without a live game instance.

Lists generic files declared by the current resource.

Returns the resource files declared by the current manifest. It is an allow-list view, not a directory listing, and does not grant access to undeclared files or arbitrary paths.

Returns: `array of relative paths`

Registered in `ResourceHost.cpp` (line 6541) as `LuaAssetList`.

#### texture

```lua
CyberM.assets.texture(path)
```

`SHARED` — Available without a live game instance.

Validates a declared PNG texture for resource APIs.

The path must match the manifest's `files` allowlist. PNG textures are limited to 512 KiB and 512 by 512 pixels.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `path` | `string` | required | — |

Returns: `descriptor { type, asset, mime, width, height, bytes }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6540) as `LuaAssetTexture`.


### CyberM.blips — client runtime

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

18 functions.

#### attachToEntity

```lua
CyberM.blips.attachToEntity(id, entity, [slot], [offset])
```

`GAME` — Requires a live game instance.

Makes a blip follow a CyberM entity.

Changes an owned blip from a fixed world position to tracking a streamed CyberM entity. The entity id is ephemeral and the call requires `ui.vanilla.map`; remove or reattach the blip when its gameplay target changes.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `entity` | `entity` | required | — |
| `slot` | `string` | optional | `poi_mappin` |
| `offset` | `table { x, y, z }` | optional | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6779) as `LuaBlipAttachToEntity`.

#### clear

```lua
CyberM.blips.clear()
```

`GAME` — Requires a live game instance.

Removes every blip owned by the current resource.

Removes every vanilla-map blip owned by the calling resource generation. Other resources' blips are left untouched, and generation teardown performs the same cleanup automatically.

Returns: `true`

Registered in `ResourceHost.cpp` (line 6790) as `LuaBlipClear`.

#### create

```lua
CyberM.blips.create(options)
```

`GAME` — Requires a live game instance.

Creates a resource-owned vanilla map pin.

Requires `ui.vanilla.map`. Provide exactly one of `position` or `entity`. The returned 64-bit generation handle is a decimal string and is cleaned up automatically when the resource stops.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `options` | `table { position|entity, sprite?, label?, icon?, active?, visibleThroughWalls?, slot?, offset? }` | required | — |

Returns: `decimal-string blip id, or nil`, `reason`

```lua
local id = assert(CyberM.blips.create({
  position = { x = 10, y = 20, z = 30 },
  sprite = "objective", label = "Street race"
}))
```

Registered in `ResourceHost.cpp` (line 6776) as `LuaBlipCreate`.

#### get

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

`GAME` — Requires a live game instance.

Reads one blip owned by the current resource.

Returns a read-only snapshot of one blip owned by the calling resource. The handle must still belong to the current generation; a stale or foreign id is rejected.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |

Returns: `snapshot table, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6791) as `LuaBlipGet`.

#### list

```lua
CyberM.blips.list()
```

`GAME` — Requires a live game instance.

Lists blips owned by the current resource.

Lists snapshots of all vanilla-map blips owned by the calling resource generation. The returned tables are copies and changing them does not mutate the map.

Returns: `array of snapshot tables`

Registered in `ResourceHost.cpp` (line 6792) as `LuaBlipList`.

#### remove

```lua
CyberM.blips.remove(id)
```

`GAME` — Requires a live game instance.

Removes one owned blip.

Deletes one blip owned by the calling resource and invalidates its handle. Removal is resource-scoped, so one package cannot erase another package's map state.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6789) as `LuaBlipRemove`.

#### setActive

```lua
CyberM.blips.setActive(id, active)
```

`GAME` — Requires a live game instance.

Activates or deactivates a vanilla mappin.

Updates the active/highlighted state of an owned vanilla-map blip. This changes presentation only and does not create a route or change server state.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `active` | `boolean` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6785) as `LuaBlipSetActive`.

#### setDescription

```lua
CyberM.blips.setDescription(id, description)
```

`GAME` — Requires a live game instance.

Sets the custom fullscreen-map description of an owned blip.

Requires `ui.vanilla.map`. The description is displayed by CyberM's fullscreen-map tooltip for the selected native mappin.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `string` | required | — |
| `description` | `string` | required | — |

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

Registered in `ResourceHost.cpp` (line 6783) as `LuaBlipSetDescription`.

#### setIcon

```lua
CyberM.blips.setIcon(id, icon)
```

`GAME` — Requires a live game instance.

Sets a declared PNG icon or restores the native sprite.

Accepts a path, a texture descriptor, `{ asset, size }`, or false. The native mappin remains underneath for map selection, routing, tooltips, and fallback.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `icon` | `string|table|false` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6784) as `LuaBlipSetIcon`.

#### setLabel

```lua
CyberM.blips.setLabel(id, label)
```

`GAME` — Requires a live game instance.

Changes the fullscreen-map tooltip title.

CyberM keeps the label in private script data, independent from the vanilla variant's generic title.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `label` | `string` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6782) as `LuaBlipSetLabel`.

#### setPosition

```lua
CyberM.blips.setPosition(id, position)
```

`GAME` — Requires a live game instance.

Moves a blip to a world position.

Also detaches an entity-following blip.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `position` | `table { x, y, z }` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6778) as `LuaBlipSetPosition`.

#### setSprite

```lua
CyberM.blips.setSprite(id, sprite)
```

`GAME` — Requires a live game instance.

Changes the vanilla mappin variant.

Accepts an exact 2.31 variant name, a stable alias, or an integer from 0 through 146. See `wiki/blips.md` for the complete list.

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

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6780) as `LuaBlipSetSprite`.

#### setTitle

```lua
CyberM.blips.setTitle(id, title)
```

`GAME` — Requires a live game instance.

Sets the custom fullscreen-map title of an owned blip.

Requires `ui.vanilla.map`. This is the semantic title alias of `setLabel`; the HUD does not permanently render it beside the icon.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `string` | required | — |
| `title` | `string` | required | — |

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

Registered in `ResourceHost.cpp` (line 6781) as `LuaBlipSetTitle`.

#### setTrackingAlternative

```lua
CyberM.blips.setTrackingAlternative(id, target)
```

`GAME` — Requires a live game instance.

Sets another owned blip as the routing alternative.

Passing nil clears it. This does not force the world-map controller to start tracking.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `target` | `decimal string|nil` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6787) as `LuaBlipSetTrackingAlternative`.

#### setVisibleThroughWalls

```lua
CyberM.blips.setVisibleThroughWalls(id, visible)
```

`GAME` — Requires a live game instance.

Changes vanilla through-wall visibility.

Controls whether an owned world marker remains visible when geometry occludes it. The setting affects presentation on this client only and requires `ui.vanilla.map`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `visible` | `boolean` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6786) as `LuaBlipSetVisibleThroughWalls`.

#### sprites

```lua
CyberM.blips.sprites()
```

`GAME` — Requires a live game instance.

Lists every usable mappin variant in the current build.

Returns 147 entries for Cyberpunk 2077 2.31. This metadata query does not require map mutation permission.

Returns: `array of { name, value }`

Registered in `ResourceHost.cpp` (line 6793) as `LuaBlipSprites`.

#### untrack

```lua
CyberM.blips.untrack(id)
```

`GAME` — Requires a live game instance.

Safely clears manual tracking for this blip.

The native action is invoked only if this owned blip is currently tracked, so a resource cannot untrack a quest or another system's pin.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |

Returns: `true`, `whether it was tracked`

Registered in `ResourceHost.cpp` (line 6788) as `LuaBlipUntrack`.

#### update

```lua
CyberM.blips.update(id, patch)
```

`GAME` — Requires a live game instance.

Updates several properties of an owned blip.

A replacement mappin is registered before the previous one is removed. `position` switches to positional mode; `entity` switches to attached mode.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `decimal string` | required | — |
| `patch` | `table` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6777) as `LuaBlipUpdate`.


### CyberM.camera — 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.

#### attach

```lua
CyberM.camera.attach()
```

`GAME` — Requires a live game instance.

Reattaches the camera to the body.

Attaches the CyberM camera to a game entity using the supplied local offset and rotation. Camera ownership is local to the resource generation; attaching replaces the resource's previous detached/attached camera state.

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6750) as `LuaCameraAttach`.

#### detach

```lua
CyberM.camera.detach(x, y, z)
```

`GAME` — Requires a live game instance.

Detaches the camera from the body, with an offset in the body's own space.

Detaches the CyberM camera from its target while retaining a controllable camera view. It does not synchronize a camera to other players and is automatically restored during resource cleanup.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `x` | `number` | required | — |
| `y` | `number` | required | — |
| `z` | `number` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6749) as `LuaCameraDetach`.

#### project

```lua
CyberM.camera.project(position)
```

`GAME` — Requires a live game instance.

Projects a world point into normalized WebUI viewport coordinates.

Uses REDengine's active camera projection. `(0,0)` is the top-left and `(1,1)` the bottom-right. `onScreen` is false for points behind the view or beyond the viewport.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `position` | `table { x, y, z }` | required | — |

Returns: `table { x, y, depth, distance, onScreen }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6753) as `LuaCameraProject`.

#### setFov

```lua
CyberM.camera.setFov(degrees)
```

`GAME` — Requires a live game instance.

Sets the field of view, in degrees.

Changes the field of view of the camera currently controlled by CyberM. The value is validated by the native backend and applies only to this client's presentation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `degrees` | `number` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
CyberM.camera.setFov(90)
```

Registered in `ResourceHost.cpp` (line 6751) as `LuaCameraFieldOfView`.

#### thirdPerson

```lua
CyberM.camera.thirdPerson(enabled, [distance], [height])
```

`GAME` — Requires a live game instance.

Switches the view to third person.

Turning it off restores the view the game had before the call, rather than some default.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | required | — |
| `distance` | `number` | optional | — |
| `height` | `number` | optional | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
CyberM.camera.thirdPerson(true, 2.5, 1.7)
```

Registered in `ResourceHost.cpp` (line 6748) as `LuaCameraThirdPerson`.

#### view

```lua
CyberM.camera.view()
```

`GAME` — Requires a live game instance.

Where the view is: position, forward vector, field of view.

Returns the latest game-thread camera snapshot used by projection and presentation APIs. It is a same-client read and may return `nil, reason` while the game camera is unavailable.

Returns: `position (x, y, z)`, `forward (x, y, z)`, `field of view`

Registered in `ResourceHost.cpp` (line 6752) as `LuaCameraView`.


### CyberM.character — client runtime

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

18 functions.

#### animation

```lua
CyberM.character.animation([entity])
```

`GAME` — Requires a live game instance.

The animation currently playing on this character.

Reads the current animation snapshot for an entity, or for the local player when omitted. The result is observational and can change on the next frame; it does not grant animation ownership.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `clip name, or nil`

Registered in `ResourceHost.cpp` (line 6615) as `LuaCharacterAnimation`.

#### groundSpeed

```lua
CyberM.character.groundSpeed([entity])
```

`GAME` — Requires a live game instance.

Speed projected on the ground, without the vertical component.

Returns horizontal movement speed for the selected character, excluding vertical velocity. Entity ids refer to the current client stream and must not be persisted as server identity.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `number`

Registered in `ResourceHost.cpp` (line 6617) as `LuaCharacterNumber<&SelectGroundSpeed>`.

#### health

```lua
CyberM.character.health([entity])
```

`GAME` — Requires a live game instance.

Current health.

Reads the engine-side health visible for the selected character on this client. For replicated player gameplay rules use the server-authoritative player health APIs; this helper is a presentation snapshot, not authority.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `number`

Registered in `ResourceHost.cpp` (line 6618) as `LuaCharacterNumber<&SelectHealth>`.

#### isAlive

```lua
CyberM.character.isAlive([entity])
```

`GAME` — Requires a live game instance.

Whether the character is alive.

Reports the current engine alive/dead flag for the selected character. It is useful for presentation and diagnostics but may lag the authoritative server health transition by a replication frame.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6620) as `LuaCharacterFlag<&SelectAlive>`.

#### isArmed

```lua
CyberM.character.isArmed([entity])
```

`GAME` — Requires a live game instance.

Whether a weapon is drawn.

Reports whether the selected character is currently considered armed by the game presentation state. It does not enumerate inventory or prove that a weapon action is server-authorized.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6625) as `LuaCharacterFlag<&SelectArmed>`.

#### isCrouched

```lua
CyberM.character.isCrouched([entity])
```

`GAME` — Requires a live game instance.

Whether the character is crouching.

Reads the character's current crouch presentation flag. Omit the entity to inspect the local player; remote values exist only while that proxy is streamed.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6622) as `LuaCharacterFlag<&SelectCrouched>`.

#### isDriver

```lua
CyberM.character.isDriver([entity])
```

`GAME` — Requires a live game instance.

Whether they occupy the driver's seat.

Returns whether the selected character occupies the canonical driver seat of a vehicle. Use `seat()` when the exact seat and vehicle entity are also needed.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6627) as `LuaCharacterFlag<&SelectDriverSeat>`.

#### isEmoting

```lua
CyberM.character.isEmoting([entity])
```

`GAME` — Requires a live game instance.

Whether they hold a workspot (an emote is running).

Reports whether CyberM currently presents the character in an emote/workspot state. This is a transient local snapshot and is cleared with the owning presentation lifecycle.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6628) as `LuaCharacterFlag<&SelectInWorkspot>`.

#### isGrounded

```lua
CyberM.character.isGrounded([entity])
```

`GAME` — Requires a live game instance.

Whether the character is touching the ground.

Reads the engine grounded flag for the selected character. The value is sampled from the current client frame and should not be used alone for authoritative movement validation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6621) as `LuaCharacterFlag<&SelectGrounded>`.

#### isInVehicle

```lua
CyberM.character.isInVehicle([entity])
```

`GAME` — Requires a live game instance.

Whether the character is mounted in a vehicle.

Reports whether the character is mounted in a vehicle according to the current client presentation. Call `seat()` to retrieve the mounted slot and vehicle entity id.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6626) as `LuaCharacterFlag<&SelectInVehicle>`.

#### isSliding

```lua
CyberM.character.isSliding([entity])
```

`GAME` — Requires a live game instance.

Whether the character is sliding.

Reads the current sliding locomotion flag for the selected character. It is an observational state and does not start or stop a slide.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6623) as `LuaCharacterFlag<&SelectSliding>`.

#### isVaulting

```lua
CyberM.character.isVaulting([entity])
```

`GAME` — Requires a live game instance.

Whether the character is vaulting.

Reads the current vaulting locomotion flag for the selected character. Remote values are available only while the corresponding proxy is streamed.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6624) as `LuaCharacterFlag<&SelectVaulting>`.

#### position

```lua
CyberM.character.position([entity])
```

`GAME` — Requires a live game instance.

The character's position.

Returns the character's current world-space coordinates from the game-thread snapshot. Omit the entity for the local player; do not persist a client entity id as a network identity.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `x, y, z`

Registered in `ResourceHost.cpp` (line 6612) as `LuaCharacterPosition`.

#### seat

```lua
CyberM.character.seat([entity])
```

`GAME` — Requires a live game instance.

The seat occupied in a vehicle, if any.

Returns the canonical seat name and the mounted vehicle's client entity id when the character is in a vehicle. A character that is not mounted returns `nil`; both values are snapshots and the entity id is valid only in the current client stream.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `seat name and vehicle entity id, or nil`, `reason when the character could not be read`

Registered in `ResourceHost.cpp` (line 6613) as `LuaCharacterSeat`.

#### speed

```lua
CyberM.character.speed([entity])
```

`GAME` — Requires a live game instance.

Instantaneous speed, all components.

Returns total character movement speed, including vertical motion, from the latest local snapshot. Use `groundSpeed()` when only horizontal locomotion is relevant.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `number`

Registered in `ResourceHost.cpp` (line 6616) as `LuaCharacterNumber<&SelectSpeed>`.

#### state

```lua
CyberM.character.state([entity])
```

`GAME` — Requires a live game instance.

One complete snapshot of a character.

A single engine pass fills the whole record even when the caller only wanted the speed. That is deliberate: every field then describes the **same instant**, so a caller cannot see a body grounded and airborne in the same breath.

With no argument, answers about the local player.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `table { isPlayer, attached, id, engineId, position, orientation, forward, velocity, speed, groundSpeed, yaw, alive, health, grounded, crouched, sliding, vaulting, air, fall, landing, weapon…, inVehicle, seat, driver }`, `reason, when the first is nil`

```lua
local s = CyberM.character.state()
if s.inVehicle and s.driver then
    print("driving at " .. math.floor(s.speed) .. " u/s")
end
```

Registered in `ResourceHost.cpp` (line 6611) as `LuaCharacterState`.

#### weapon

```lua
CyberM.character.weapon([entity])
```

`GAME` — Requires a live game instance.

The equipped weapon and its state.

Returns the drawn weapon's recognized item id and category for the selected character. It returns `nil` when no recognized weapon is currently presented and does not expose or mutate inventory.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `table { itemId, category }, or nil`, `reason when the character could not be read`

Registered in `ResourceHost.cpp` (line 6614) as `LuaCharacterWeapon`.

#### yaw

```lua
CyberM.character.yaw([entity])
```

`GAME` — Requires a live game instance.

Horizontal orientation, in degrees.

Returns the selected character's current world yaw in degrees. The value is a presentation snapshot and should be normalized by the caller when computing angular deltas.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `entity` | `entity` | optional | — |

Returns: `number`

Registered in `ResourceHost.cpp` (line 6619) as `LuaCharacterNumber<&SelectYaw>`.


### CyberM.clipboard — client runtime

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

1 function.

#### setText

```lua
CyberM.clipboard.setText(text)
```

`GAME` — Requires a live game instance.

Writes UTF-8 text to the operating-system clipboard.

Client-only and requires `clipboard.write` on the resource whose VM performs the call. Text is limited to 256 KiB, must be valid UTF-8 and cannot contain an embedded NUL. The operation is write-only: resources cannot inspect the user's existing clipboard. A temporarily owned clipboard returns `false, clipboard_busy`; callers should let the player retry instead of polling every frame.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `text` | `string` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
local ok, reason = CyberM.clipboard.setText("position = { x = 1, y = 2, z = 3 }")
```

Registered in `ResourceHost.cpp` (line 6607) as `LuaClipboardSetText`.


### CyberM.debug — client runtime

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

3 functions.

#### command

```lua
CyberM.debug.command(commandLine)
```

`GAME` — Requires a live game instance.

Runs one registered native laboratory command directly.

Requires `debug.runtime` and the trusted `cyberm_debug` owner. Input is limited to 4096 bytes and unknown commands are not forwarded to the server.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `commandLine` | `string` | required | — |

Returns: `true and command result on success`, `false and reason`

Registered in `ResourceHost.cpp` (line 6551) as `LuaDebugCommand`.

#### eval

```lua
CyberM.debug.eval(source, [label])
```

`GAME` — Requires a live game instance.

Compiles and executes a bounded text-only Lua chunk in the privileged debug VM.

Requires `debug.runtime` and the trusted `cyberm_debug` owner. Source is limited to 32 KiB, the optional chunk label to 64 bytes, returned values to 16 and result text to 8 KiB. The ordinary memory, instruction and frame-time quotas remain active.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `source` | `string` | required | — |
| `label` | `string` | optional | `exec` |

Returns: `true and bounded result text on success`, `false and compile/runtime reason`

Registered in `ResourceHost.cpp` (line 6550) as `LuaDebugEval`.

#### redscript

```lua
CyberM.debug.redscript(command)
```

`GAME` — Requires a live game instance.

Queues one bounded command through the REDscript debug bridge.

Requires `debug.runtime` and the trusted `cyberm_debug` owner. The opaque command is limited to 4096 bytes and executes from a genuine REDscript frame.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `command` | `string` | required | — |

Returns: `true and bridge result on success`, `false and reason`

Registered in `ResourceHost.cpp` (line 6552) as `LuaDebugRedscript`.


### CyberM.doors — client runtime

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

23 functions.

#### aimed

```lua
CyberM.doors.aimed()
```

`GAME` — Requires a live game instance.

The streamed door currently under the crosshair.

Requires `world.doors`. The returned `id` is an opaque 64-bit REDengine identity encoded as a string; never convert it to a Lua number. A successful discovery also makes that door addressable by `state` and the command functions while it remains streamed.

Returns: `door snapshot, or nil`, `reason when the first is nil`

```lua
local door, reason = CyberM.doors.aimed()
if door then
    print(door.id, door.open, door.locked, door.distance)
end
```

Registered in `ResourceHost.cpp` (line 6647) as `LuaDoorAimed`.

#### available

```lua
CyberM.doors.available()
```

`GAME` — Requires a live game instance.

Whether the client door backend is available.

This capability check does not discover or stream a door. Door operations require the `world.doors` permission.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6646) as `LuaDoorsAvailable`.

#### clearInteractionPolicy

```lua
CyberM.doors.clearInteractionPolicy(door)
```

`GAME` — Requires a live game instance.

Removes this resource's interaction policy for a door.

Requires `world.doors`. Other resources' policies are unaffected.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |

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

Registered in `ResourceHost.cpp` (line 6676) as `LuaDoorPolicy`.

#### close

```lua
CyberM.doors.close(door, [force])
```

`GAME` — Requires a live game instance.

Closes a door.

Alias of `setOpen(door, false, force)`. Requires `world.doors`; application is asynchronous.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6662) as `LuaDoorCommand`.

#### closest

```lua
CyberM.doors.closest([radius])
```

`GAME` — Requires a live game instance.

The closest streamed door around the local player.

Requires `world.doors`. Uses the same 0.5 to 100 metre player-centered query as `near`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `radius` | `number` | optional | `20` |

Returns: `door snapshot, or nil`, `reason when the first is nil`

Registered in `ResourceHost.cpp` (line 6649) as `LuaDoorClosest`.

#### grantKey

```lua
CyberM.doors.grantKey(door, holder)
```

`GAME` — Requires a live game instance.

Grants an entity an opening token for a door.

Requires `world.doors`. Uses the door controller's native token mechanism rather than a parallel CyberM key list. This grants authorization but does not lock or deny an otherwise usable door; access enforcement belongs to `setInteractionAllowed`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `holder` | `opaque entity id` | required | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6671) as `LuaDoorCommand`.

#### hasKey

```lua
CyberM.doors.hasKey(door, holder)
```

`GAME` — Requires a live game instance.

Whether an entity holds an opening token for a door.

Requires `world.doors`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `holder` | `opaque entity id` | required | — |

Returns: `boolean, or nil`, `reason when the first is nil`

Registered in `ResourceHost.cpp` (line 6652) as `LuaDoorHasKey`.

#### holders

```lua
CyberM.doors.holders(door)
```

`GAME` — Requires a live game instance.

The entities holding an opening token for a door.

Requires `world.doors`. Holder IDs are opaque strings for the same precision reason as door IDs. Tokens are vanilla authorization data, not a global lock rule: an unlocked interactive door remains usable with no token. Combine `hasKey` with `setInteractionAllowed` when implementing an ox_doorlock-style policy.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |

Returns: `array of opaque entity ids, or nil`, `reason when the first is nil`

Registered in `ResourceHost.cpp` (line 6651) as `LuaDoorHolders`.

#### lock

```lua
CyberM.doors.lock(door, [force])
```

`GAME` — Requires a live game instance.

Locks a door.

Alias of `setLocked(door, true, force)`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6664) as `LuaDoorCommand`.

#### near

```lua
CyberM.doors.near([radius])
```

`GAME` — Requires a live game instance.

All streamed doors around the local player.

Requires `world.doors`. The radius is centered on the player and must be between 0.5 and 100 metres. Results are sorted nearest first and register each door for later ID-based operations.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `radius` | `number` | optional | `20` |

Returns: `array of door snapshots, or nil`, `reason when the first is nil`

Registered in `ResourceHost.cpp` (line 6648) as `LuaDoorNear`.

#### open

```lua
CyberM.doors.open(door, [force])
```

`GAME` — Requires a live game instance.

Opens a door.

Alias of `setOpen(door, true, force)`. Requires `world.doors`; application is asynchronous.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6661) as `LuaDoorCommand`.

#### reset

```lua
CyberM.doors.reset(door)
```

`GAME` — Requires a live game instance.

Resets a door to its configured default state.

Requires `world.doors`; queues the vanilla `ResetDoorState` event.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6670) as `LuaDoorCommand`.

#### revokeKey

```lua
CyberM.doors.revokeKey(door, holder)
```

`GAME` — Requires a live game instance.

Revokes an entity's opening token for a door.

Requires `world.doors`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `holder` | `opaque entity id` | required | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6672) as `LuaDoorCommand`.

#### seal

```lua
CyberM.doors.seal(door, [force])
```

`GAME` — Requires a live game instance.

Seals a door.

Alias of `setSealed(door, true, force)`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6667) as `LuaDoorCommand`.

#### setAutomaticClose

```lua
CyberM.doors.setAutomaticClose(door, enabled)
```

`GAME` — Requires a live game instance.

Enables or disables a door's automatic closing behavior.

Requires `world.doors`; queues the vanilla `SetCloseItself` event.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `enabled` | `boolean` | required | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6669) as `LuaDoorCommand`.

#### setInteractionAllowed

```lua
CyberM.doors.setInteractionAllowed(door, allowed)
```

`GAME` — Requires a live game instance.

Pre-declares whether vanilla interaction may open a door.

Requires `world.doors`. The decision is synchronous when the game interacts with the door. Policies are owned by the resource, all active policies must allow, and they are removed automatically on stop/reload. `cyberm:doorInteract` is an observational event with `(doorId, activatorId, "true"|"false")`; it is too late to change that interaction.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `allowed` | `boolean` | required | — |

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

```lua
CyberM.doors.setInteractionAllowed(doorId, playerHasAccess)
AddEventHandler("cyberm:doorInteract", function(door, activator, allowed)
    print(door, activator, allowed)
end)
```

Registered in `ResourceHost.cpp` (line 6674) as `LuaDoorPolicy`.

#### setLocked

```lua
CyberM.doors.setLocked(door, locked, [force])
```

`GAME` — Requires a live game instance.

Sets whether a door is locked.

Requires `world.doors`. `force` uses the vanilla quest-authority action; application is asynchronous.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `locked` | `boolean` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6663) as `LuaDoorCommand`.

#### setOpen

```lua
CyberM.doors.setOpen(door, open, [force])
```

`GAME` — Requires a live game instance.

Sets whether a door is open.

Requires `world.doors`. Success means the REDscript action was accepted; application is asynchronous and may take up to 200 ms. `force` uses the vanilla quest-authority action.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `open` | `boolean` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6660) as `LuaDoorCommand`.

#### setSealed

```lua
CyberM.doors.setSealed(door, sealed, [force])
```

`GAME` — Requires a live game instance.

Sets whether a door is sealed.

Requires `world.doors`. Sealing is distinct from locking. `force` uses the vanilla quest-authority action.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `sealed` | `boolean` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6666) as `LuaDoorCommand`.

#### setState

```lua
CyberM.doors.setState(door, state, [force])
```

`GAME` — Requires a live game instance.

Sets a door state by name.

Accepted states: `open`, `closed`, `locked`, `unlocked`, `sealed`, `unsealed`. Requires `world.doors`; `force` selects the quest-authority action.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `state` | `string` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6673) as `LuaDoorSetState`.

#### state

```lua
CyberM.doors.state(door)
```

`GAME` — Requires a live game instance.

A live snapshot of a streamed door.

Requires `world.doors`. Reads the live `DoorControllerPS`, never a fabricated default from the save record. Returns `door_not_streamed` after the entity unloads. Snapshot fields include `id`, `class`, `name`, `position`, `distance`, `open`, `closed`, `locked`, `sealed`, `busy`, `playerAuthorised`, `automaticClose`, toggle capabilities, shutter/lift flags, type/sides and opening speed/time.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |

Returns: `door snapshot, or nil`, `reason when the first is nil`

Registered in `ResourceHost.cpp` (line 6650) as `LuaDoorState`.

#### unlock

```lua
CyberM.doors.unlock(door, [force])
```

`GAME` — Requires a live game instance.

Unlocks a door.

Alias of `setLocked(door, false, force)`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6665) as `LuaDoorCommand`.

#### unseal

```lua
CyberM.doors.unseal(door, [force])
```

`GAME` — Requires a live game instance.

Unseals a door.

Alias of `setSealed(door, false, force)`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `door` | `opaque door id` | required | — |
| `force` | `boolean` | optional | — |

Returns: `true when accepted, otherwise false`, `reason for refusal`

Registered in `ResourceHost.cpp` (line 6668) as `LuaDoorCommand`.


### CyberM.elevators — client runtime

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

4 functions.

#### all

```lua
CyberM.elevators.all()
```

`GAME` — Requires a live game instance.

Lists every replicated elevator state visible to the client.

Requires `elevators.read`; returns an empty array when the capability or backend is unavailable.

Returns: `array of elevator snapshots`

Registered in `ResourceHost.cpp` (line 6724) as `LuaElevatorsAll`.

#### get

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

`GAME` — Requires a live game instance.

Reads one replicated elevator by CyberM ID.

Requires `elevators.read`. Elevator IDs are server-assigned and should be kept unchanged.

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

Returns: `table { id, revision, bucket, engineEntity, activeFloor, originFloor, targetFloor, floorCount, travelMs, remainingMs, flags, phase, position, streamed, applied }, or nil`

Registered in `ResourceHost.cpp` (line 6723) as `LuaElevatorGet`.

#### nearby

```lua
CyberM.elevators.nearby([radius])
```

`GAME` — Requires a live game instance.

Discovers streamed native elevators around the local player.

Requires `elevators.read`. Radius must be between 1 and 300 metres. Results distinguish unmanaged engine lifts from elevators already adopted by CyberM.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `radius` | `number` | optional | `100` |

Returns: `array of { engineEntity, controllerEntity, position, distance, managed, floorCount, activeFloor, id }`

Registered in `ResourceHost.cpp` (line 6725) as `LuaElevatorsNearby`.

#### request

```lua
CyberM.elevators.request(id, floor, action)
```

`GAME` — Requires a live game instance.

Submits a floor request to the authoritative server.

Requires `elevators.request`. `action` is normally `call` or `goto`; the server validates the ID, floor, player bucket, range, state and policy.

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

Returns: `true when submitted, otherwise false`, `reason`

Registered in `ResourceHost.cpp` (line 6726) as `LuaElevatorRequest`.


### CyberM.environment — 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.

#### getTime

```lua
CyberM.environment.getTime()
```

`GAME` — Requires a live game instance.

Lit l'horloge REDengine locale.

Primitive interne protégée par `world.environment`. Retourne un snapshot atomique de l'heure appliquée et de l'état de pause. Dans une session normale, utilisez l'export `cyberm_weather.getState` plutôt que cette valeur de projection.

Returns: `table { day, hour, minute, second, totalSeconds, frozen }, ou nil`, `raison si indisponible`

Registered in `ResourceHost.cpp` (line 6739) as `LuaEnvironmentTime`.

#### isWeatherFrozen

```lua
CyberM.environment.isWeatherFrozen()
```

`GAME` — Requires a live game instance.

Indique si la météo automatique vanilla est neutralisée.

Demande `world.environment`.

Returns: `boolean, ou nil`, `raison si indisponible`

Registered in `ResourceHost.cpp` (line 6744) as `LuaEnvironmentWeatherFrozen`.

#### setTime

```lua
CyberM.environment.setTime(hour, minute, [second])
```

`GAME` — Requires a live game instance.

Projette une heure serveur dans REDengine.

Demande `world.environment`. `cyberm_weather` est normalement le seul propriétaire de cette permission. REDengine choisit la prochaine occurrence de l'heure demandée ; le package officiel filtre donc les petits reculs réseau pour éviter un saut d'un jour.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `hour` | `integer 0..23` | required | — |
| `minute` | `integer 0..59` | required | — |
| `second` | `integer 0..59` | optional | `0` |

Returns: `true en cas de succès, sinon false`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6740) as `LuaEnvironmentSetTime`.

#### setTimeFrozen

```lua
CyberM.environment.setTimeFrozen(frozen)
```

`GAME` — Requires a live game instance.

Fige ou libère uniquement l'horloge du jeu.

Ne fige pas la simulation. Demande `world.environment`; utilisé par la projection serveur pour neutraliser la vitesse vanilla.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `frozen` | `boolean` | required | — |

Returns: `true en cas de succès, sinon false`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6741) as `LuaEnvironmentFreezeTime`.

#### setWeather

```lua
CyberM.environment.setWeather(preset, [transitionSeconds], [priority])
```

`GAME` — Requires a live game instance.

Applique un preset météo REDengine.

Primitive interne demandant `world.environment`. Le second retour `applied=false` est aussi possible en cas de succès si le preset était déjà actif.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `preset` | `string` | required | — |
| `transitionSeconds` | `number` | optional | `0` |
| `priority` | `integer` | optional | `5` |

Returns: `true en cas de succès, sinon false`, `applied si succès, sinon raison du refus`

Registered in `ResourceHost.cpp` (line 6742) as `LuaEnvironmentSetWeather`.

#### setWeatherFrozen

```lua
CyberM.environment.setWeatherFrozen(frozen)
```

`GAME` — Requires a live game instance.

Désactive ou réactive le contrôleur météo automatique vanilla.

Demande `world.environment`. Figer conserve le preset courant et laisse le serveur décider du prochain événement.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `frozen` | `boolean` | required | — |

Returns: `true en cas de succès, sinon false`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6743) as `LuaEnvironmentFreezeWeather`.


### CyberM.events — client runtime

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

3 functions.

#### emit

```lua
CyberM.events.emit(event, [payload])
```

`SHARED` — Available without a live game instance.

Fires a local event.

Emits an event on the resource-local client bus and invokes matching local handlers. It never sends a packet; use the network event API for server communication.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6558) as `LuaTriggerEvent`.

#### off

```lua
CyberM.events.off(event, handler)
```

`SHARED` — Available without a live game instance.

Removes a handler registered with `on`.

Unregisters a local event handler id previously returned by `on`/`AddEventHandler`. Handler ids are owned by a resource generation and cannot remove another resource's callback.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6557) as `LuaRemoveEventHandler`.

#### on

```lua
CyberM.events.on(event, handler)
```

`SHARED` — Available without a live game instance.

Listens for a local event.

Same as the `AddEventHandler` global. Events emitted by the plugin — `cyberm:pauseKey`, `cyberm:inspector:on` — arrive here.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `handler id`

Registered in `ResourceHost.cpp` (line 6556) as `LuaAddEventHandler`.


### CyberM.exports — client runtime

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

1 function.

#### call

```lua
CyberM.exports.call(resource, export, […])
```

`SHARED` — Available without a live game instance.

Calls a function exported by another resource.

Schedules another running client resource's exported function and returns a generation-bound Promise. Arguments and results must be serializable; unavailable resources, missing exports, stale generations and scheduler saturation are returned immediately as `nil, reason`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | required | — |
| `export` | `string` | required | — |
| `…` | `any` | optional | — |

Returns: `whatever the export returns`

Registered in `ResourceHost.cpp` (line 6577) as `LuaCallExport`.


### CyberM.input — client runtime

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

2 functions.

#### isCaptured

```lua
CyberM.input.isCaptured()
```

`GAME` — Requires a live game instance.

Whether another WebUI currently owns keyboard input.

Contextual actions should become inert while this is true so chat and menu typing cannot activate gameplay.

Returns: `boolean`, `reason when permission is refused`

Registered in `ResourceHost.cpp` (line 6758) as `LuaInputCaptured`.

#### isDown

```lua
CyberM.input.isDown(key)
```

`GAME` — Requires a live game instance.

Whether an allowlisted contextual action key is currently held.

Requires `input.actions`. Supported keys are A-Z, 0-9, SPACE, ENTER/RETURN, and arrows. Prefer a press edge or hold timer over firing every frame.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |

Returns: `boolean`, `reason when the key or permission is refused`

Registered in `ResourceHost.cpp` (line 6757) as `LuaInputKeyDown`.


### CyberM.inspector — client runtime

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

3 functions.

#### enable

```lua
CyberM.inspector.enable([enabled])
```

`GAME` — Requires a live game instance.

Turns the permanent aim ray on or off.

Turning it off also clears the outline: the outline belongs to the session that asked for it and must not outlive it.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | optional | `true` |

Returns: `true`, `reason, when the first is nil`

Registered in `ResourceHost.cpp` (line 6641) as `LuaInspectorEnable`.

#### outline

```lua
CyberM.inspector.outline([enabled])
```

`GAME` — Requires a live game instance.

Outlines the aimed object, independently of the ray.

Lets a caller read the target without painting the world. The outline uses `entRenderHighlightEvent`, the same event focus mode and scanning already use.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | optional | `true` |

Returns: `true`, `reason, when the first is nil`

Registered in `ResourceHost.cpp` (line 6642) as `LuaInspectorOutline`.

#### target

```lua
CyberM.inspector.target()
```

`GAME` — Requires a live game instance.

What the aim ray is currently pointing at.

Reads a snapshot, never a probe. The ray has to be cast on the game thread, and the plugin refreshes it at 10 Hz, so calling this costs nothing and cannot land a raycast on the wrong thread.

Always returns a table when a game is present. `valid` separates "nothing in view" from "no game" — the latter returns `nil, reason`.

Returns: `table { valid, engineId, class, name, kind, position, distance }`, `reason, when the first is nil`

```lua
local t = CyberM.inspector.target()
if t and t.valid then
    print(t.kind, t.name, t.distance)   --> door  Door  1.38
end
```

Registered in `ResourceHost.cpp` (line 6640) as `LuaInspectorTarget`.


### CyberM.json — client runtime

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

2 functions.

#### decode

```lua
CyberM.json.decode(text)
```

`SHARED` — Available without a live game instance.

Parses a JSON string.

Parses JSON into CyberM's bounded Lua value model. Invalid JSON returns `nil, "invalid_json"`; decoded objects and arrays contain only supported scalar/table values.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `text` | `string` | required | — |

Returns: `value, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6830) as `LuaJsonDecode`.

#### encode

```lua
CyberM.json.encode(value)
```

`SHARED` — Available without a live game instance.

Serialises a Lua value to JSON.

Serializes a supported Lua value to JSON using the same bounded representation used by events, exports and WebUI. Functions, userdata, cycles and unsupported table shapes return `nil, reason`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `value` | `any` | required | — |

Returns: `string, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6829) as `LuaJsonEncode`.


### CyberM.kvp — client runtime

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

11 functions.

#### clear

```lua
CyberM.kvp.clear([prefix])
```

`CLIENT` — Client-only surface.

Clears this resource's keys matching a prefix.

Atomically removes every key matching an optional prefix from the calling resource's current-server store and returns the removal count. An empty prefix clears only that resource namespace.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `prefix` | `string` | optional | — |

Returns: `removed count, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6532) as `LuaKvpClear`.

#### compareAndSet

```lua
CyberM.kvp.compareAndSet(key, expected, replacement)
```

`CLIENT` — Client-only surface.

Atomically changes a key when its typed value matches.

Atomically replaces a key only when its typed value exactly matches the expected value. Nil expected means the key must be absent; nil replacement deletes after a successful comparison.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `expected` | `any` | required | — |
| `replacement` | `any` | required | — |

Returns: `boolean`, `reason on storage failure`

Registered in `ResourceHost.cpp` (line 6535) as `LuaKvpCas`.

#### delete

```lua
CyberM.kvp.delete(key)
```

`CLIENT` — Client-only surface.

Deletes one persistent key.

Atomically deletes one key from the current resource store and returns whether it existed. Deleting a missing key succeeds with false.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |

Returns: `true when removed, false when absent`, `reason on storage failure`

Registered in `ResourceHost.cpp` (line 6529) as `LuaKvpDelete`.

#### find

```lua
CyberM.kvp.find([prefix], [limit])
```

`CLIENT` — Client-only surface.

Finds typed entries by sorted key prefix.

Performs a sorted prefix search in the current resource store and returns bounded `{key, value, type}` records. The default result limit is 256 and the hard limit is 4096.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `prefix` | `string` | optional | — |
| `limit` | `integer` | optional | `256` |

Returns: `array of { key, value, type }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6530) as `LuaKvpFind`.

#### get

```lua
CyberM.kvp.get(key, [default])
```

`CLIENT` — Client-only surface.

Reads one typed persistent value.

Reads a typed value from the current connection-address and resource namespace. Missing keys return the optional default (or nil) and are distinct from storage errors, which return `nil, reason`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `default` | `any` | optional | — |

Returns: `stored value, default or nil`, `reason on storage failure`

Registered in `ResourceHost.cpp` (line 6527) as `LuaKvpGet`.

#### has

```lua
CyberM.kvp.has(key)
```

`CLIENT` — Client-only surface.

Checks whether a persistent key exists.

Checks whether a key exists in the calling resource's current-server store without exposing its value or any other resource namespace.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |

Returns: `boolean`, `reason on storage failure`

Registered in `ResourceHost.cpp` (line 6528) as `LuaKvpHas`.

#### increment

```lua
CyberM.kvp.increment(key, [delta])
```

`CLIENT` — Client-only surface.

Atomically increments a numeric key.

Atomically creates or increments a numeric key. Integer arithmetic remains 64-bit and rejects overflow; mixed/floating arithmetic rejects non-finite results.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `delta` | `integer|number` | optional | `1` |

Returns: `new numeric value, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6533) as `LuaKvpIncrement`.

#### keys

```lua
CyberM.kvp.keys([prefix], [limit])
```

`CLIENT` — Client-only surface.

Lists sorted keys matching a prefix.

Returns only the sorted keys matching an optional prefix in the current resource store. It is a bounded index query and cannot enumerate another package or connection address.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `prefix` | `string` | optional | — |
| `limit` | `integer` | optional | `256` |

Returns: `string array, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6531) as `LuaKvpFind`.

#### set

```lua
CyberM.kvp.set(key, value)
```

`CLIENT` — Client-only surface.

Persists one typed value for this server address and resource.

Atomically persists a string, signed integer, finite number or boolean under the current connection address and resource. Keys/values and the 1 MiB resource quota are validated before the old file is replaced.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `value` | `string|integer|number|boolean` | required | — |

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

Registered in `ResourceHost.cpp` (line 6526) as `LuaKvpSet`.

#### setIfAbsent

```lua
CyberM.kvp.setIfAbsent(key, value)
```

`CLIENT` — Client-only surface.

Stores a value only when its key is missing.

Redis-style SETNX for the current resource namespace: atomically stores the typed value only when the key is missing and reports whether insertion occurred.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `key` | `string` | required | — |
| `value` | `string|integer|number|boolean` | required | — |

Returns: `boolean`, `reason on storage failure`

Registered in `ResourceHost.cpp` (line 6534) as `LuaKvpSetNx`.

#### stats

```lua
CyberM.kvp.stats()
```

`CLIENT` — Client-only surface.

Returns this resource store's usage and quotas.

Returns this resource's entry/byte usage and enforced quotas together with the active address/resource scope. It exposes no keys or usage belonging to other resources.

Returns: `table, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6536) as `LuaKvpStats`.


### CyberM.loot — 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.

#### acceptPickup

```lua
CyberM.loot.acceptPickup(id, item, quantity)
```

`GAME` — Requires a live game instance.

Applique localement un pickup déjà accepté par le serveur.

API interne appelée uniquement après `cyberm:loot:pickupResult`. Elle projette l'objet dans l'inventaire REDengine local; l'inventaire persistant reste une responsabilité serveur.

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

Returns: `true en cas de succès`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6686) as `LuaLootAccept`.

#### clear

```lua
CyberM.loot.clear()
```

`GAME` — Requires a live game instance.

Supprime toutes les projections locales et leurs prompts.

Clears the client-side native loot projection when the caller has `world.loot`. This is intended for the authoritative loot replication package during snapshot replacement; ordinary gameplay resources should request server-owned changes instead.

Registered in `ResourceHost.cpp` (line 6684) as `LuaLootClear`.

#### remove

```lua
CyberM.loot.remove(id)
```

`GAME` — Requires a live game instance.

Retire une projection locale de loot.

Removes one replicated native loot entity from this client's projection and requires `world.loot`. It does not by itself delete the server record, so gameplay code should normally use the authoritative loot package API.

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

Returns: `true en cas de succès`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6683) as `LuaLootRemove`.

#### requestPickup

```lua
CyberM.loot.requestPickup(id)
```

`NETWORK` — Uses the network backend.

Demande au serveur de ramasser un drop.

Le serveur contrôle l'existence, le routing bucket et la distance calculée depuis son dernier snapshot du joueur.

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

Returns: `true si la requête réseau est partie`, `raison du refus local`

Registered in `ResourceHost.cpp` (line 6685) as `LuaLootRequest`.

#### setAuthorityEnabled

```lua
CyberM.loot.setAuthorityEnabled(enabled)
```

`GAME` — Requires a live game instance.

Active ou désactive la projection de loot autoritaire.

Réservé à `cyberm_loot`. Quand il est actif, les choix, conteneurs et drops vanilla sont neutralisés et les objets physiques deviennent de simples représentations du registre serveur.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | required | — |

Returns: `true en cas de succès`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6681) as `LuaLootAuthority`.

#### upsert

```lua
CyberM.loot.upsert(drop)
```

`GAME` — Requires a live game instance.

Crée ou met à jour la projection locale d'un drop serveur.

API interne de réplication. Demande la permission `world.loot`; un script gameplay ne doit pas inventer un drop côté client.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `drop` | `table { id, item, quantity, position, radius, label, model, revision }` | required | — |

Returns: `true en cas de succès`, `raison du refus`

Registered in `ResourceHost.cpp` (line 6682) as `LuaLootUpsert`.


### CyberM.markers — client runtime

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

5 functions.

#### clear

```lua
CyberM.markers.clear()
```

`GAME` — Requires a live game instance.

Removes every 3D marker owned by the calling resource.

Requires `world.markers`; other resources are unaffected.

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

Registered in `ResourceHost.cpp` (line 6800) as `LuaMarkerClear`.

#### create

```lua
CyberM.markers.create(options)
```

`GAME` — Requires a live game instance.

Creates a resource-owned 3D world marker.

Requires `world.markers`. Options require `position` and accept `shape`, `style`, `radius`, `maxDistance`, `minDistance`, and `visible`. The returned decimal-string handle preserves its full 64-bit identity.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `options` | `table` | required | — |

Returns: `marker handle string, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6797) as `LuaMarkerCreate`.

#### list

```lua
CyberM.markers.list()
```

`GAME` — Requires a live game instance.

Lists the calling resource's 3D markers.

Requires `world.markers`. Each snapshot includes its requested definition and whether the native renderer currently presents it.

Returns: `array of { id, shape, style, radius, maxDistance, minDistance, visible, rendered, position }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6801) as `LuaMarkerList`.

#### remove

```lua
CyberM.markers.remove(id)
```

`GAME` — Requires a live game instance.

Removes one resource-owned 3D marker.

Requires `world.markers`.

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

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

Registered in `ResourceHost.cpp` (line 6799) as `LuaMarkerRemove`.

#### update

```lua
CyberM.markers.update(id, patch)
```

`GAME` — Requires a live game instance.

Patches a resource-owned 3D marker.

Requires `world.markers`. Only supplied fields are changed, and ownership prevents mutation of another resource's marker.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `id` | `string` | required | — |
| `patch` | `table` | required | — |

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

Registered in `ResourceHost.cpp` (line 6798) as `LuaMarkerUpdate`.


### CyberM.nameplates — client runtime

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

4 functions.

#### clear

```lua
CyberM.nameplates.clear()
```

`GAME` — Requires a live game instance.

Removes every nameplate override owned by the calling resource.

Requires `ui.nameplates`; other owners are unaffected.

Returns: `true on success`

Registered in `ResourceHost.cpp` (line 6771) as `LuaNameplateClear`.

#### remove

```lua
CyberM.nameplates.remove(playerId)
```

`GAME` — Requires a live game instance.

Removes the calling resource's nameplate override for one player.

Requires `ui.nameplates`.

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

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

Registered in `ResourceHost.cpp` (line 6770) as `LuaNameplateRemove`.

#### set

```lua
CyberM.nameplates.set(playerId, options)
```

`GAME` — Requires a live game instance.

Creates or updates the calling resource's nameplate override for a remote player.

Requires `ui.nameplates`. Options accept `label`, `color`, `maxDistance`, and `visible`. Overrides are owner-scoped and cleaned up with the resource.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer|string` | required | — |
| `options` | `table` | required | — |

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

Registered in `ResourceHost.cpp` (line 6769) as `LuaNameplateSet`.

#### snapshot

```lua
CyberM.nameplates.snapshot()
```

`GAME` — Requires a live game instance.

Returns the currently rendered remote-player nameplates.

Requires `ui.nameplates`. Screen coordinates and distance describe the most recent presentation snapshot.

Returns: `array of { id, label, color, x, y, distance }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6772) as `LuaNameplateSnapshot`.


### CyberM.net — client runtime

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

2 functions.

#### emitServer

```lua
CyberM.net.emitServer(event, [payload])
```

`NETWORK` — Uses the network backend.

Sends an event to the server.

Alias of `TriggerServerEvent`: sends a bounded, serializable event payload to the authenticated server session. The current resource must declare `network.events`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6563) as `LuaTriggerServerEvent`.

#### on

```lua
CyberM.net.on(event, handler)
```

`NETWORK` — Uses the network backend.

Listens for an event coming from the server.

Registers an authenticated incoming server event and its callback for the current resource generation. It is the namespaced equivalent of `RegisterNetEvent` and requires `network.events`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `handler id`

Registered in `ResourceHost.cpp` (line 6562) as `LuaRegisterNetEvent`.


### CyberM.network — client runtime

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

7 functions.

#### catalog

```lua
CyberM.network.catalog()
```

`NETWORK` — Uses the network backend.

The catalog as of the last refresh.

Reads a snapshot: refreshing is asynchronous, so call `refresh`, then `catalog` a beat later.

Returns: `table { phase, generation, servers… }`

Registered in `ResourceHost.cpp` (line 6568) as `LuaNetworkCatalog`.

#### connect

```lua
CyberM.network.connect(endpoint, [name])
```

`NETWORK` — Uses the network backend.

Joins a CyberM server.

Starts a connection to the supplied CyberM server endpoint using the current identity and resource pipeline. It requires `network.client`; success means the request was accepted, while connection progress and errors are observed through `status()`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `endpoint` | `string` | required | — |
| `name` | `string` | optional | — |

Returns: `true when the request is accepted`, `reason for the refusal`

```lua
local ok, reason = CyberM.network.connect("127.0.0.1:11778", "Player")
```

Registered in `ResourceHost.cpp` (line 6569) as `LuaNetworkConnect`.

#### disconnect

```lua
CyberM.network.disconnect()
```

`NETWORK` — Uses the network backend.

Leaves the current server.

Requests an orderly disconnect with an optional diagnostic reason. It returns after queuing teardown; the session phase in `status()` is the authoritative view of when cleanup has completed.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6570) as `LuaNetworkDisconnect`.

#### identity

```lua
CyberM.network.identity()
```

`NETWORK` — Uses the network backend.

Reads the local Master-backed identity profile state.

Returns the durable user id, current display name, registration state, and asynchronous update phase. The private key is never exposed. This bridge exists for the trusted local server browser; server-downloaded resources should use the verified player APIs instead.

Returns: `table { phase, generation, userId, displayName, error, registered }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6573) as `LuaNetworkIdentity`.

#### identityUpdate

```lua
CyberM.network.identityUpdate(catalogUrl, displayName)
```

`NETWORK` — Uses the network backend.

Requests a signed username update from the Master.

Queues the HTTP enrollment on the networking worker and returns immediately. Poll `identity()` until the matching generation becomes `ready` or `failed`. The backend is deliberately available only to the trusted system server-browser resource and refuses updates during a live session.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `catalogUrl` | `string` | required | — |
| `displayName` | `string` | required | — |

Returns: `true when queued, otherwise false`, `reason`

Registered in `ResourceHost.cpp` (line 6572) as `LuaNetworkIdentityUpdate`.

#### refresh

```lua
CyberM.network.refresh([url])
```

`NETWORK` — Uses the network backend.

Asks the directory for the server catalog again.

Starts a master-server catalog refresh for the supplied URL and requires `network.client`. The call only accepts the request; use `catalog()` to inspect generation, phase, HTTP status, body and error.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `url` | `string` | optional | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6567) as `LuaNetworkRefresh`.

#### status

```lua
CyberM.network.status()
```

`NETWORK` — Uses the network backend.

State of the network session.

Returns the current client session snapshot: phase, endpoint, authenticated player identity, routing bucket, rates, server time, ping and downloaded resource-set metadata. Reading it does not initiate a connection or wait for a phase change.

Returns: `table { phase, endpoint, playerId, routingBucket, ping, error }`

Registered in `ResourceHost.cpp` (line 6571) as `LuaNetworkStatus`.


### CyberM.npcs — client runtime

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

5 functions.

#### all

```lua
CyberM.npcs.all()
```

`GAME` — Requires a live game instance.

Lists server-owned NPCs currently known by this client.

Canonical creation, tasks, health and removal are server-only; see wiki/npcs.md.

Returns: `array of NPC snapshots`

Registered in `ResourceHost.cpp` (line 6716) as `LuaNpcsAll`.

#### currentTask

```lua
CyberM.npcs.currentTask(id)
```

`GAME` — Requires a live game instance.

Returns the canonical active task ID for an NPC.

Returns the last CyberM NPC task snapshot currently presented for a network NPC. It requires `npcs.read`; task state is ephemeral and can disappear when the NPC leaves the streaming set.

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

Returns: `task id, or nil`

Registered in `ResourceHost.cpp` (line 6719) as `LuaNpcCurrentTask`.

#### entity

```lua
CyberM.npcs.entity(id)
```

`GAME` — Requires a live game instance.

Returns the ephemeral local CyberM entity handle for an NPC projection.

Returns nil before readiness and after stream-out. Never cache this handle across lifecycle changes.

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

Returns: `entity, or nil`

Registered in `ResourceHost.cpp` (line 6718) as `LuaNpcEntity`.

#### get

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

`GAME` — Requires a live game instance.

Reads one server-owned NPC currently known by this client.

Read-only and guarded by npcs.read. The local entity handle is generation-checked and becomes invalid after stream-out.

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

Returns: `NPC snapshot, or nil`

Registered in `ResourceHost.cpp` (line 6715) as `LuaNpcGet`.

#### isStreamedIn

```lua
CyberM.npcs.isStreamedIn(id)
```

`GAME` — Requires a live game instance.

Whether an NPC projection is attached and ready locally.

Reports whether a network NPC currently has a live client proxy in this player's streaming scope. It does not request streaming or prove that the server NPC record no longer exists.

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

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6717) as `LuaNpcIsStreamedIn`.


### CyberM.players — 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.

#### allHealthStates

```lua
CyberM.players.allHealthStates()
```

`GAME` — Requires a live game instance.

Lists all replicated player health snapshots known to the client.

Requires `players.life.read`; returns an empty array when unavailable.

Returns: `array of health snapshots`

Registered in `ResourceHost.cpp` (line 6735) as `LuaPlayerHealthAll`.

#### allLifeStates

```lua
CyberM.players.allLifeStates()
```

`GAME` — Requires a live game instance.

Lists all replicated canonical player life states known to the client.

Requires `players.life.read`; returns an empty array when unavailable.

Returns: `array of life snapshots`

Registered in `ResourceHost.cpp` (line 6733) as `LuaPlayerLifeAll`.

#### getHealthState

```lua
CyberM.players.getHealthState([playerId])
```

`GAME` — Requires a live game instance.

Reads one replicated player health snapshot.

Requires `players.life.read`. Omit `playerId` for the local player.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer` | optional | — |

Returns: `table { playerId, revision, health, maxHealth, armor, godMode, lastAttacker, lastDamage, lastAttackKind, lastBodyPart, lastHitDirection }, or nil`

Registered in `ResourceHost.cpp` (line 6734) as `LuaPlayerHealthState`.

#### getLifeState

```lua
CyberM.players.getLifeState([playerId])
```

`GAME` — Requires a live game instance.

Reads the canonical replicated life state of one player.

Requires `players.life.read`. Omit `playerId` for the local session player.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer` | optional | — |

Returns: `life snapshot, or nil`

Registered in `ResourceHost.cpp` (line 6730) as `LuaPlayerLifeState`.

#### getLocalDeathContext

```lua
CyberM.players.getLocalDeathContext()
```

`GAME` — Requires a live game instance.

Reads the local player's replicated death context.

Requires `players.life.read`. The snapshot includes phase, cause, killer, weapon, position, yaw, impulse, revision and grace duration.

Returns: `life snapshot, or nil`

Registered in `ResourceHost.cpp` (line 6731) as `LuaLocalDeathContext`.

#### isDead

```lua
CyberM.players.isDead([playerId])
```

`GAME` — Requires a live game instance.

Whether a player is canonically dead or awaiting revive/respawn.

Requires `players.life.read`. Omit `playerId` for the local player. Unknown or unavailable states return false.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `playerId` | `integer` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6732) as `LuaPlayerIsDead`.


### CyberM.Promise — client runtime

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

2 functions.

#### await

```lua
CyberM.Promise.await()
```

`SHARED` — Available without a live game instance.

Waits for a promise to settle.

Only usable inside a `CreateThread`.

Returns: `resolved value, or nil`, `rejection reason`

Registered in `ResourceHost.cpp` (line 6461) as `LuaPromiseAwait`.

#### status

```lua
CyberM.Promise.status()
```

`SHARED` — Available without a live game instance.

State of the promise, without waiting.

Returns the promise state without yielding the current coroutine. Use it for polling or diagnostics; `await()` remains the normal way to receive a completed export result.

Returns: `"pending", "resolved" or "rejected"`

Registered in `ResourceHost.cpp` (line 6462) as `LuaPromiseStatus`.


### CyberM.resource — 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.

#### generation

```lua
CyberM.resource.generation([resource])
```

`SHARED` — Available without a live game instance.

Generation number, incremented on every reload.

With no argument, returns the current resource generation. Pass a resource name to inspect that resource, or receive nil when it is missing.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | optional | — |

Returns: `integer, or nil`

Registered in `ResourceHost.cpp` (line 6518) as `LuaResourceGeneration`.

#### hasPermission

```lua
CyberM.resource.hasPermission(permission)
```

`SHARED` — Available without a live game instance.

Whether the resource holds this permission.

Checks whether the current resource manifest grants an exact CyberM capability. It is a read-only convenience check; native APIs still enforce their own permission and must handle refusal results.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `permission` | `string` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6522) as `LuaHasPermission`.

#### name

```lua
CyberM.resource.name()
```

`SHARED` — Available without a live game instance.

Name of the current resource.

Returns the current resource's immutable manifest name. This is equivalent to `GetCurrentResourceName()` and remains stable for the lifetime of the resource definition.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6517) as `LuaResourceName`.

#### readFile

```lua
CyberM.resource.readFile(path)
```

`SHARED` — Available without a live game instance.

Reads a file from the resource, within its declared allowlist.

Reads a file declared by the current resource manifest through a safe relative path. Undeclared files, traversal, oversized content and host filesystem paths are rejected.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `path` | `string` | required | — |

Returns: `contents, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6521) as `LuaReadFile`.

#### state

```lua
CyberM.resource.state([resource])
```

`SHARED` — Available without a live game instance.

State of a resource.

Returns the lifecycle state known for a resource name, or for the current resource when omitted. It is an immediate snapshot and does not wait for dependencies or mutate lifecycle state.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | optional | — |

Returns: `string`

Registered in `ResourceHost.cpp` (line 6520) as `LuaGetResourceState`.

#### version

```lua
CyberM.resource.version()
```

`SHARED` — Available without a live game instance.

Version declared in `cyberm.lua`.

Returns the version string declared by the current resource manifest. It is package metadata and is unrelated to the CyberM runtime or Lua interpreter version.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6519) as `LuaResourceVersion`.


### CyberM.runtime — client runtime

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

2 functions.

#### luaVersion

```lua
CyberM.runtime.luaVersion()
```

`SHARED` — Available without a live game instance.

Embedded Lua version.

Returns the embedded Lua interpreter version used by this resource VM. Use it for diagnostics or compatibility checks, not to infer the CyberM build version.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6546) as `LuaLanguageVersion`.

#### version

```lua
CyberM.runtime.version()
```

`SHARED` — Available without a live game instance.

CyberM version.

Returns the CyberM scripting runtime version exposed to resources. This describes the host API and is distinct from both the resource manifest version and game build.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6545) as `LuaRuntimeVersion`.


### CyberM.session — client runtime

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

3 functions.

#### loadPristine

```lua
CyberM.session.loadPristine()
```

`GAME` — Requires a live game instance.

Loads the local development world from CyberM's bundled pristine save.

No network session is armed by this operation.

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

Registered in `ResourceHost.cpp` (line 6596) as `LuaSessionLoadPristine`.

#### openSettings

```lua
CyberM.session.openSettings()
```

`GAME` — Requires a live game instance.

Opens the game's own settings screen without exposing the pause menu.

Requests the client-side CyberM settings interface. It only changes local presentation and does not modify server configuration or another player's settings.

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

Registered in `ResourceHost.cpp` (line 6595) as `LuaSessionOpenSettings`.

#### setMenuReady

```lua
CyberM.session.setMenuReady(ready)
```

`GAME` — Requires a live game instance.

Declares that this resource is able to serve the pause menu.

The escape key is only intercepted while this is true. A resource that fails to start therefore leaves the game's own menu reachable, rather than stranding the player with none.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `ready` | `boolean` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6597) as `LuaSessionMenuReady`.


### CyberM.settings — client runtime

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

3 functions.

#### request

```lua
CyberM.settings.request(group)
```

`GAME` — Requires a live game instance.

Asks the script bridge to list the variables of a group.

Asynchronous: request, then read with `values` a beat later.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `group` | `string` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6601) as `LuaSettingsRequest`.

#### set

```lua
CyberM.settings.set(group, name, value)
```

`GAME` — Requires a live game instance.

Writes a settings variable.

Submits one local CyberM setting change through the settings backend. The key, value type and published bounds are validated; use `values()` to read the resulting projection.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `group` | `string` | required | — |
| `name` | `string` | required | — |
| `value` | `integer` | required | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6603) as `LuaSettingsSet`.

#### values

```lua
CyberM.settings.values()
```

`GAME` — Requires a live game instance.

The variables as the script last reported them.

Returns a snapshot of the settings currently published by the client backend. The returned table is a copy and modifying it does not apply changes.

Returns: `table of { name, value, minimum, maximum, step }`

Registered in `ResourceHost.cpp` (line 6602) as `LuaSettingsValues`.


### CyberM.sfx — client runtime

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

4 functions.

#### clear

```lua
CyberM.sfx.clear()
```

`GAME` — Requires a live game instance.

Stops every SFX owned by the calling resource.

Requires `world.effects`; VFX and other resource owners are unaffected.

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

Registered in `ResourceHost.cpp` (line 6821) as `LuaEffectClear`.

#### list

```lua
CyberM.sfx.list()
```

`GAME` — Requires a live game instance.

Lists active SFX owned by the calling resource.

Requires `world.effects`.

Returns: `array of { id, kind, name, entity, remaining }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6824) as `LuaEffectList`.

#### play

```lua
CyberM.sfx.play(event, [options])
```

`GAME` — Requires a live game instance.

Starts resource-owned spatial audio on an entity.

Requires `world.effects`. Options accept `entity`, `emitter`, `tag`, `seekTime`, `duration`, and `unique`; omitting `entity` uses the local player.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `options` | `table` | optional | — |

Returns: `effect handle string, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6818) as `LuaSfxPlay`.

#### stop

```lua
CyberM.sfx.stop(id)
```

`GAME` — Requires a live game instance.

Stops one SFX handle owned by the calling resource.

Requires `world.effects`. REDengine stops audio by event name, so identical simultaneous events on one entity may share stop behavior.

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

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

Registered in `ResourceHost.cpp` (line 6819) as `LuaEffectStop`.


### CyberM.time — client runtime

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

1 function.

#### monotonic

```lua
CyberM.time.monotonic()
```

`SHARED` — Available without a live game instance.

Monotonic clock, in milliseconds.

Never goes backwards, unlike wall-clock time: this is the one to measure a duration with.

Returns: `number`

Registered in `ResourceHost.cpp` (line 6513) as `LuaMonotonic`.


### CyberM.travel — client runtime

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

4 functions.

#### isNoclip

```lua
CyberM.travel.isNoclip()
```

`GAME` — Requires a live game instance.

Whether local-player noclip is currently active.

Returns false without `player.travel` or when the backend is unavailable.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6763) as `LuaTravelIsNoclip`.

#### setNoclip

```lua
CyberM.travel.setNoclip(enabled)
```

`GAME` — Requires a live game instance.

Enables or disables native noclip for the local player.

Requires `player.travel`. Multiplayer deployments should expose this only behind an ACL-checked server command.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | required | — |

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

Registered in `ResourceHost.cpp` (line 6762) as `LuaTravelSetNoclip`.

#### setNoclipSpeed

```lua
CyberM.travel.setNoclipSpeed(speed)
```

`GAME` — Requires a live game instance.

Sets the local noclip movement speed.

Requires `player.travel`; the value must be finite and is validated by the native backend.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `speed` | `number` | required | — |

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

Registered in `ResourceHost.cpp` (line 6764) as `LuaTravelSetNoclipSpeed`.

#### teleport

```lua
CyberM.travel.teleport(x, y, z, [heading])
```

`GAME` — Requires a live game instance.

Teleports the local player directly to a world transform.

Requires `player.travel`. Prefer the authoritative server respawn transaction for long-distance multiplayer moves because it handles streaming and life state.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `x` | `number` | required | — |
| `y` | `number` | required | — |
| `z` | `number` | required | — |
| `heading` | `number` | optional | `0` |

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

Registered in `ResourceHost.cpp` (line 6765) as `LuaTravelTeleport`.


### 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`.


### CyberM.vfx — 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.

#### catalog

```lua
CyberM.vfx.catalog()
```

`GAME` — Requires a live game instance.

Returns the curated stable world-VFX aliases and cooked paths.

Catalog access does not start an effect. Raw cooked paths remain build-dependent even when present.

Returns: `table mapping alias to effect path, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6814) as `LuaVfxCatalog`.

#### clear

```lua
CyberM.vfx.clear()
```

`GAME` — Requires a live game instance.

Stops every VFX owned by the calling resource.

Requires `world.effects`; SFX and other resource owners are unaffected.

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

Registered in `ResourceHost.cpp` (line 6809) as `LuaEffectClear`.

#### list

```lua
CyberM.vfx.list()
```

`GAME` — Requires a live game instance.

Lists active VFX owned by the calling resource.

Requires `world.effects`.

Returns: `array of { id, kind, name, entity, remaining }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6812) as `LuaEffectList`.

#### play

```lua
CyberM.vfx.play(effect, options)
```

`GAME` — Requires a live game instance.

Starts a resource-owned world VFX at a fixed transform.

Requires `world.effects`. `options` requires `position` and accepts `orientation`, `duration`, and `ignoreTimeDilation`. The effect is released automatically with its owner.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `effect` | `string` | required | — |
| `options` | `table` | required | — |

Returns: `effect handle string, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6805) as `LuaVfxPlay`.

#### playEntity

```lua
CyberM.vfx.playEntity(effect, [options])
```

`GAME` — Requires a live game instance.

Starts a resource-owned authored VFX on an entity.

Requires `world.effects`. Options accept `entity`, `instance`, `persistOnDetach`, `breakAllLoops`, `breakAllOnDestroy`, and `duration`; omitting `entity` targets the local player.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `effect` | `string` | required | — |
| `options` | `table` | optional | — |

Returns: `effect handle string, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6806) as `LuaVfxPlayEntity`.

#### stop

```lua
CyberM.vfx.stop(id)
```

`GAME` — Requires a live game instance.

Stops one VFX handle owned by the calling resource.

Requires `world.effects`.

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

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

Registered in `ResourceHost.cpp` (line 6807) as `LuaEffectStop`.


### CyberM.webui — client runtime

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

2 functions.

#### create

```lua
CyberM.webui.create(options)
```

`SHARED` — Available without a live game instance.

Creates a web surface.

**Creation is asynchronous.** A `show()` issued right after `create` loses the race against the `visible` flag the request carried, and the surface then never paints at all. So a surface meant to stay up is created with `visible = true`, and the page shows or hides its own content.

Valid layers: `hud`, `menu`, `modal`, `system` (needs the `webui.system` permission), `debug`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `options` | `table` | required | — |

Returns: `surface, or nil`, `reason`

```lua
local overlay = WebUI.create({
    entry = "web/index.html",
    layer = "hud",
    transparent = true,
    visible = true          -- never false for a permanent overlay
})
```

Registered in `ResourceHost.cpp` (line 6581) as `LuaWebUiCreate`.

#### default

```lua
CyberM.webui.default()
```

`SHARED` — Available without a live game instance.

The surface declared by `web_ui_page` in the manifest.

Returns the auto-created WebUI page declared by `web_ui_page` in the current manifest. It returns `nil, reason` when the resource has no live default page; the handle is generation-owned and becomes stale after destroy or reload.

Returns: `surface, or nil`

Registered in `ResourceHost.cpp` (line 6582) as `LuaWebUiDefault`.


### WebUI.Page — client runtime

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

9 functions.

#### destroy

```lua
WebUI.Page.destroy()
```

`SHARED` — Available without a live game instance.

Destroys the surface.

Destroys this resource-owned browser surface, removes all of its Lua event handlers and invalidates the page handle. Resource teardown performs the same cleanup automatically.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6472) as `LuaWebPageDestroy`.

#### hide

```lua
WebUI.Page.hide()
```

`SHARED` — Available without a live game instance.

Hides the surface.

Makes the owned browser surface invisible without destroying its document or handlers. Visibility is client-local and can be restored with `show()`.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6474) as `LuaWebPageVisibility`.

#### id

```lua
WebUI.Page.id()
```

`SHARED` — Available without a live game instance.

Numeric id of the surface.

Returns the opaque client-local surface id for diagnostics and host integration. It is not a network id and must not be persisted across page destruction or resource reload.

Returns: `integer`

Registered in `ResourceHost.cpp` (line 6471) as `LuaWebPageId`.

#### off

```lua
WebUI.Page.off(event, handler)
```

`SHARED` — Available without a live game instance.

Removes a handler registered with `on`.

Removes one WebUI callback id previously returned by `page:on`. The id must belong to this page and the current resource generation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6478) as `LuaWebPageOff`.

#### on

```lua
WebUI.Page.on(event, handler)
```

`SHARED` — Available without a live game instance.

Listens for an event the page raised with `CyberM.emit`.

Registers a Lua callback for an event emitted by this page's JavaScript bridge. Event names and handler counts are bounded, and the registration is automatically removed with the page or resource generation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `handler` | `function` | required | — |

Returns: `handler id`

Registered in `ResourceHost.cpp` (line 6477) as `LuaWebPageOn`.

#### reply

```lua
WebUI.Page.reply(request, ok, [payload])
```

`SHARED` — Available without a live game instance.

Answers an `invoke` call made by the page.

Completes a pending JavaScript request identified by its request id with a JSON-serializable Lua value. Request ids are page-local and invalid or unsupported payloads are rejected.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `request` | `integer` | required | — |
| `ok` | `boolean` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6479) as `LuaWebPageReply`.

#### send

```lua
WebUI.Page.send(event, [payload])
```

`SHARED` — Available without a live game instance.

Sends an event to the page.

Sends a named event and JSON-serializable payload from Lua to this page's JavaScript runtime. This is local UI IPC, not a network event, and both event names and payloads are bounded.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `event` | `string` | required | — |
| `payload` | `table` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6476) as `LuaWebPageSend`.

#### setFocus

```lua
WebUI.Page.setFocus(focused, [cursor], [keyboard])
```

`SHARED` — Available without a live game instance.

Gives the surface focus, cursor and keyboard separately.

Keyboard capture is asked for separately so a page can take the mouse without depriving the game of the movement keys.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `focused` | `boolean` | required | — |
| `cursor` | `boolean` | optional | — |
| `keyboard` | `boolean` | optional | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6475) as `LuaWebPageFocus`.

#### show

```lua
WebUI.Page.show()
```

`SHARED` — Available without a live game instance.

Shows the surface.

Avoid calling this right after `create` — see the race described in `CyberM.webui.create`.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6473) as `LuaWebPageVisibility`.


