field
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
field
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->TODO: describe this module.
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 field, and the race itself.
handleStore( ) → void
Event-bus subscriptions live on the shared state, not in a local. A module reload gives this file a fresh set of locals but leaves the previous instance's listeners on the bus, and a teardown that only knows its own handles can never take them off. Two race directors then judge the same lap and undo each other. Keeping the handles somewhere that outlives the reload is what makes teardown honest.
clamp(v: ?, lo: ?, hi: ?) → void
| arg | type | description |
|---|---|---|
| v | ? | |
| lo | ? | |
| hi | ? |
wrapPi(a: ?) → void
| arg | type | description |
|---|---|---|
| a | ? |
lineIsStale( ) → void
buildLine( ) → void
lineAt(arr: ?, t: ?) → void
| arg | type | description |
|---|---|---|
| arr | ? | |
| t | ? |
gridSlot(i: ?) → void
Slot 1 is pole and sits on the centreline, because that is where the scene's player spawn is; the rest fall in behind it, alternating sides, the way a grid does.
| arg | type | description |
|---|---|---|
| i | ? |
applyTransform(riv: ?) → void
| arg | type | description |
|---|---|---|
| riv | ? |
hasBody(e: ?) → void
What a dressed chair looks like inside is the racer slice's business, so the test is only whether there is a body there at all.
| arg | type | description |
|---|---|---|
| e | ? |
ensureDressed(riv: ?) → void
| arg | type | description |
|---|---|---|
| riv | ? |
placeRival(riv: ?) → void
| arg | type | description |
|---|---|---|
| riv | ? |
localT(prevT: ?, pos: ?) → void
Where a rival is on the lap, searched only NEAR where it was. A street circuit doubles back on itself, so the nearest point on the whole centreline is not always a point on the part of the lap the chair is actually driving: run wide alongside a parallel straight and the closest centreline is the other one, a third of a lap away. The lap counter reads that jump as a lap reversed over and takes the lap back. Seeding the search from the previous position keeps the lap fraction continuous, which is the only thing that makes it countable.
| arg | type | description |
|---|---|---|
| prevT | ? | |
| pos | ? |
lateralOf(rec: ?) → void
| arg | type | description |
|---|---|---|
| rec | ? |
updateBattle(riv: ?, rec: ?, dt: ?) → void
Who is in the way, and which side to go round. Recomputed four times a second — a racing line does not need to be re-argued every frame.
| arg | type | description |
|---|---|---|
| riv | ? | |
| rec | ? | |
| dt | ? |
driveRival(riv: ?, rec: ?, dt: ?) → void
| arg | type | description |
|---|---|---|
| riv | ? | |
| rec | ? | |
| dt | ? |
material(name: ?, color: ?, opts: ?) → void
Authoring a material costs a source write, and a rebuild after a hot-reload would pay for every one of them again. The look of a material is fixed by its name here, so an existing one is the one we wanted: reuse it, and only author what is genuinely missing.
| arg | type | description |
|---|---|---|
| name | ? | |
| color | ? | |
| opts | ? |
box(parent: ?, name: ?, mat: ?, position: ?, scale: ?, yaw: ?) → void
| arg | type | description |
|---|---|---|
| parent | ? | |
| name | ? | |
| mat | ? | |
| position | ? | |
| scale | ? | |
| yaw | ? |
buildCeremony(root: ?) → void
| arg | type | description |
|---|---|---|
| root | ? |
at(across: ?, along: ?) → void
Sat proud of the tarmac: the track slice lays its ribbon and its own markings around y = 0, and paint drawn level with them disappears into the surface.
| arg | type | description |
|---|---|---|
| across | ? | |
| along | ? |
overLine(across: ?, height: ?, along: ?) → void
| arg | type | description |
|---|---|---|
| across | ? | |
| height | ? | |
| along | ? |
setLight(i: ?, mat: ?) → void
| arg | type | description |
|---|---|---|
| i | ? | |
| mat | ? |
showFlag(on: ?) → void
| arg | type | description |
|---|---|---|
| on | ? |
updateLights(phase: ?, dt: ?) → void
| arg | type | description |
|---|---|---|
| phase | ? | |
| dt | ? |
normaliseGrid( ) → void
At lights out, everyone still behind the start line is on lap 0 and everyone already across it is a lap in. Without this the grid is scored as if the rivals had each already taken the flag once, and pole would owe the field an extra lap. The window is narrow on purpose: the grid sits within a few metres of the line, so anything further round the lap than that is not on the grid at all, and giving it the lap would be giving away a place.
minLapTime( ) → void
The fastest a lap could possibly be driven: the whole circuit at the boost ceiling, with a margin. Nothing on the road can beat it.
lapWasDriven(id: ?) → void
A lap that arrives sooner than that was not driven — the racer's lap fraction jumped. A circuit that runs beside itself makes this real: a chair standing still where two parts of the lap are about equally close flickers between them, and each flicker backwards over the line reads as a lap completed. Left alone, a parked chair wins the race. The last-crossing clock is kept ON THE RACER, not in a local here: a module reload replaces this file's locals but not the racers, and a judgement made against a wiped clock throws away a real lap. Keeping it on the record also makes a second pass over the same lap a no-op (`last == now`), so nothing is judged twice.
| arg | type | description |
|---|---|---|
| id | ? |
holdLapCounts( ) → void
The other half of the same problem, and this one is silent: the contract takes a lap BACK when the lap fraction jumps forwards, reading it as a racer reversing over the line, and emits nothing. A chair travelling forwards at racing speed did not reverse over anything — the jump is the lap fraction resolving to another part of the circuit — so the lap is put back. Left alone the field quietly drives an extra lap for every jump, and the flag comes minutes late. Nothing in this race un-drives a lap: there is no reversing back over the line as a tactic, and a chair standing still has not gone anywhere. So within a race the lap count only ever goes up, and a drop is the lap fraction jumping rather than a lap being given back.
classifyRemaining( ) → void
reseatPlayer( ) → void
Put the player back on pole. The racer slice keeps the chair's pose in its own state and writes it to the entity every frame, so the body has to be handed back FIRST — move a chair the racer slice is still driving and its next update puts it straight back where it was.
ensurePlayerSeated( ) → void
restart( ) → void
subscribe( ) → void
unsubscribe( ) → void
teardown( ) → void
build( ) → void
update(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
classification( ) → void
The classification as it stands: leader first, with the place and time of everyone who has already taken the flag.
lightsLit( ) → void
How many of the five lights are lit right now (-1 while they are green at lights out).
lineAt(t: ?) → void
The racing line the rivals drive, sampled at lap fraction t: the sideways offset from the centreline, and the speed it allows.
| arg | type | description |
|---|---|---|
| t | ? |
debug( ) → void
What each rival is actually doing, for a probe or a test.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
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.