<!-- RUBY-BACKUP · part 190 -->
 return;
  /* clear */
  CITY_TOWERS.forEach(function(t){ try{ scene.remove(t); }catch(e){} });
  CITY_TOWERS = [];
  /* grid of towers — streets between */
  var px = mePos.x, pz = mePos.z;
  var gridSize = 8, spacing = 12; /* expanded — room to breathe */
  for(var gx=-gridSize; gx<=gridSize; gx++){
    for(var gz=-gridSize; gz<=gridSize; gz++){
      if(gx===0 || gz===0) continue; /* streets */
      var x = px + gx*spacing, z = pz + gz*spacing;
      /* check if already persisted */
      var key = 'city-tower-'+x+'-'+z;
      var saved = null;
      try{ saved = localStorage.getItem(key); }catch(e){}
      var height, hue;
      if(saved){
        var d = JSON.parse(saved);
        height = d.h; hue = d.hue;
      }else{
        height = 3 + Math.random()*5;
        hue = 0.55 + Math.random()*0.15;
      }
      var tower = buildTower(x, z, height, hue);
      scene.add(tower);
      CITY_TOWERS.push(tower);
    }
  }
  CITY_BUILT = true;
  codeStatus('city built — '+CITY_TOWERS.length+' permanent towers. Streets await names.');
}
function setStreetNames(names){
  STREET_NAMES = names;
  try{ localStorage.setItem('city-streets', JSON.stringify(names)); }catch(e){}
  codeStatus('streets named: '+names.join(', '));
}
function getStreetNames(){
  try{
    var s = localStorage.getItem('city-streets');
    if(s) STREET_NAMES = JSON.parse(s);
  }catch(e){}
  return STREET_NAMES;
}

/* ANCESTRAL CITY — streets, towers, subdivisions, all intertwined */
var ANCESTRAL_CITY = null;
function buildSubdivisionHouse(x, z, hue){
  var g = new THREE.Group();
  var wallMat = new THREE.MeshStandardMaterial({
    color: new THREE.Color().setHSL(hue, 0.4, 0.55), roughness: 0.8
  });
  var roofMat = new THREE.MeshStandardMaterial({
    color: new THREE.Color().setHSL(hue+0.05, 0.5, 0.3), roughness: 0.7
  });
  /* house body */
  var body = new THREE.Mesh(new THREE.BoxGeometry(1.2, 0.8, 1.0), wallMat);
  body.position.y = 0.4; g.add(body);
  /* roof */
  var roof = new THREE.Mesh(new THREE.ConeGeometry(0.9, 0.5, 4), roofMat);
  roof.position.y = 1.05; roof.rotation.y = Math.PI/4; g.add(roof);
  /* door */
  var door = new THREE.Mesh(new THREE.PlaneGeometry(0.25, 0.5),
    new THREE.MeshStandardMaterial({color: 0x4a3220, roughness: 0.8}));
  door.position.set(0, 0.25, 0.51); g.add(door);
  /* window */
  var win = new THREE.Mesh(new THREE.PlaneGeometry(0.3, 0.25),
    new THREE.MeshStandardMaterial({color: 0xffffcc, emissive: 0xffffcc, emissiveIntensity: 0.6}));
  win.position.set(0.35, 0.5, 0.51); g.add(win);
  /* yard — green */
  var yard = new THREE.Mesh(new THREE.PlaneGeometry(2, 2),
    new THREE.MeshStandardMaterial({color: 0x2a6a2a, roughness: 1}));
  yard.rotation.x = -Math.PI/2; yard.position.y = 0.01; g.add(yard);
  g.position.set(x*0.13, 0, z*0.13);
  return g;
}

/* BUILDINGS WITH PURPOSE — every building has a reason. No cars. */
var BUILDING_PURPOSES = [
  {type: 'shop', label: 'SHOP', color: 0xffaa00, desc: 'Buy and sell'},
  {type: 'business', label: 'BUSINESS', color: 0x0088ff, desc: 'Work and trade'},
  {type: 'fire', label: 'FIRE STATION', color: 0xff2200, desc: 'Protects the city'},
  {type: 'police', label: 'POLICE', color: 0x0044ff, desc: 'Keeps the peace'},
  {type: 'market', label: 'MARKET', color: 0x88ff00, desc: 'Fresh goods'},
  {type: 'school', label: 'SCHOOL', color: 0xffff00, desc: 'Learn and grow'},
  {type: 'clinic', label: 'CLINIC', color: 0xffffff, desc: 'Heal the people'},
  {type: 'library', label: 'LIBRARY', color: 0xaa66ff, desc: 'Knowledge for all'}
];
var PURPOSE_BUILDINGS = [];
function makePurposeLabel(text, colorHex){
  var cv = document.createElement('canvas');
  cv.width = 256; cv.height = 64;
  var ctx = cv.getContext('2d');
  ctx.fillStyle = '#0a0a12';
  ctx.fillRect(0, 0, 256, 64);
  ctx.strokeStyle = '#'+colorHex.toString(16).padStart(6,'0');
  ctx.lineWidth = 3;
  ctx.strokeRect(4, 4, 248, 56);
  ctx.fillStyle = '#ffffff';
  ctx.font = 'bold 28px Arial';
  ctx.textAlign = 'center';
  ctx.textBaseline = 'middle';
  ctx.fillText(text, 128, 34);
  var tex = new THREE.CanvasTexture(cv);
  return tex;
}
function assignBuildingPurpose(buildingGroup, purpose, x, z){
  /* add a visible label so the public can see */
  var labelTex = makePurposeLabel(purpose.label, purpose.color);
  var label = new THREE.Mesh(
    new THREE.PlaneGeometry(1.5, 0.375),
    new THREE.MeshBasicMaterial({map: labelTex, transparent: true})
  );
  /* place at entrance, visible */
  label.position.set(0, 1.2, 0.8);
  buildingGroup.add(label);
  /* color-code the entrance */
  var entrance = new THREE.Mesh(
    new THREE.PlaneGeometry(0.6, 1.0),
    new THREE.MeshStandardMaterial({
      color: purpose.color, emissive: purpose.color, emissiveIntensity: 0.5
    })
  );
  entrance.position.set(0, 0.5, 0.76);
  buildingGroup.add(entrance);
  buildingGroup.userData.purpose = purpose.type;
  buildingGroup.userData.label = purpose.label;
}

/* SPACESHIPS — the future has landing are