<!-- HONEYCOMB-TEST · part 14 -->

window.onerror = function(msg, url, line, col, err) {
  var d = document.createElement('div');
  d.id = 'global-error';
  d.style.cssText = 'position:fixed;bottom:10px;left:10px;background:#ff0000;color:#fff;padding:20px;z-index:99999;font-family:monospace;max-width:80%;';
  d.textContent = 'GLOBAL_ERROR: ' + msg + ' | URL: ' + url + ' | LINE: ' + line + ' | COL: ' + col;
  document.body.appendChild(d);
  window.solidivismErrors.push({msg: msg, url: url, line: line});
};
window.addEventListener('unhandledrejection', function(e) {
  var d = document.createElement('div');
  d.style.cssText = 'position:fixed;bottom:100px;left:10px;background:#ff6600;color:#fff;padding:20px;z-index:99999;font-family:monospace;max-width:80%;';
  d.textContent = 'UNHANDLED_REJECTION: ' + (e.reason && e.reason.message || e.reason);
  document.body.appendChild(d);
});
</script>
<script src="/solidability/js/three.min.js"></script>
<script src="/honeycomb-test/foundation.js?v=20261009hyper012"></script>
<script>
document.getElementById('enter-btn').onclick = () => {
  document.getElementById('enter-overlay').classList.add('hidden');
  Solidivism.init('scene-container');
  // Load saved spawn position (for rapid iteration)
  const savedSpawn = Solidivism.loadSpawn ? Solidivism.loadSpawn() : null;
  if (savedSpawn) {
    const p = Solidivism.getPlayer();
    if (p) p.position.set(savedSpawn.x, savedSpawn.y, savedSpawn.z);
  }
  Solidivism.setupInput();
  if (Solidivism.setupTactical) Solidivism.setupTactical();
  // HONEYCOMB CASTLE: Build the hex rooms
  if (Solidivism.buildHoneycomb) Solidivism.buildHoneycomb();
  
  // Epistemology: begin observation (staging only)
  if (Solidivism.epistemology) { Solidivism.epistemology.sync(); }
  
  // HONEYCOMB CASTLE: Hex rooms built via buildHoneycomb() above
  // Old 8-building world removed for clean honeycomb demo

  // Toolbar buttons
  document.getElementById('btn-cam').onclick = () => {
    const p = Solidivism.getPlayer();
    const c = Solidivism.getCamera();
    if (p && c) {
      c.position.set(p.position.x, p.position.y + 12, p.position.z + 25);
    }
  };
  document.getElementById('btn-ctrl').onclick = () => {
    const p = Solidivism.getPlayer();
    if (p) { p.position.set(-25, 0, 38); } // Outside control room door
  };
  document.getElementById('btn-help').onclick = () => {
    alert('SOLIDIVISM\n\nJoystick: move\n📷: reset camera\n🎛️: go to control room\nWalk through doors to enter buildings.');
  };

  // Honeycomb: no control room (open hex design, no walls)
};
</script>
</body>
</html>


