shared
Result envelopes and the scene readers that snapshot and remoteActivity both use.
Result envelopes and the scene readers that snapshot and remoteActivity both use.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2Shared Module Cross-tool helpers for rainlineTest: the result envelope, and the scene readers more than one tool needs. Every entity read here is guarded. Entities in this world are despawned and respawned constantly -- stage swaps, race restarts, peers arriving -- and a handle read a frame after it was found will raise. A bench that throws while reporting the state is worse than one that reports less: it tells you nothing and loses the run.
ok(value: any?, formatted: string?) → ToolResult
Build a success result.
| arg | type | description |
|---|---|---|
| value | any? | Optional payload returned to the caller. |
| formatted | string? | Optional human-readable stdout string. |
examples
return shared.ok({ peer = 6 }, "one peer")fail(message: string, exitCode: number?) → ToolResult
Build a failure result.
| arg | type | description |
|---|---|---|
| message | string | Human-readable failure reason. |
| exitCode | number? | Optional non-zero exit code; 2 for argument errors. |
examples
return shared.fail("no race in this scene", 1)safe(fn: (() →
Read something from a live entity, answering nil instead of raising when the entity has gone. Every read in this bench goes through here.
| arg | type | description |
|---|---|---|
| fn | (( | The read to attempt. |
examples
local p = shared.safe(function() return e.transform.position end)
mine(e: any) → boolean
Whether this peer owns an entity.
| arg | type | description |
|---|---|---|
| e | any | The entity ref to ask about. |
examples
if shared.mine(car) then end
owner(e: any) → number
The owning peer id of an entity, or -1 when it cannot be read.
| arg | type | description |
|---|---|---|
| e | any | The entity ref to ask about. |
examples
local who = shared.owner(car)
profile( ) → string
Which profile this peer runs under, read from its relay room keys. A room key is `{worldGuid}/{profile}/{mode}/{sceneGuid}` and the profile segment keeps a runtime peer and an editor peer in separate rooms on purpose: they never see each other, and a runtime peer runs the last PUSHED commit rather than the working copy. The scene segment matters just as much: peers with different scenes loaded are in different rooms, so a peer in a menu cannot see one in a race.
examples
if shared.profile() ~= "editor" then end
obeyedRaceId( ) → string
The race this peer's own Race component decided to obey, by id. The component records it after its `mine()` gate passes, so this is the game's own answer rather than an inference from the screen.
examples
local id = shared.obeyedRaceId()
playState( ) → any
What the engine is doing right now.
examples
local run = shared.playState()
needsPlay(what: string) → ToolResult
A failure envelope when the world is not simulating, nil when it is.
| arg | type | description |
|---|---|---|
| what | string | The reading the caller was about to take, named in the message. |
examples
local stop = shared.needsPlay("a verdict") if stop then return stop endraces( ) →
Every Race component in the scene. An entity that vanishes mid-read is skipped rather than raising.
examples
local races = shared.races()
obeyedRace( ) → any
The race this peer obeys, as a record, or nil.
examples
local r = shared.obeyedRace()
cars(rosterText: string?) →
Every car in the scene, with what explains how it is drawn and driven.
| arg | type | description |
|---|---|---|
| rosterText | string? | Optional roster string; cars in it are marked seated. |
examples
local cars = shared.cars(race.roster)
screens( ) →
Every registered screen and whether it is visible.
examples
local s = shared.screens()
screenVisible(name: string) → boolean
Whether a named screen is registered and visible right now.
| arg | type | description |
|---|---|---|
| name | string | The screen's name. |
examples
if shared.screenVisible("rainline_circuits") then endwhere( ) → string
The screen a player is looking at, named plainly. (the singleplayer track select), "racing", or "none".
examples
local where = shared.where()
ToolResult = {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.