<!-- RUBY-BACKUP · part 280 -->
(g){ buildStoneVisual(g); });
    codeStatus('intaglio linework '+(LINEWORK_ON?'ON':'OFF')); return; }
  if(tl==='wipe'){
    try{ localStorage.removeItem(LSKEY); }catch(e){}
    codeStatus('local stones wiped - refreshing');
    setTimeout(function(){ location.reload(); }, 800);
    return; }
  if(tl.indexOf('solidify')===0){ var sp=tl.split(/\s+/); var sx=parseFloat(sp[1])||0, sy=parseFloat(sp[2])||2, sz=parseFloat(sp[3])||0;
    SOLID_SURFACES.push({x:sx, z:sz, y:sy, r:2});
    codeStatus('solid node: surface solid at '+sx+','+sz); return; }
  function igTex(){ var c=document.createElement('canvas'); c.width=c.height=128; var x=c.getContext('2d');
    x.fillStyle='#1a0f0a'; x.fillRect(0,0,128,128); x.strokeStyle='#d4af37'; x.lineWidth=.5;
    for(var i=0;i<64;i++){ x.beginPath(); x.moveTo(i*2,0); x.lineTo(i*2,128); x.stroke(); x.beginPath(); x.moveTo(0,i*2); x.lineTo(128,i*2); x.stroke(); }
    return new THREE.CanvasTexture(c); }
  var shm = tl.match(/^s(\d{1,5})$/);
  if(shm){ var shn = parseInt(shm[1], 10);
    if(shn>=1 && shn<=99999){
      var sides = 3 + (shn % 18);
      var dim = shn<=20000 ? '2D' : (shn<=40000 ? '3D' : (shn<=60000 ? '4D' : (shn<=80000 ? '5D' : '6D')));
      var geo;
      if(dim==='2D'){ geo = new T.CircleGeometry(1, sides); }
      else if(dim==='3D'){ geo = new T.CylinderGeometry(1, 1, 2, sides); }
      else { geo = new T.OctahedronGeometry(1, Math.min(3, Math.floor(shn/250))); }
      var sx = (typeof mePos!=='undefined') ? mePos.x+2 : 2;
      var sz = (typeof mePos!=='undefined') ? mePos.z : 0;
      var sy = (typeof groundY==='function') ? groundY(sx, sz)+1 : 1;
      var mesh = new T.Mesh(geo, new T.MeshStandardMaterial({map:igTex(), metalness:0.6, roughness:0.4}));
      mesh.position.set(sx, sy, sz);
      if(typeof scene!=='undefined') scene.add(mesh);
      codeStatus(dim+' shape s'+shn+' ('+sides+' sides)');
    } return; }
  if(tl.indexOf('ig')===0){ var igp=tl.split(/\s+/); var igx=parseFloat(igp[1])||0, igz=parseFloat(igp[2])||0;
    var igy=(typeof groundY==='function')?groundY(igx,igz):0;
    if(typeof placeStone==='function'){ var igs=placeStone(igx,igy,igz,'b');
      if(igs&&igs.material){ igs.material.map=igTex(); igs.material.needsUpdate=true; } }
    codeStatus('intaglio placed'); return; }
  if(tl==='saveme'){ var saveData = {x:0, z:0, y:0, spiral:SPIRAL_STEP};
    if(typeof solidLocal!=='undefined' && solidLocal){ saveData.x = solidLocal.x; saveData.z = solidLocal.z; saveData.y = solidLocal.y||0; }
    try{ fetch('/api/ruby/markers/'+WATCH_ID, {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({markers:[{x:9999, y:saveData.spiral, z:9999, save:saveData}]})}); }catch(e){}
    try{ localStorage.setItem('solid-save-v1', JSON.stringify(saveData)); }catch(e){}
    codeStatus('saved'); return; }
  if(tl==='loadme'){ try{ var ld = JSON.parse(localStorage.getItem('solid-save-v1')||'null');
    if(ld && typeof solidLocal!=='undefined'){ solidLocal.x = ld.x; solidLocal.z = ld.z; if(ld.y) solidLocal.y = ld.y; SPIRAL_STEP = ld.spiral||0; codeStatus('loaded'); }
    else codeStatus('no save found');
    }catch(e){ codeStatus('load failed'); } return; }
  if(tl==='erasesave'){ try{ var bk = localStorage.getItem('solid-save-v1');
    if(bk){ var bkd = JSON.parse(bk);
      fetch('/api/ruby/markers/'+WATCH_ID, {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({markers:[{x:9998, y:0, z:9998, backup:bkd, t:Date.now()}]})});
    }
    localStorage.removeItem('solid-save-v1'); codeStatus('save erased, backed up');
    }catch(e){ codeStatus('erase failed'); } return; }
  if(tl==='help eyes'){ codeStatus('EYES: look <x> <z> lookme seeme vfront vback vleft vright vtop vclose vfar vzoomout vreset vmefar vmehalf vmequarter vmeclose vmeyes vtoggle angle <deg> v1-v100'); return; }
  if(tl==='help body'){ codeStatus('BODY: walk body king body circle b1-b100 (colors)'); return; }
  if(tl==='help move'){ codeStatus('MOVE: b1 (home) spiral spiralreset attach sgo <x> <z>'); return; }
  if(tl==='help modes'){ codeStatus('MODES: cammode buildmode vtoggle (views obsolete if built upon)'); return; }
  if(tl==='help map'){ codeStatus('MAP: links linkstone merger cleardots (markers persist)'); return; }
  if(tl==='views'){ codeStatus('views: look <x> <z> · lookme · seeme · vfront · vback · vleft · vright · vtop · vclose · vfar · vzoomout · vreset · vmefar · vmehalf · vmequarter · vmeclose · vmeyes · vtoggle · angle <deg> · v1-v100'); return; }
  var vm = tl.match(/^v(\d{1,3})$/);
  if(vm){ var vn = parseInt(vm[1], 10);
    if(vn>=1 && vn<=100){
      camYaw = (vn*3.6)*Math.PI/180; camPitch = 0.25+((vn%10)*0.11); camDist = 8+((vn%5)*7);
      codeStatus('view v'+vn);
    } return; }
  if(tl==='vfront'){ camYaw = faceYaw; camPitch = 0.35; camDist = 12; codeStatus('front view'); return; }
  if(tl==='vback'){ camYaw = faceYaw+Math.PI; camPitch = 0.35; camDist = 12; codeStatus('back view'); return; }