Rally Codriver
Class representing a rally co-driver within a notebook. Each codriver has a name, language, voice setting, and unique persistent key (pk). Codrivers determine which language and voice are used for pac
Class representing a rally co-driver within a notebook. Each codriver has a name, language, voice setting, and unique persistent key (pk). Codrivers determine which language and voice are used for pacenote audio playback.
Constructor
local Codriver = require('gameplay/rally/notebook/codriver')
local cd = Codriver(notebook, name, forceId)| Parameter | Type | Description |
|---|---|---|
notebook | object | Parent notebook instance |
name | string? | Display name (defaults to "Codriver {id}" or default codriver name) |
forceId | number? | Override auto-generated ID |
Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | (notebook, name, forceId) | nil | Sets up codriver with defaults from rallyUtil |
onSerialize | () | table | Returns serializable data (oldId, name, language, voice, pk) |
onDeserialized | (data, oldIdMap) | nil | Restores codriver from saved data |
Internals
Fields
| Field | Type | Default | Description |
|---|---|---|---|
id | number | auto | Unique ID within notebook |
name | string | "Codriver {id}" | Display name |
language | string | rallyUtil.default_codriver_language | Language code |
voice | string | rallyUtil.default_codriver_voice | Voice identifier |
pk | string | rallyUtil.randomId() | Persistent key (survives re-indexing) |
sortOrder | number | 999999 | Sort position in codriver list |
Serialization
If the notebook has no codrivers, the first one created uses rallyUtil.defaultCodriverName. The pk field is generated on creation and preserved through serialize/deserialize cycles. Legacy data without pk gets a new random ID on deserialization.
How It Works
- Created by the notebook's
sortedListsystem vianotebook.codrivers:create() - Each codriver defines a language + voice combination for pacenote TTS
- The active codriver is selected via
missionSettingsusing the codriver'spk - Serialized into the notebook JSON file alongside pacenotes
Usage Example
-- Create a new codriver in a notebook
local cd = notebook.codrivers:create("My Codriver")
cd.language = "english"
cd.voice = "voice_01"
-- Use this codriver
notebook:useCodriver(cd)
-- Serialize
local data = cd:onSerialize()
-- { oldId=1, name="My Codriver", language="english", voice="voice_01", pk="abc123" }See Also
- Rally Mission Settings - Related reference
- Rally Pacenote - Related reference
- Pacenote Generator - Related reference
- Gameplay Systems Guide - Guide
Staged Countdown Utilities
Shared utility functions for the staged countdown system. Provides debug drawing helpers (plane visualization, vehicle-to-plane distance, vehicle point), vehicle freeze/unfreeze controls, and ImGui de
Rally Mission Settings
Class managing per-mission rally settings stored as a JSON file alongside mission data. Handles notebook filename selection, codriver selection, and persistence. Auto-creates defaults if the settings