BATTLEBOX: Robot Combat Arena
README.md
screens.garage
The ROBOT MAKER's panel state and every action it takes (BUILD YOUR BOT), independent of drawing.
- The bot being built lives in
editor.session. Every panel edit goes through the session (undo/redo, mirror twins, snapping, normalizing), and the module listens withSession.onto redraw. Multi-part edits are wrapped inbeginDrag/endDragso they are one undo step. - The 3D build view (
editor.view) is driven from here: palette cards callView.beginPlace(type), the toolbarsetTool/setView/focus, issue clicksSession.select+View.focus.View()hands the viewpointerBlocked(x, y)(the panel rects the art reports, in window points) and the pad focus (setPadEnabled, pad Y). While the view is not up, the palette adds parts at a default spot and edits are pushed to the player's corner (~4/s) so the turntable bot shows them. - Zones and rows.
rows(zone)describes the toolbar, palette, right panel (PART inspector / BOT / OPPONENT), stats issues and the BUILDS menu as rows of items with action ids;act(id, value)runs them (taps, keys and pad all resolve to the same ids). The cursor (move,select,cycleZone,setZone,togglePadView,back) walks the same rows. - Inspector: typed numeric fields for position (cm), rotation (°), size (by the type's
sizeRule: diameter for round parts), everyparamsentry (number / enum / bool / text), material picker with blurbs, paint override (role, custom colour, finish), mirror link (MIRROR / UNLINK), DUPLICATE / DELETE. Several parts selected: MOVE BY, and the size, material, params and paint they share. Fields take a typed value (Enter or leaving the field commits), ± steps (the snap step) and drag-scrub on the label. - Saves (this machine only, written straight through at play):
/source/local/garage/builds/<slot>.jsonas v2Design.encodeJSON,last.json(build, slot, opponent) restored once per session byrestore(). A v1 save inbuilds/converts to v2 in place when first listed (original kept in/source/local/garage/v1-backup/); a v1last.jsonconverts on restore. open(keep)/close()/flush()/tick(dt)are called byscreens.match;setHooks{ fight, back, testDrive }wires the flow. FIGHT is refused (with the first problem) unlessstats.legal.
Drawn by screens.garageArt, routed by screens.BroadcastScreens (taps) and screens.MatchDirector (keys/pad via screens.garageNav).