feat(epic222): Workshop — Timmy as wizard presence, world state, WS bootstrap (#31)

This commit is contained in:
2026-03-18 22:15:46 -04:00
parent ea4cddc2ad
commit a70898e939
13 changed files with 863 additions and 703 deletions

View File

@@ -12,15 +12,6 @@ import { initPaymentPanel } from './payment.js';
let running = false;
let canvas = null;
/**
* Build (or rebuild) the Three.js world.
*
* @param {boolean} firstInit
* true — first page load: also starts UI and WebSocket
* false — context-restore reinit: skips UI/WS (they survive context loss)
* @param {Object.<string,string>|null} stateSnapshot
* Agent state map captured just before teardown; reapplied after initAgents.
*/
function buildWorld(firstInit, stateSnapshot) {
const { scene, camera, renderer } = initWorld(canvas);
canvas = renderer.domElement;
@@ -28,9 +19,7 @@ function buildWorld(firstInit, stateSnapshot) {
initEffects(scene);
initAgents(scene);
if (stateSnapshot) {
applyAgentStates(stateSnapshot);
}
if (stateSnapshot) applyAgentStates(stateSnapshot);
initInteraction(camera, renderer);
@@ -74,7 +63,6 @@ function buildWorld(firstInit, stateSnapshot) {
}
animate();
return { scene, renderer, ac };
}
@@ -89,7 +77,6 @@ function teardown({ scene, renderer, ac }) {
function main() {
const $overlay = document.getElementById('webgl-recovery-overlay');
let handle = buildWorld(true, null);
canvas.addEventListener('webglcontextlost', event => {