gauges
The gauge cluster pipeline and its module API. `show(style, car?, opts?)` puts a cluster on screen without a component (it follows the local player's car when `car` is nil), `setStyle`, `setCar`, `hide`, `state`, `styles`. `GaugeCluster` and `GaugeGallery` build on its parts: `vi…
gaugeClusters.gauges
The gauge cluster pipeline and its module API. show(style, car?, opts?)
puts a cluster on screen without a component (it follows the local player's
car when car is nil), setStyle, setCar, hide, state, styles.
GaugeCluster and GaugeGallery build on its parts: view turns a reader
Reading into what a style draws (smoothed needles, units, dial ranges, the
redline fraction, blink and gear-pop timers), scaleFor fits a style to the
screen and safe area (phones get nearly the full width), place wraps a
cluster in a full-screen, safe-area root at an anchor, and frame does all
of it for one car.
local Gauges = require("gaugeClusters.gauges")
Gauges.show("hud", nil, { units = "mph" })
Gauges.setStyle("retro80s")
Gauges.hide()
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2gaugeClusters.gauges — put a gauge cluster on screen, in any of ten styles. local Gauges = require("gaugeClusters.gauges") Gauges.show("rally") -- follows the local player's car Gauges.show("analog", carEntity, { units = "mph" }) Gauges.setStyle("scifi") -- switch the look live Gauges.hide() Gauges.styles() --> { "analog", "digital", ... } The `GaugeCluster` component is the same thing as a component (one cluster per component, owned by it). The pieces it is made of are public too: `Gauges.view` (reading -> what a style draws), `Gauges.scaleFor`, `Gauges.place` (a cluster node -> a full-screen root at an anchor) and `require("gaugeClusters.styles")` for the looks themselves.
styles( ) → void
Every style id, in gallery order.
has(id: string) → boolean
True when `id` names a style.
| arg | type | description |
|---|---|---|
| id | string |
damp(cur: number, goal: number, tau: number, dt: number) → number
| arg | type | description |
|---|---|---|
| cur | number | |
| goal | number | |
| tau | number | |
| dt | number |
view(r: any, st: any, opts: any?, dt: number) → any
Turn a reader.Reading into what a style draws, smoothing needles in `st` (keep one table per cluster). opts: { units = "kmh"|"mph", maxSpeed = number (0 = the style's), style = id }. Answers the view table.
| arg | type | description |
|---|---|---|
| r | any | |
| st | any | |
| opts | any? | |
| dt | number |
scaleFor(styleId: string, size: number?) → number
The scale a style is drawn at on this screen: fits the width and height budget a HUD may use, times `size` (default 1). Phones get a larger share of the width than desktops.
| arg | type | description |
|---|---|---|
| styleId | string | |
| size | number? |
anchorOf(styleId: string, anchor: string?) → string
The style's own placement for anchor "auto".
| arg | type | description |
|---|---|---|
| styleId | string | |
| anchor | string? |
place(node: any, anchor: string, idPrefix: string, opts: any?) → any
Wrap a cluster node in a full-screen, input-transparent root that places it at `anchor` inside the safe area, `margin` points in from the edges (offsetX/offsetY nudge it).
| arg | type | description |
|---|---|---|
| node | any | |
| anchor | string | |
| idPrefix | string | |
| opts | any? |
frame(carId: string?, st: any, opts: any, dt: number, idPrefix: string) → any
Build the full-screen tree for one cluster from a car id (nil = nothing to show yet: zeros). `st` is the cluster's state table (keep it between frames). opts: { style, units, maxSpeed, size, anchor, offsetX, offsetY }.
| arg | type | description |
|---|---|---|
| carId | string? | |
| st | any | |
| opts | any | |
| dt | number | |
| idPrefix | string |
tick( ) → void
show(style: string?, car: any?, opts: any?) → string
Show the module's own cluster in `style`, reading `car` (an entity or id; nil follows the local player's car). opts: { units = "kmh"|"mph", maxSpeed, size, anchor, offsetX, offsetY }. Calling it again restyles the same cluster. Answers the style shown.
| arg | type | description |
|---|---|---|
| style | string? | |
| car | any? | |
| opts | any? |
setStyle(style: string) → boolean
Switch the shown cluster's look (one word). False for an unknown style.
| arg | type | description |
|---|---|---|
| style | string |
setCar(car: any?) → void
Point the shown cluster at another car (nil = follow the local player's car again).
| arg | type | description |
|---|---|---|
| car | any? |
hide( ) → void
Take the module's cluster off screen and stop its loop.
state( ) → any
What the module's cluster is doing: { visible, style, car }.
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.