color(v: any, default: { number }) → void
| arg | type | description |
|---|
| v | any | |
| default | { number } | |
oneOf(v: any, list: { string }, default: string) → string
| arg | type | description |
|---|
| v | any | |
| list | { string } | |
| default | string | |
partColor(design: any, part: any) → void
The colour a part is drawn in: its own override, else its paint role's colour from the bot palette (nil for "bare": draw the material).
| arg | type | description |
|---|
| design | any | |
| part | any | |
fromV1(v1: any) → any
Build a v2 parts design from a v1 slot design (the old garage's chassis/armor/weapon/drive/front/srimech/paint), so old saves and the presets keep working.
add(t: string, f: any) → void
| arg | type | description |
|---|
| t | string | |
| f | any | |
assignIds(parts: { any }) → void
| arg | type | description |
|---|
| parts | { any } | |
nextId(design: any) → string
The next free part id in a design ("p<n>").
| arg | type | description |
|---|
| design | any | |
normalize(d: any) → any
Repair any design-shaped table (v2, or v1 which is converted) into a complete, in-range v2 design. Never errors; safe on loaded JSON.
addV(a: { number }, b: { number }, s: number?) → void
| arg | type | description |
|---|
| a | { number } | |
| b | { number } | |
| s | number? | |
weaponStats(p: any, pf: number) → any
| arg | type | description |
|---|
| p | any | |
| pf | number | |
derive(design: any) → any
Everything a design adds up to: weight and its breakdown, centre of mass, bounds and ground offset, drive (speed/accel/turn, wheels per side), power budget, every weapon's numbers, per-part info, `legal` with `problems` (blocking) and `warnings`, and 0..1 ratings.
| arg | type | description |
|---|
| design | any | |
issue(level: string, text: string, ids: { string }?) → void
| arg | type | description |
|---|
| level | string | |
| text | string | |
| ids | { string }? | |
presetNames( ) → void
Names of every preset, in garage order.
preset(name: string) → any
A fresh, editable copy of a preset design (nil if no such preset).
| arg | type | description |
|---|
| name | string | |
blank(name: string?) → any
An empty design (no parts) to build from scratch.
| arg | type | description |
|---|
| name | string? | |
starter(name: string?) → any
A minimal legal starter: base plate, receiver, battery and four wheels — a rolling chassis to build on.
| arg | type | description |
|---|
| name | string? | |
jsonEncode(v: any) → string
jsonDecode(s: string) → any
| arg | type | description |
|---|
| s | string | |
saveable(design: any) → any
The saved form of a design (version, name, number, paint, parts — no derived or legacy fields).
| arg | type | description |
|---|
| design | any | |
encode(design: any) → string
Encode a design as JSON text for saving.
| arg | type | description |
|---|
| design | any | |
decode(text: string) → any
Decode saved JSON (v1 or v2) into a normalized v2 design (a starter chassis for anything unreadable).
| arg | type | description |
|---|
| text | string | |
random(seed: number?) → any
A random legal design (for a random AI opponent). `seed` makes it repeatable.
| arg | type | description |
|---|
| seed | number? | |
rnd(lo: number?, hi: number?) → number
| arg | type | description |
|---|
| lo | number? | |
| hi | number? | |
pick(list: { any }) → any return list
| arg | type | description |
|---|
| list | { any } | |