feat: module interaction system with wiring panel

Add a new "module" interaction type where doors/devices define ports
(in/out) and a JS verify function. Players wire their gadget's I/O
to the module's ports via a canvas-rendered wiring panel, then execute
to verify the circuit logic.

- New wiringPanel.js: full wiring UI with keyboard nav, bezier wires,
  mini circuit evaluator, and verify execution
- AND-gate example door in Circuit Lab (tile 9,1)
- Editor support: module type with ports editor and JS verify textarea
- Integrated into gameMode, worldInput, worldRenderer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Luis
2026-03-20 17:59:25 +01:00
parent 6ba3fa457a
commit f9492bff4c
6 changed files with 671 additions and 4 deletions

View File

@@ -48,6 +48,23 @@ const labMap = {
{ x: 1, y: 7, type: 'sign', label: 'Bookshelf', dialog: ["A collection of logic circuit manuals."] },
{ x: 7, y: 7, type: 'sign', label: 'Bookshelf', dialog: ["Advanced boolean algebra textbooks."] },
{ x: 0, y: 1, type: 'terminal', label: 'Terminal', dialog: ["Circuit analysis terminal.","Connect components to solve puzzles."] },
// Module door example: requires AND(A, B) → C
{
x: 9, y: 1, type: 'module',
moduleId: 'lab_and_door',
label: 'AND Gate Door',
ports: [
{ name: 'A', dir: 'out', bits: 1 },
{ name: 'B', dir: 'out', bits: 1 },
{ name: 'C', dir: 'in', bits: 1 }
],
verify: `(test) => {
return test({A:0, B:0}).C === 0
&& test({A:0, B:1}).C === 0
&& test({A:1, B:0}).C === 0
&& test({A:1, B:1}).C === 1;
}`
},
]
};