Structured Pacenote Data
Class holding the structured (machine-readable) data for a single pacenote. Stores field values from the schema (corner severity, direction, length, modifiers, etc.) and handles serialization with leg
Class holding the structured (machine-readable) data for a single pacenote. Stores field values from the schema (corner severity, direction, length, modifiers, etc.) and handles serialization with legacy migration.
Constructor
local Structured = require('gameplay/rally/notebook/structured')
local s = Structured()Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | () | nil | Initializes all fields to schema defaults |
onDeserialized | (data) | nil | Loads from saved data with legacy migrations |
onSerialize | () | table | Returns the fields table |
Internals
Fields
The self.fields table maps field names to values, initialized from Schema.initDefaultFields:
{
cornerSeverity = -1, -- -1 to 100 (severity rating)
cornerDirection = 0, -- -1=left, 0=straight, 1=right
cornerLength = 50, -- 0-100 normalized
cornerRadiusChange = 50, -- 0-100 normalized
cornerSquare = false, -- special square corner type
caution = 0, -- 0=none, 1/2/3=caution levels
modDontCut = false,
modNarrows = false,
modWater = false,
modBumpy = false,
modBump = false,
modJump = false,
modCrest = false,
finishLine = false
}Legacy Migrations (onDeserialized)
| Legacy Value | Migration |
|---|---|
cornerSeverity == 0 | → -1 (unset) |
cornerLength == 0 or 20 | → 50 (normal) |
cornerRadiusChange == 0 or 20 | → 50 (normal) |
modCaution / modCaution1 | → caution = 1 |
modCaution2 | → caution = 2 |
modCaution3 | → caution = 3 |
modBumps | → modBumpy = true |
Type Coercion
During deserialization, number and enum schema types are forced through tonumber() to handle string-encoded values from JSON.
How It Works
- Each pacenote contains one
Structuredinstance atpacenote.structured - Fields represent the machine-readable description of the corner/note
- The text compositor reads these fields to generate human-readable note strings
- The visual compositor reads these fields to generate HUD display elements
- Legacy data from older notebook versions is automatically migrated on load
Usage Example
local Structured = require('gameplay/rally/notebook/structured')
local s = Structured()
-- Set corner data
s.fields.cornerSeverity = 40
s.fields.cornerDirection = 1 -- right
s.fields.cornerLength = 30 -- short-ish
s.fields.modCrest = true
-- Serialize
local data = s:onSerialize()
-- { cornerSeverity=40, cornerDirection=1, cornerLength=30, modCrest=true, ... }
-- Deserialize (with legacy migration)
local s2 = Structured()
s2:onDeserialized(data)See Also
- Rally Codriver - Related reference
- Rally Mission Settings - Related reference
- Rally Pacenote - Related reference
- Gameplay Systems Guide - Guide
Notebook Path
Core class representing a rally notebook - the container for pacenotes, codrivers, and all rally authoring data. Manages saving/loading from JSON, codriver selection, audio mode, pacenote generation,
System Pacenotes
Legacy module for defining static co-driver pacenotes (countdown, finish, damage, first-note intro/outro). **Entirely commented out** - system pacenotes are now defined in compositor config files inst