<!-- SOLID CITY · part 3671 -->
ath.abs(uv[0]) <= 4.35 && Math.abs(uv[1]) <= 5.35) cand.push(H.pilot.roofTop);
    for (var i = 0; i < cand.length; i++) if ((py == null || cand[i] <= py + 1.6) && cand[i] > best) best = cand[i];
  }
  for (var j = 0; j < H.joins.length; j++) {
    var y = triHeight(H.joins[j], x, z);
    if (y != null && (py == null || y <= py + 1.6) && y > best) best = y;
  }
  return best;
}
function radar(rg, blip, flying) {
  if (!H.pilot) return;
  blip(H.housePos.x, H.housePos.z, '#ffd27a', flying ? 3 : 6, flying ? '' : 'PILOT HOUSE');
  for (var k in LINK_MID) blip(LINK_MID[k].x, LINK_MID[k].z, '#ffd27a', 3, '');
}
function update(dt) {
  if (!H.pilot) return;
  var dx = S.p.x - H.housePos.x, dz = S.p.z - H.housePos.z;
  if (!H.saidHouse && dx * dx + dz * dz < 150 * 150) {
    H.saidHouse = true;
    A.help('🏠 THE PILOT HOUSE — the nation\'s first dwelling stands in Ward 2. Its door is glass; walk in, stand on its floor, examine its foundations.', 8);
  }
  for (var k in LINK_MID) {
    if (H.saidJoin[k]) continue;
    var m = LINK_MID[k], jx = S.p.x - m.x, jz = S.p.z - m.z;
    if (jx * jx + jz * jz < 60 * 60) { H.saidJoin[k] = true; A.help('🛤 A join in the nation\'s road — the wards are one network here. This link was measured to three hundredths of a millimetre.', 7); }
  }
}
function wallSolids(house) {
  var mesh = house.mesh, st = house.stand;
  var c = Math.cos(mesh.rotation.y), s = Math.sin(mesh.rotation.y);
  (house.solids.source || []).forEach(function (w) {
    var p = w.geometry.parameters, ly = w.position.y;
    if (p.height < 1 && ly > st.center[1] + 2) return; // the lintel — above the door, no standing law
    var len = Math.max(p.width, p.depth), dep = Math.min(p.width, p.depth);
    var n = Math.max(1, Math.ceil(len / 0.9)), cw = len / n;
    var hx = cw / 2 * Math.abs(c) + dep / 2 * Math.abs(s), hz = cw / 2 * Math.abs(s) + dep / 2 * Math.abs(c);
    for (var i = 0; i < n; i++) {
      var off = -len / 2 + cw * (i + 0.5);
      var lx = w.position.x + (p.width >= p.depth ? off : 0), lz = w.position.z + (p.width >= p.depth ? 0 : off);
      var wx = mesh.position.x + lx * c + lz * s, wz = mesh.position.z - lx * s + lz * c;
      A.solids.push({ x0: wx - hx, x1: wx + hx, z0: wz - hz, z1: wz + hz, y0: ly - p.height / 2 - 0.03, y1: ly + p.height / 2 + 0.03, pilotWall: true });
    }
  });
}
function load() {
  Promise.all([
    import('/city/ward-houses.js?v=20261013a'),
    import('/city/ward-joins.js?v=20261013a'),
    import('/city/wards.js?v=20261013a'),
    fetch('/city/city.js').then(function (r) { return r.text(); })
  ]).then(function (r) {
    var seg = r[3].slice(r[3].indexOf('var SEED'), r[3].indexOf('function mulberry'));
    var gnd = new Function(seg + '; return groundAt;')();
    var isAllowed = r[2].isAllowedSolidCity(gnd);
    // THE PILOT — the searcher's first lawful Ward 2 plot; only it is raised.
    var res = r[0].createWardHouses({ THREE: A.THREE, groundAt: gnd, isAllowed: isAllowed, ward: 2 });
    var pilot = res.accepted[0];
    if (!pilot) throw new Error('no lawful pilot plot');
    A.scene.add(pilot.mesh);
    // the roof takes standing law too — the picture and the account must agree
    var roofTop = null;
    pilot.mesh.children.forEach(function (ch) {
      var p = ch.geometry && ch.geometry.parameters;
      if (p && p.width >= 8.7 && Math.abs(p.height - 0.28) < 0.01) roofTop = ch.position.y + p.height / 2;
    });
    H.pilot = { stand: pilot.stand, roofTop: roofTop }; H.housePos = { x: pilot.plot.cx, z: pilot.plot.cz };
    wallSolids(pilot);
    var meas = r[0].measureWardHouse(pilot, gnd);
    // THE TWO SHORT JOINS — built, and their surfaces connected to movement.
    var joins = r[1].createShortWardJoins({ THREE: A.THREE, groundAt: gnd, isAllowed: isAllowed });
    for (var name in joins) { A.scene.add(joins[name].group); if (joins[name].standSurface && joins[name].standSurface.geometry) H.joins.push(extractTris(joins[name].standSurface.geometry)); }
    if (A.POIS) A.POIS.push({ id: 'pilot-house', name: 'THE PILOT HOUSE — WARD 2', icon: '🏠', x: pilot.plot.cx, z: pilot.plot.cz, blurb: 'The first dwelling of the nation, raised as a pilot from VECTOR\'s housing factories: level floor on descending supports, glass to the street, its plot the searcher\'s first lawful choice in Ward 2. One house, examined — then the nation multiplies.', arrive: 'You stand before the Pilot House.' });
    A.logBuild({ t: Date.now(), site: 'THE PILOT HOUSE', what: 'Pilot house raised in Ward 2 at (' + Math.round(pilot.plot.cx) + ', ' + Math.round(pilot.plot.cz) + '): floor ' + meas.floorY.toFixed(2) + ' m, corner relief ' + meas.cornerRelief.toFixed(2) + ', supports ' + meas.minSupport.toFixed(2) + '-' + meas.maxSupport.toFixed(2) + ' m, stand matches floor. The other three Ward 2 plots wait, lawful but unbuilt, until the King multiplies. Joins W2-W3 and W3-W4 built beside it, measured on actual triangles (deviation ~0.00003 m).' });
  }).catch(funct