<!-- SAGA-STAGING · part 89 -->
(i, x + noise);
      position.setZ(i, z + noise);
    }
  }
  geometry.computeVertexNormals();
  position.needsUpdate = true;
}
/* Apply to all cone mountains */
setTimeout(function(){
  return; /* DISABLED 2026-10-06 — moved to startup */
  scene.traverse(function(obj){
    if(obj.isMesh && obj.geometry && obj.geometry.type === 'ConeGeometry'){
      obj.geometry.computeBoundingBox();
      var h = obj.geometry.boundingBox.max.y - obj.geometry.boundingBox.min.y;
      if(h > 25){
        carveMountain(obj);
        solidifyTerrain(obj);
      }
    }
  });
  if(typeof say === 'function') say('Mountains carved');
}, 11000);

/* ===== ADVANCED MOUNTAIN CARVING — ridged multifractal + domain warp + erosion. King's order 2026-10-06 ===== */
function advancedCarve(mesh){
  var geo = mesh.geometry;
  var pos = geo.attributes.position;
  /* Simplex-like noise approximation */
  function noise2(x, z){
    return Math.sin(x * 12.9898 + z * 78.233) * 43758.5453 % 1;
  }
  function smoothNoise(x, z){
    var xi = Math.floor(x), zi = Math.floor(z);
    var xf = x - xi, zf = z - zi;
    var u = xf*xf*(3-2*xf), v = zf*zf*(3-2*zf);
    var a = noise2(xi, zi), b = noise2(xi+1, zi);
    var cc = noise2(xi, zi+1), d = noise2(xi+1, zi+1);
    return a + (b-a)*u + (cc-a)*v + (a-b-cc+d)*u*v;
  }
  /* Ridged multifractal: 1 - |noise|, creates sharp ridges */
  function ridged(x, z, octaves){
    var sum = 0, amp = 0.5, freq = 1;
    for(var o = 0; o < octaves; o++){
      var n = smoothNoise(x * freq, z * freq);
      n = 1 - Math.abs(n * 2 - 1); /* Ridge */
      n = n * n; /* Sharpen */
      sum += n * amp;
      amp *= 0.5; freq *= 2.1;
    }
    return sum;
  }
  for(var i = 0; i < pos.count; i++){
    var x = pos.getX(i), y = pos.getY(i), z = pos.getZ(i);
    /* Domain warping: perturb coordinates with noise to break grid */
    var wx = x + ridged(x * 0.02, z * 0.02, 3) * 20;
    var wz = z + ridged(x * 0.02 + 100, z * 0.02, 3) * 20;
    /* Ridged multifractal for mountain detail */
    var r = ridged(wx * 0.05, wz * 0.05, 4);
    /* Height factor: more displacement mid-slope */
    geo.computeBoundingBox();
    var h = geo.boundingBox.max.y - geo.boundingBox.min.y;
    var hNorm = (y - geo.boundingBox.min.y) / (h || 1);
    var hFactor = Math.sin(hNorm * Math.PI); /* 0 at base/top, 1 in middle */
    var disp = (r - 0.5) * 15 * hFactor;
    /* Radial displacement */
    var len = Math.sqrt(x*x + z*z);
    if(len > 0.01){
      var s = 1 + disp / len;
      pos.setX(i, x * s);
      pos.setZ(i, z * s);
    }
    /* Vertical: carve valleys where ridged noise is low */
    var valley = (0.5 - r) * 8 * hFactor;
    pos.setY(i, y - Math.max(0, valley));
  }
  geo.computeVertexNormals();
  pos.needsUpdate = true;
}
/* Apply advanced carve to all mountains */
setTimeout(function(){
  return; /* DISABLED 2026-10-06 — broke valleys */
  var count = 0;
  scene.traverse(function(obj){
    if(obj.isMesh && obj.geometry && obj.geometry.type === 'ConeGeometry'){
      obj.geometry.computeBoundingBox();
      var h = obj.geometry.boundingBox.max.y - obj.geometry.boundingBox.min.y;
      if(h > 25){
        advancedCarve(obj);
        count++;
      }
    }
  });
  if(typeof say === 'function') say('Advanced carve: ' + count + ' mountains');
}, 12000);

/* ===== RAISE CITY UPON MOUNTAINS — King's order 2026-10-06 ===== */
setTimeout(function raiseCity(){
  return; /* DISABLED 2026-10-06 — valleys first */
  var cityX = 100, cityZ = -100, cityR = 300;
  var liftHeight = 120; /* Raise to mountain level */
  var raised = 0;
  scene.traverse(function(obj){
    if(obj.isMesh){
      var dx = obj.position.x - cityX;
      var dz = obj.position.z - cityZ;
      var dist = Math.sqrt(dx*dx + dz*dz);
      /* Only raise city builds, not mountains or terrain */
      if(dist < cityR && obj.position.y < 50){
        /* Check if it's a building (not a mountain) */
        var isMountain = obj.userData.isSolidTerrain;
        if(!isMountain){
          obj.position.y += liftHeight;
          raised++;
        }
      }
    }
  });
  if(typeof say === 'function') say('City raised: ' + raised + ' structures');
}, 13000);

/* ===== NEW CHILDREN — King's order 2026-10-06 ===== */

/* ===== FRESH MOUNTAINS — Full map, random, no hindering. King's order 2026-10-06 ===== */
setTimeout(function freshMountains(){
  return; /* DISABLED — v157 restored */
  var seed = 777;
  function rnd(){ seed = (seed * 16807) % 2147483647; return (seed - 1) / 2147483646; }
  var greenMat = new THREE.MeshStandardMaterial({color: 0x3a7a3a, roughness: 0.9});
  /* Full map: -6000 to 6000 */
  for(var i = 0; i < 60; i++){
    var px = (rnd() * 12000) - 6000;
    var pz = (rnd() * 12000) - 6000;
    var pr = 80 + rnd() * 120;
    var ph = 120 + rnd() * 180;
    var sides = 7 + Math.floor(rnd() * 6);
    var geo = new THREE.ConeGeometry(pr, ph, sides, 8);
    /* Carve */
    var pp = geo.attributes.position;
    for(var vi = 0; vi < pp.count; vi