state( ) → any return G end
toast(text: string, color: string?) → void
| arg | type | description |
|---|
| text | string | |
| color | string? | |
View( ) → any
The editor.view module (nil while the build view is not in this world). Hooks the pointer blocker, the pad focus and view events up once.
call(name: string, ...: any) → any
| arg | type | description |
|---|
| name | string | |
| ... | any | |
viewActive( ) → boolean
True while the 3D build view is up (the bot stands on the build stand, not the turntable).
placing( ) → string
The part type the view is placing (nil when not placing).
setRects(rects: { any }, tall: boolean?) → void
Set the screen rects the panels cover (logical points) and whether the layout is portrait, from the art's layout.
| arg | type | description |
|---|
| rects | { any } | |
| tall | boolean? | |
commitInput(inputId: string) → void
Commit what was typed into input `inputId` when it loses the keyboard (no-op without a draft).
| arg | type | description |
|---|
| inputId | string | |
pointerBlocked(x: number, y: number) → boolean
True when (x, y), in ui.screenSize() points (the space the panel layout is in; editor.view passes pointer px × screenSize.width / viewport width), lies over a garage panel or menu.
| arg | type | description |
|---|
| x | number | |
| y | number | |
slugOf(name: string) → string
| arg | type | description |
|---|
| name | string | |
readText(path: string) → string
| arg | type | description |
|---|
| path | string | |
writeText(path: string, text: string) → boolean
| arg | type | description |
|---|
| path | string | |
| text | string | |
builds( ) → void
Every saved build, sorted by slot: { slot, design, converted }. A v1 file is converted to v2 in place (original backed up).
findBuild(slot: string?) → any
| arg | type | description |
|---|
| slot | string? | |
design( ) → any
The design being built (the session's), or the player's corner design before the garage opens.
stats( ) → any
bots.design derive() of the design being built. While a gizmo/scrub drag runs it answers the last derive from before the drag (derive costs 5-13 ms; the drag's end refreshes it).
saveLast( ) → void
Write last.json: the current build, its slot and the opponent pick.
restore( ) → void
Restore the last-used build and opponent from last.json (once per session; v1 records convert). Safe to call every title.
opponentLabel( ) → string
pickOpponent(kind: string, name: string) → void
| arg | type | description |
|---|
| kind | string | |
| name | string | |
uniqueIds(parts: { any }) → void
one id per mirror pair: the twin follows its partner
| arg | type | description |
|---|
| parts | { any } | |
sizeIndices(def: any, key: string) → void
| arg | type | description |
|---|
| def | any | |
| key | string | |
numSpec(key: string) → any
The spec of numeric field `key` for the current selection: { label, unit, value (display units, nil when mixed), step, min, max, decimals }.
| arg | type | description |
|---|
| key | string | |
applyNum(key: string, value: number) → void
| arg | type | description |
|---|
| key | string | |
| value | number | |
fmtNum(v: number?, decimals: number) → string
| arg | type | description |
|---|
| v | number? | |
| decimals | number | |
numItem(key: string, extra: any?) → any
| arg | type | description |
|---|
| key | string | |
| extra | any? | |
item(act: string, label: string, extra: any?) → any
| arg | type | description |
|---|
| act | string | |
| label | string | |
| extra | any? | |
b(v: number) → number return math
| arg | type | description |
|---|
| v | number | |
sameColor(a: any, b: any) → boolean
| arg | type | description |
|---|
| a | any | |
| b | any | |
typeWeight(t: string) → number
The catalogue default part's weight in lb.
| arg | type | description |
|---|
| t | string | |
partLabel(p: any) → string
paintRows(parts: { any }) → void
| arg | type | description |
|---|
| parts | { any } | |
weaponLabelOf(d: any) → string
rows(zone: string) → void
The rows of a zone ("toolbar"|"palette"|"right"|"stats"|"menu"). Every row has `items`, each with an `act` id.
| arg | type | description |
|---|
| zone | string | |
curOf(zone: string) → void
| arg | type | description |
|---|
| zone | string | |
clampCursor(zone: string, rows: { any }) → void
| arg | type | description |
|---|
| zone | string | |
| rows | { any } | |
cursor( ) → any
The cursor { zone, row, col } (row/col nil-safe), for drawing the focus ring.
move(dx: number, dy: number) → void
Move the cursor dy rows / dx items in the active zone (a numeric field steps its value on left/right).
| arg | type | description |
|---|
| dx | number | |
| dy | number | |
select( ) → void
Up/down between the items of a numeric row: on a vec row, up/down moves rows; tab moves fields. Activate the item under the cursor (Enter / pad A).
cycleZone(d: number) → void
Switch the keyboard/pad zone by `d` (Tab / LB RB). Closes nothing; the menu keeps the cursor while open.
| arg | type | description |
|---|
| d | number | |
setZone(z: string) → void
Put the keyboard/pad cursor in zone `z` ("view" hands the pad's D-pad/shoulders to the 3D view).
| arg | type | description |
|---|
| z | string | |
togglePadView( ) → void
Pad Y: toggle the pad between the 3D view and the panels.
cursorTo(act: string) → void
| arg | type | description |
|---|
| act | string | |
setHooks(h: any) → void
Wire the flow actions screens.match owns: { fight, back, testDrive, focus(id) }.
split(id: string) → void
| arg | type | description |
|---|
| id | string | |
canFight( ) → void
Can the build fight? (false, first problem) when it breaks the rules.
save(asNew: boolean) → string
Save the build: `asNew` always makes a new slot; otherwise overwrite its slot (or make one). Returns the slot.
| arg | type | description |
|---|
| asNew | boolean | |
load(slot: string) → boolean
Load saved slot `slot` into the session (one undo step).
| arg | type | description |
|---|
| slot | string | |
delete(slot: string) → boolean
Delete saved slot `slot`.
| arg | type | description |
|---|
| slot | string | |
defaultSpot(t: string) → void
where a part goes when the palette adds it without the 3D view
| arg | type | description |
|---|
| t | string | |
placeType(t: string, fromNav: boolean?) → void
| arg | type | description |
|---|
| t | string | |
| fromNav | boolean? | |
setPaint(fn: (any) → void
numScrub(key: string, data: any) → void
| arg | type | description |
|---|
| key | string | |
| data | any | |
act(id: string, value: any?, fromNav: boolean?) → void
Run one garage action id (what every widget, key and pad press resolves to). `value` carries a field's value or a drag's data; `fromNav` is true for the keyboard/pad cursor.
| arg | type | description |
|---|
| id | string | |
| value | any? | |
| fromNav | boolean? | |
back( ) → boolean
Esc / pad B in the garage: blur a field → close the menu → cancel a placement → leave the pad view → close the stats sheet → clear the selection → (pressed twice) back to the title.
open(keep: boolean?) → void
Open the garage: the session opens on the player's corner build (kept as it is when `keep` and a session is open, e.g. back from a test drive).
| arg | type | description |
|---|
| keep | boolean? | |
flush( ) → void
Push the session's build to the player's corner now.
close( ) → void
Leave the garage: flush the build to the corner and remember it.
tick(dt: number) → void
Per-frame: push edits to the corner bot while it stands on the turntable (~4/s, never mid-drag) and age the toast.
| arg | type | description |
|---|
| dt | number | |