awacke1 commited on
Commit
e471d04
·
verified ·
1 Parent(s): 9e3fe96

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -8
index.html CHANGED
@@ -34,7 +34,7 @@
34
  let selectedObjectType = window.SELECTED_OBJECT_TYPE || "None";
35
  const plotWidth = window.PLOT_WIDTH || 50.0;
36
  const plotDepth = window.PLOT_DEPTH || 50.0;
37
- const worldState = window.WORLD_STATE || { objects: {}, players: {}, action_history: [] };
38
 
39
  // Materials
40
  const groundMaterial = new THREE.MeshStandardMaterial({ color: 0x55aa55, roughness: 0.9, metalness: 0.1, side: THREE.DoubleSide });
@@ -157,6 +157,8 @@
157
  console.warn(`Invalid player position for ${username}:`, pos);
158
  }
159
  }
 
 
160
  const actionHistory = worldState.action_history || [];
161
  console.log(`Loaded ${actionHistory.length} action history entries`);
162
  }
@@ -613,6 +615,10 @@
613
  function updateSelectedObjectType(newType) {
614
  console.log("JS updateSelectedObjectType received:", newType);
615
  selectedObjectType = newType;
 
 
 
 
616
  }
617
 
618
  function animate() {
@@ -639,10 +645,6 @@
639
  console.log(`Updated player marker for ${username} to`, position);
640
  }
641
  });
642
- }
643
- });
644
-
645
- init();
646
- </script>
647
- </body>
648
- </html>
 
34
  let selectedObjectType = window.SELECTED_OBJECT_TYPE || "None";
35
  const plotWidth = window.PLOT_WIDTH || 50.0;
36
  const plotDepth = window.PLOT_DEPTH || 50.0;
37
+ const worldState = window.WORLD_STATE || { objects: {}, players: {}, action_history: [], selected_object: "None" };
38
 
39
  // Materials
40
  const groundMaterial = new THREE.MeshStandardMaterial({ color: 0x55aa55, roughness: 0.9, metalness: 0.1, side: THREE.DoubleSide });
 
157
  console.warn(`Invalid player position for ${username}:`, pos);
158
  }
159
  }
160
+ selectedObjectType = worldState.selected_object || "None";
161
+ console.log(`Loaded selected tool: ${selectedObjectType}`);
162
  const actionHistory = worldState.action_history || [];
163
  console.log(`Loaded ${actionHistory.length} action history entries`);
164
  }
 
615
  function updateSelectedObjectType(newType) {
616
  console.log("JS updateSelectedObjectType received:", newType);
617
  selectedObjectType = newType;
618
+ window.parent.postMessage({
619
+ type: 'tool_change',
620
+ payload: { username: myUsername, tool: newType }
621
+ }, '*');
622
  }
623
 
624
  function animate() {
 
645
  console.log(`Updated player marker for ${username} to`, position);
646
  }
647
  });
648
+ } else if (data.type === 'tool_change') {
649
+ selectedObjectType = data.payload.tool;
650
+ console.log(`Updated selected tool from message: