gp
One-paragraph description of what this module provides and who consumes it.
gp
One-paragraph description of what this module provides and who consumes it.
Exports
M.exampleFn(arg) -> result— what it does and when to call it.M.exampleValue: type— what value it carries.
Usage
local M = require("@<youridentity>::modules.gp")
M.exampleFn("foo")
Notes
- Anything callers need to know about THIS module: required runtime ordering, state ownership, side effects.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2CHAIRSHIFT GP — the shared contract. Every slice of the game codes against THIS table: the tuning numbers, the run's state, the event bus the slices talk over, the racing line they all read, and the rules that decide laps, standings and the flag. Require it from anywhere in this world with exactly this form: local GP = require("game.gp") The module loads ONCE, so a field one component writes is the field another component reads. The world is ALWAYS multiplayer. Never cache an entity ref across frames; re-resolve through the accessors at the bottom of this file.
on(event: ?, fn: ?) → void
| arg | type | description |
|---|---|---|
| event | ? | |
| fn | ? |
off(event: ?, handle: ?) → void
| arg | type | description |
|---|---|---|
| event | ? | |
| handle | ? |
emit(event: ?, ...: ?) → void
| arg | type | description |
|---|---|---|
| event | ? | |
| ... | ? |
notice(text: ?) → void
| arg | type | description |
|---|---|---|
| text | ? |
defaultLoop( ) → void
rebuild( ) → void
setCentreline(points: ?, opts: ?) → void
The track slice calls this with its circuit's centreline (a closed loop of { x, y, z }, in order, no repeated final point).
| arg | type | description |
|---|---|---|
| points | ? | |
| opts | ? |
centreline( ) → void
wrap01(t: ?) → void
| arg | type | description |
|---|---|---|
| t | ? |
trackPoint(t: ?) → void
Position on the racing line at lap fraction t.
| arg | type | description |
|---|---|---|
| t | ? |
trackFrame(t: ?) → void
Position + unit tangent + unit right at lap fraction t. `right` is the track's own sideways axis, so `pos + right * d` moves d metres across it.
| arg | type | description |
|---|---|---|
| t | ? |
nearestT(pos: ?) → void
Where a world position sits on the lap. Returns the lap fraction, the signed sideways offset in metres (negative = left of the line), and whether that offset is still inside the barriers.
| arg | type | description |
|---|---|---|
| pos | ? |
registerRacer(rec: ?) → void
RACERS A racer record — the player's and every rival's: id string, unique name string, shown in the standings entity entity id string of the body that moves isPlayer bool color { r, g, b } livery, 0..1 lap int, 0 on the grid t number, lap fraction 0..1 progress number, lap + t — the single sortable number speed number, m/s (whoever moves the racer writes it) boost number, seconds banked charge number, drift charge missiles int, held spinUntil number, race clock the racer regains control at place int, filled in once finished time number, race clock at the flag
| arg | type | description |
|---|---|---|
| rec | ? |
racer(id: ?) → void
| arg | type | description |
|---|---|---|
| id | ? |
racerList( ) → void
playerRacer( ) → void
unregisterRacer(id: ?) → void
A slice removes the racers it registered, and only those. The player can be ready before or after the slices build, so nothing clears the whole registry on load — whoever put a racer in takes it out.
| arg | type | description |
|---|---|---|
| id | ? |
clearRacers( ) → void
reportPosition(id: ?, pos: ?) → void
RULES — lap counting, standings, hits, the flag. Whoever moves a racer calls this once a frame with its world position. It advances the lap when the racer crosses the line going forwards, and refuses to count a lap the racer reversed over.
| arg | type | description |
|---|---|---|
| id | ? | |
| pos | ? |
finishRacer(id: ?) → void
| arg | type | description |
|---|---|---|
| id | ? |
standings( ) → void
Leader first. Finished racers hold their finishing order ahead of everyone still running.
setPhase(phase: ?) → void
| arg | type | description |
|---|---|---|
| phase | ? |
isRacing( ) → void
tick(dt: ?) → void
Advance the race clock. The race director owns this call — one per frame.
| arg | type | description |
|---|---|---|
| dt | ? |
applyHit(victimId: ?, sourceId: ?) → void
A missile connected. The racer slice reads `spinUntil` to know it is out of control; the HUD reads the event to shake and flash.
| arg | type | description |
|---|---|---|
| victimId | ? | |
| sourceId | ? |
isSpun(id: ?) → void
| arg | type | description |
|---|---|---|
| id | ? |
giveMissile(id: ?, count: ?) → void
Hand a racer a missile. Returns how many it now holds.
| arg | type | description |
|---|---|---|
| id | ? | |
| count | ? |
takeMissile(id: ?) → void
Spend a missile. Returns true if one was there to spend.
| arg | type | description |
|---|---|---|
| id | ? |
racerAhead(id: ?) → void
The racer directly ahead on the road — what a missile homes onto.
| arg | type | description |
|---|---|---|
| id | ? |
localChair( ) → void
THE PLAYER — reached through the scene, never cached. The local player's chair: the PlayerPrototype body the engine cloned for THIS client. Returns an entity ref, or nil before the player is up.
localChairId( ) → void
positionOf(entityId: ?) → void
Plain { x, y, z } for an entity id, or nil if it is gone.
| arg | type | description |
|---|---|---|
| entityId | ? |
reset( ) → void
RESET — a fresh race without reloading the world.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.