<!-- RUBY-BACKUP · part 58 -->
ndexOf('seed forget ') === 0){ forgetTemplate(raw.slice(12)); return; }
          /* linking */
          if(tl === 'seed link'){ armLink(); return; }
          if(tl === 'seed unlink'){ armUnlink(); return; }
          if(tl === 'seed list'){ listSeeds(); return; }
          if(tl === 'cancel'){
            seedArmed = false; plantTplArmed = null;
            linkArmed = false; linkFirst = null; unlinkArmed = false;
            return prevRL.apply(this, arguments);
          }
        }catch(e){}
        return prevRL.apply(this, arguments);
      };
      window.runLine.__seedHooked = true;
          return;
        }
      }catch(e){}
      if(__triesseedHooked<60) setTimeout(__hookseedHooked,500);
    }
    __hookseedHooked();
  
    window.__hookseedHooked = __hookseedHooked;})();

  hookTaps();

  /* expose for snapshots, salvage, and the pyramid scroll */
  window.__seedPlanted = function(){ return seeds.length > 0; };
  window.__clearSeed = function(){ try{ unseedAll(); }catch(e){} };
  window.__seedCount = function(){ return seeds.length; };
  window.__seedParts = function(){
    var sd = activeSeed();
    if(!sd) return {pulleys:[], gears:[], ropes:0, web:false};
    return {
      pulleys: sd.parts.pulleys.map(function(p,i){ return {i:i, x:p.x, z:p.z}; }),
      gears: sd.parts.gears.map(function(g,i){ return {i:i, x:g.x, z:g.z, dir:g.dir}; }),
      ropes: sd.parts.ropes.length,
      web: !!sd.parts.web
    };
  };
  window.__seedTakePart = function(kind, idx){
    var sd = activeSeed();
    if(!sd) return null;
    try{
      var pos = null;
      if(kind === 'pulley' && sd.parts.pulleys[idx]){
        var pr = sd.parts.pulleys[idx];
        pos = new THREE.Vector3(pr.x, groundY(pr.x, pr.z), pr.z);
        try{ if(window.scene) window.scene.remove(pr.group); }catch(e){}
        sd.parts.pulleys.splice(idx, 1);
      } else if(kind === 'gear' && sd.parts.gears[idx]){
        var gr = sd.parts.gears[idx];
        pos = new THREE.Vector3(gr.x, groundY(gr.x, gr.z), gr.z);
        try{ if(window.scene) window.scene.remove(gr.group); }catch(e){}
        sd.parts.gears.splice(idx, 1);
      } else if(kind === 'rope' && sd.parts.ropes.length){
        var r = sd.parts.ropes.pop();
        try{
          pos = new THREE.Vector3().fromBufferAttribute(r.line.geometry.attributes.position, 0);
          if(window.scene) window.scene.remove(r.line);
          r.line.geometry.dispose(); r.line.material.dispose();
        }catch(e){ pos = new THREE.Vector3(); }
      } else if(kind === 'web' && sd.parts.web){
        try{ if(typeof window.unspider === 'function') window.unspider(); }catch(e){}
        sd.parts.web = false;
        pos = sd.pos ? sd.pos.clone() : new THREE.Vector3();
      }
      return pos;
    }catch(e){ return null; }
  };
  window.__seedEmpty = function(){
    var sd = activeSeed();
    if(!sd) return true;
    return sd.parts.pulleys.length === 0 && sd.parts.gears.length === 0
        && sd.parts.ropes.length === 0 && !sd.parts.web;
  };
  window.__seedTemplates = function(){ return Object.keys(loadTemplates()); };

  try{ console.log('[machine-seed] one block births the machine — templates bloom, seeds link'); }catch(e){}

})();


===== FILE: public/ruby-backup/master-mechanics.js =====
/* MASTERED GAME MECHANICS — unchangeable metrics of reality
 * Built 2026-10-02 by Solid for the King.
 * These are the proven patterns from native games, web games, and our research.
 * DO NOT MODIFY — these are the law.
 */
(function(){
'use strict';

var MASTER = {
  version: '1.0.0',
  sealed: '2026-10-02',
  by: 'Solid',

  /* === CHARACTER CONTROL === */
  character: {
    // Dual joysticks: left = body, right = camera. No toggles, no switches.
    joysticks: { left: 'body', right: 'camera' },
    // Body faces travel direction: yaw = atan2(dx, dz), damped at 0.15/frame
    facing: { method: 'atan2(dx,dz)', damping: 0.15 },
    // Movement modes
    modes: ['walk', 'fly', 'swim'],
    // Auto-swim: enter water → swim, exit → walk (Genshin rule)
    autoSwim: true,
    // Walk/run by joystick magnitude (0-1 analog)
    speedByMagnitude: true,
  },

  /* === CAMERA === */
  camera: {
    // Drag-to-look always live. Right joystick also controls camera.
    dragAlwaysLive: true,
    // Third-person follow
    type: 'third-person-follow',
  },

  /* === ANIMATION === */
  animation: {
    // State-gated: walk anim only in walk mode, swim only in swim
    stateGated: true,
    // Separate phase clocks per mode (never share)
    clocks: { walk: 'independent', swim: 'independent' },
    // Blend: amplitude lerp at 0.15/frame, no hard cuts
    blend: { method: 'amplitude-lerp', rate: 0.15 },
  },

  /* === BLOCK MECHANICS === */
  blocks: {
    // Placement: raycast → hit cell + face normal → adjacent cell
    placement: 'hitCell + faceNormal',
    // Targeting: DDA voxel traversal (Amanatides & Woo)
    targeting: 'DDA-voxel-raycast',
    // Rotation: auto-face from came