drift
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
drift
<!-- 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/v2AURELIAN DRIFT — the shared contract. Every slice of the game codes against THIS table. It holds the run's state, the tuning numbers, the event bus the slices talk over, and the rules that decide win and loss. Require it from anywhere in this world (verified live — use this exact form; a bare "drift" and a "game/drift.module" path both fail): local Drift = require("game.drift") The module loads ONCE; every requirer gets the same table, so a field a component writes is the field another component reads.
on(event: string, fn: ?) → number
| arg | type | description |
|---|---|---|
| event | string | |
| fn | ? |
off(event: string, handle: number) → void
| arg | type | description |
|---|---|---|
| event | string | |
| handle | number |
emit(event: string, ...: ?) → void
| arg | type | description |
|---|---|---|
| event | string | |
| ... | ? |
notice(text: string) → void
| arg | type | description |
|---|---|---|
| text | string |
registerSite(site: ?) → void
SITES — the places the voyage is made of A site record: id string, unique name string, shown on the nav + codex kind "derelict" | "beacon" | "waystation" | "relic" | "gate" position { x, y, z } world position yield { charge = n, salvage = n, relic = "name" | nil } codex { title = string, body = string } | nil scanned bool (managed here) Slice C owns the site CONTENT; anything may read Drift.state.sites.
| arg | type | description |
|---|---|---|
| site | ? |
site(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
siteList( ) → void
dist3(a: ?, b: ?) → number
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? |
nearestSite(pos: ?, includeScanned: boolean?) → void
Nearest UNSCANNED site to a world position, or nil.
| arg | type | description |
|---|---|---|
| pos | ? | |
| includeScanned | boolean? |
setTarget(id: string?) → void
| arg | type | description |
|---|---|---|
| id | string? |
clamp(v: number, lo: number, hi: number) → number
RULES
| arg | type | description |
|---|---|---|
| v | number | |
| lo | number | |
| hi | number |
damage(amount: number, cause: string?) → void
| arg | type | description |
|---|---|---|
| amount | number | |
| cause | string? |
addCharge(amount: number, source: string?) → void
| arg | type | description |
|---|---|---|
| amount | number | |
| source | string? |
burnCharge(amount: number) → boolean
Burn charge over dt. Returns false when the tanks are dry.
| arg | type | description |
|---|---|---|
| amount | number |
addSalvage(amount: number) → void
| arg | type | description |
|---|---|---|
| amount | number |
addCodex(entry: ?) → void
| arg | type | description |
|---|---|---|
| entry | ? |
claimSite(id: string) → void
Claim a site's yield. Slice C calls this when a scan completes; it applies the economy and opens the gate when the relic count is met.
| arg | type | description |
|---|---|---|
| id | string |
win(reason: string?) → void
| arg | type | description |
|---|---|---|
| reason | string? |
lose(reason: string?) → void
| arg | type | description |
|---|---|---|
| reason | string? |
isPlaying( ) → boolean
ship( ) → void
THE SHIP — every slice reaches the player's ship through here The ship IS the local player's avatar (the scene's PlayerPrototype body). Never cache the result; re-resolve each time, the world is multiplayer.
shipPosition( ) → void
setCameraBehavior(ref: ?) → void
Install a camera behavior asset on the local player's camera rig. Slice A calls this if it authors its own camera instead of the built-in chase controller the scene ships with.
| arg | type | description |
|---|---|---|
| ref | ? |
reset( ) → void
RESET — a fresh run 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.