@adatechnology/game-weapons-three 0.18.1 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -119,6 +119,13 @@ var GameWeaponsThree = (() => {
119
119
  const scaled2 = 0.067 * Math.sqrt(1 + (z / 0.23) ** 4) / (z * z * Math.cbrt(1 + (z / 1.55) ** 3));
120
120
  return scaled2 * w3 * 100;
121
121
  }
122
+ var ATMOSPHERE = 101325;
123
+ function sideOnOverpressure(tnt, distance3) {
124
+ if (!(tnt > 0)) return 0;
125
+ const z = Math.max(distance3, NEAREST) / Math.cbrt(tnt);
126
+ const ratio = 808 * (1 + (z / 4.5) ** 2) / (Math.sqrt(1 + (z / 0.048) ** 2) * Math.sqrt(1 + (z / 0.32) ** 2) * Math.sqrt(1 + (z / 1.35) ** 2));
127
+ return ratio * ATMOSPHERE;
128
+ }
122
129
  function bodyImpulse(tnt, distance3) {
123
130
  if (!(tnt > 0)) return 0;
124
131
  const z = Math.max(distance3, NEAREST) / Math.cbrt(tnt);
@@ -4462,13 +4469,18 @@ var GameWeaponsThree = (() => {
4462
4469
  tnt: 0.045,
4463
4470
  destructionLevel: 2,
4464
4471
  noise: 450,
4472
+ armRange: [
4473
+ 14,
4474
+ 27
4475
+ ],
4465
4476
  triggers: [
4466
4477
  "impact"
4467
4478
  ],
4468
4479
  sources: [
4469
4480
  "arsenal",
4470
4481
  "lab",
4471
- "gallery"
4482
+ "gallery",
4483
+ "reference"
4472
4484
  ]
4473
4485
  },
4474
4486
  {
@@ -4687,11 +4699,16 @@ var GameWeaponsThree = (() => {
4687
4699
  tnt: 0.045,
4688
4700
  destructionLevel: 2,
4689
4701
  noise: 450,
4702
+ armRange: [
4703
+ 10,
4704
+ 40
4705
+ ],
4690
4706
  triggers: [
4691
4707
  "impact"
4692
4708
  ],
4693
4709
  sources: [
4694
4710
  "lab",
4711
+ "reference",
4695
4712
  "derived"
4696
4713
  ]
4697
4714
  },
@@ -14605,6 +14622,7 @@ var GameWeaponsThree = (() => {
14605
14622
  const problems = [];
14606
14623
  const [low, high] = explosive.fuseRange ?? [1, 1];
14607
14624
  if (!(low > 0 && high >= low)) problems.push(`explosive "${explosive.id}" has a fuse range of ${low} to ${high} s`);
14625
+ if (explosive.armRange && !(explosive.armRange[0] > 0 && explosive.armRange[1] >= explosive.armRange[0])) problems.push(`explosive "${explosive.id}" arms between ${explosive.armRange[0]} and ${explosive.armRange[1]} m`);
14608
14626
  if (explosive.fuseLength !== void 0 && !(explosive.fuseLength > 0)) problems.push(`explosive "${explosive.id}" has a fuse length of ${explosive.fuseLength} m`);
14609
14627
  if (explosive.burnRate !== void 0 && !(explosive.burnRate > 0)) problems.push(`explosive "${explosive.id}" has a burn rate of ${explosive.burnRate} s/m`);
14610
14628
  if (explosive.burnTolerance !== void 0 && !(explosive.burnTolerance >= 0 && explosive.burnTolerance < 1)) problems.push(`explosive "${explosive.id}" has a burn tolerance of ${explosive.burnTolerance}`);
@@ -15220,7 +15238,12 @@ var GameWeaponsThree = (() => {
15220
15238
  energy: explosive.energy,
15221
15239
  injuryRadius: explosive.injuryRadius
15222
15240
  });
15223
- var launcherUses = (action, explosive, origin, direction) => {
15241
+ var sampleArmDistance = (action, explosive, random) => {
15242
+ const range3 = explosive?.armRange;
15243
+ if (!range3) return action.minArmDistance;
15244
+ return range3[0] + (range3[1] - range3[0]) * random();
15245
+ };
15246
+ var launcherUses = ({ action, explosive, origin, direction, armDistance }) => {
15224
15247
  const velocity = [direction[0] * action.speed, direction[1] * action.speed, direction[2] * action.speed];
15225
15248
  const projectile = {
15226
15249
  kind: "throw",
@@ -15231,7 +15254,7 @@ var GameWeaponsThree = (() => {
15231
15254
  origin,
15232
15255
  explosive: action.projectile,
15233
15256
  trigger: "impact",
15234
- armDistance: action.minArmDistance,
15257
+ armDistance: armDistance ?? action.minArmDistance,
15235
15258
  ...explosive ? { injuryRadius: explosive.injuryRadius } : {}
15236
15259
  };
15237
15260
  if (action.backblast <= 0) return [projectile];
@@ -16408,7 +16431,7 @@ var GameWeaponsThree = (() => {
16408
16431
  this._ammo -= 1;
16409
16432
  this._heat = Math.min(this.rules.heat.cap, this._heat + heatPerRound({ action: a, caliber: null, energy: 0, barrelMass: this.barrelMass, rules: this.rules.heat }));
16410
16433
  this.emit({ type: "shot", shots: 0, rounds: 1, mode: this.mode, at: t });
16411
- return result("ok", { uses: launcherUses(a, this.explosive, origin, dir), recoil: [a.recoil[0], a.recoil[1]], noise: a.noise ?? 0, rounds: 1, roundTimes: [t - start] });
16434
+ return result("ok", { uses: launcherUses({ action: a, explosive: this.explosive, origin, direction: dir, armDistance: sampleArmDistance(a, this.explosive, this.fuseRng) }), recoil: [a.recoil[0], a.recoil[1]], noise: a.noise ?? 0, rounds: 1, roundTimes: [t - start] });
16412
16435
  }
16413
16436
  fireMelee(a, origin, dir, start, end3) {
16414
16437
  const t0 = Math.max(start, this.readyAt);
@@ -22382,7 +22405,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22382
22405
  for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
22383
22406
  return sum2;
22384
22407
  };
22385
- var COVER = 0.03;
22408
+ var REBAR_COVER = 0.03;
22409
+ var COVER = REBAR_COVER;
22386
22410
  var MAX_BARS_PER_DIRECTION = 24;
22387
22411
  var MAX_MEMBER_BARS_PER_SIDE = 6;
22388
22412
  var STEEL_DENSITY = 7850;
@@ -24609,9 +24633,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24609
24633
  var BREACH_AREA = 0.25;
24610
24634
  var BREACH_BLAST_REACH = 0.12;
24611
24635
  var MEMBER_CUT_REACH = 0.5;
24636
+ var FAR_MEMBER_HP_FLOOR = 0.25;
24612
24637
  var BLAST_REFERENCE_RESISTANCE = 200 * 1900 * 0.13;
24613
24638
  var BLAST_EDGE_RAGGED = 0.3;
24614
24639
  var BLAST_EDGE_LOOSE = 1.35;
24640
+ var PANEL_PRESSURE = 7e4;
24641
+ var PANEL_IMPULSE = 150;
24642
+ var PANEL_PI = 6e6;
24643
+ var PANEL_POINTS = [[0, 0], [-0.3, 0], [0.3, 0], [0, -0.3], [0, 0.3]];
24644
+ var PANEL_POINTS_LOADED = 4;
24645
+ var MEMBER_BAND = 0.1;
24646
+ var MEMBER_CRATER_CALIBRES = 3.4;
24647
+ var MEMBER_BARED_MAX = 24;
24648
+ var MEMBER_CUT_LOSS = 0.9;
24615
24649
  var BLAST_EDGE_WEAR = 0.6;
24616
24650
  var RESIDUAL_CAPACITY = 0.15;
24617
24651
  var SEVER_BAND = 0.1;
@@ -26018,6 +26052,57 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26018
26052
  const lp = toLocal(p.pos, p.q, objectPoint);
26019
26053
  return cells.some((c) => Math.abs(lp[u] - c.center[u]) <= c.size[u] / 2 && Math.abs(lp[v] - c.center[v]) <= c.size[v] / 2);
26020
26054
  };
26055
+ const wearMember = (o, p, entry2, d, E, caliber, penMm, src) => {
26056
+ var _a, _b;
26057
+ if (!p.spec.reinforcement || !p.spec.units || !isMember(p.dims) || p.st.stripped || isLost(p) || p.spec.shape.kind !== "box") return false;
26058
+ const along = p.dims.indexOf(Math.max(...p.dims));
26059
+ const lp = toLocal(p.pos, p.q, objLocal(o, entry2));
26060
+ const ld = rotateVec(quat.conjugate(p.q), objLocalDir(o, d));
26061
+ let depth = Infinity;
26062
+ for (let a = 0; a < 3; a++) if (a !== along && Math.abs(ld[a]) > 1e-3) depth = Math.min(depth, p.dims[a] / Math.abs(ld[a]));
26063
+ if (!Number.isFinite(depth)) return true;
26064
+ const into = (penMm ?? E / Math.max(p.mat.penetration, 1e-6)) / 1e3;
26065
+ const h = Math.min(into, depth);
26066
+ const r = Math.min(MEMBER_CRATER_CALIBRES * caliber / 1e3, h);
26067
+ const volume = Math.PI / 3 * r * r * h;
26068
+ const section = p.dims.reduce((product2, size, a) => a === along ? product2 : product2 * size, 1);
26069
+ const bands = Math.max(1, Math.round(p.dims[along] / MEMBER_BAND));
26070
+ const band = clamp2(Math.floor((lp[along] + p.dims[along] / 2) / p.dims[along] * bands), 0, bands - 1);
26071
+ const height = p.dims[along] / bands;
26072
+ const worn = (_a = p.rt).bands ?? (_a.bands = {});
26073
+ const before = worn[band] ?? 0;
26074
+ const after2 = Math.min(1, before + volume / (section * height));
26075
+ worn[band] = after2;
26076
+ markDamaged(p);
26077
+ const bandCenter = -p.dims[along] / 2 + (band + 0.5) * height;
26078
+ if (h > REBAR_COVER && after2 < MEMBER_CUT_LOSS) {
26079
+ const bared = (_b = p.rt).bared ?? (_b.bared = []);
26080
+ const center = [lp[0], lp[1], lp[2]];
26081
+ const size = [p.dims[0], p.dims[1], p.dims[2]];
26082
+ for (let a = 0; a < 3; a++) if (Math.abs(ld[a]) < 0.5) size[a] = 2 * r;
26083
+ if (bared.length < MEMBER_BARED_MAX && !bared.some((box5) => box5.center.every((x, a) => Math.abs(x - center[a]) < box5.size[a] / 4))) {
26084
+ bared.push({ center, size });
26085
+ exposeRebar(o, p, src);
26086
+ }
26087
+ }
26088
+ if (before >= MEMBER_CUT_LOSS || after2 < MEMBER_CUT_LOSS) return true;
26089
+ const axisUp = rotateVec(p.q, [0, 0, 0].map((_, k) => k === along ? 1 : 0));
26090
+ const standing = Math.abs(axisUp[1]) > 0.7;
26091
+ const upward = axisUp[1] >= 0 ? 1 : -1;
26092
+ const grid = gridOf(p);
26093
+ const gone = p.rt.chips ?? {};
26094
+ const out = [];
26095
+ for (let i = 0; i < grid.length; i++) {
26096
+ if (gone[i] === -1) continue;
26097
+ const at4 = grid[i].center[along];
26098
+ const inBand = Math.abs(at4 - bandCenter) <= height / 2 + 1e-6;
26099
+ const above2 = standing && (at4 - bandCenter) * upward > height / 2;
26100
+ if (inBand || above2) out.push(i);
26101
+ }
26102
+ if (out.length > 0) knockOutUnits(o, p, entry2, E, out, src);
26103
+ giveAtCut(o, p, src);
26104
+ return true;
26105
+ };
26021
26106
  const chipUnits = (o, p, kind, wp, hitEnergy, dir, radius, src) => {
26022
26107
  var _a, _b, _c;
26023
26108
  if (!p.spec.units || !p.staged || chipEnergy <= 0 || p.st.stripped || isLost(p) || (p.st.stage ?? 0) >= 2) return;
@@ -26159,6 +26244,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26159
26244
  else {
26160
26245
  bars = [];
26161
26246
  for (const cell of p.st.chipped ?? []) bars.push(...clipBarsToBox(all, u, v, cell.center, cell.size));
26247
+ for (const box5 of p.rt.bared ?? []) bars.push(...clipBarsToBox(all, u, v, box5.center, box5.size));
26162
26248
  const op = p.st.opening;
26163
26249
  if (op) {
26164
26250
  const lc = toLocal(p.pos, p.q, op.center);
@@ -26205,7 +26291,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26205
26291
  return BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3) * clamp2(Math.cbrt(BLAST_REFERENCE_RESISTANCE / resistance), 0.3, 2);
26206
26292
  };
26207
26293
  const blastUnits = (o, p, wp, energy, dist2, src) => {
26208
- var _a, _b;
26294
+ var _a;
26209
26295
  if (!p.staged || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
26210
26296
  const reach = blastReachOf(p, energy);
26211
26297
  if (dist2 >= reach) return false;
@@ -26235,6 +26321,62 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26235
26321
  }
26236
26322
  }
26237
26323
  if (out.length === 0) return false;
26324
+ return knockOutUnits(o, p, wp, energy, out, src);
26325
+ };
26326
+ const blastPanel = (o, p, point, energy, src) => {
26327
+ var _a;
26328
+ if (!p.staged || p.st.stripped || isLost(p) || !p.spec.units || p.spec.units.mortar === p.spec.material || p.spec.reinforcement) return false;
26329
+ const [u, v] = planeAxes(p.thin);
26330
+ const lp = toLocal(p.pos, p.q, objLocal(o, point));
26331
+ const half = p.dims[u] / 2;
26332
+ const posts = [];
26333
+ for (const m of o.parts) {
26334
+ if (m === p || !m.spec.reinforcement || isLost(m) || m.spec.shape.kind !== "box") continue;
26335
+ const mp = toLocal(p.pos, p.q, m.pos);
26336
+ if (Math.abs(mp[p.thin]) > p.dims[p.thin] + 0.15 || Math.abs(mp[u]) > half + 0.15 || m.dims[v] < p.dims[v] * 0.5) continue;
26337
+ posts.push(mp[u]);
26338
+ }
26339
+ let from = -half, to = half;
26340
+ for (const x of posts) {
26341
+ if (x <= lp[u] && x > from) from = x;
26342
+ if (x >= lp[u] && x < to) to = x;
26343
+ }
26344
+ if (to - from < 0.2) return false;
26345
+ const tnt = energy * DEFAULT_BLAST_IMPULSE.tntPerJoule;
26346
+ const centre = objLocal(o, point);
26347
+ const span = to - from, height = p.dims[v];
26348
+ let loaded = 0;
26349
+ for (const [fu, fv] of PANEL_POINTS) {
26350
+ const at4 = [0, 0, 0];
26351
+ at4[u] = (from + to) / 2 + fu * span;
26352
+ at4[v] = fv * height;
26353
+ at4[p.thin] = Math.sign(lp[p.thin]) * p.dims[p.thin] / 2;
26354
+ const r = vec.distance(toWorld(p.pos, p.q, at4), centre);
26355
+ const side = sideOnOverpressure(tnt, r);
26356
+ const reflected = 2 * side + 6 * side * side / (side + 7 * 101325);
26357
+ const impulse = bodyImpulse(tnt, r);
26358
+ if (reflected > PANEL_PRESSURE && impulse > PANEL_IMPULSE && (reflected - PANEL_PRESSURE) * (impulse - PANEL_IMPULSE) >= PANEL_PI) loaded++;
26359
+ }
26360
+ if (loaded < PANEL_POINTS_LOADED) return false;
26361
+ const grid = gridOf(p);
26362
+ const worn = (_a = p.rt).chips ?? (_a.chips = {});
26363
+ const out = [];
26364
+ for (let i = 0; i < grid.length; i++) {
26365
+ const cell = grid[i];
26366
+ if (worn[i] === -1) continue;
26367
+ if (cell.center[u] - cell.size[u] / 2 >= from - 1e-6 && cell.center[u] + cell.size[u] / 2 <= to + 1e-6) out.push(i);
26368
+ }
26369
+ if (out.length === 0) return false;
26370
+ for (const i of out) worn[i] = -1;
26371
+ return knockOutUnits(o, p, point, energy, out, src);
26372
+ };
26373
+ const knockOutUnits = (o, p, wp, energy, out, src) => {
26374
+ var _a, _b;
26375
+ const [u, v] = planeAxes(p.thin);
26376
+ const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
26377
+ const grid = gridOf(p);
26378
+ const worn = (_a = p.rt).chips ?? (_a.chips = {});
26379
+ for (const i of out) worn[i] = -1;
26238
26380
  const loose = unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(grid[i].center[u] - op[u], grid[i].center[v] - op[v]) <= p.st.opening.radius));
26239
26381
  for (const i of loose) worn[i] = -1;
26240
26382
  const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
@@ -26641,7 +26783,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26641
26783
  const absorbed = penetrated && (mat.ductility >= 0.5 && mat.fracture !== "tear" || hollowTear) ? Math.min(E, thr) : E;
26642
26784
  const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src);
26643
26785
  if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
26644
- chipUnits(o, p, "ballistic", entry2, penetrated ? Math.min(E, Math.max(thr, E * 0.5)) : E, d, Math.max(0.05, caliber / 1e3 * 8), src);
26786
+ if (!wearMember(o, p, entry2, d, E, caliber, penMm, src)) chipUnits(o, p, "ballistic", entry2, penetrated ? Math.min(E, Math.max(thr, E * 0.5)) : E, d, Math.max(0.05, caliber / 1e3 * 8), src);
26645
26787
  return { penetrated, exitEnergy: penetrated ? penMm !== void 0 ? E * (1 - thr / Ep) : E - thr / (hard ? piercing : 1) : 0, exitPoint, damage: dmg };
26646
26788
  };
26647
26789
  const melee = (o, p, kind, E, point, n, d, contactR, src) => {
@@ -26717,12 +26859,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26717
26859
  return reach;
26718
26860
  }
26719
26861
  if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
26720
- const dealt = applyDamage(o, p, amount, "explosive", point, null, Ein * 0.3, 40, src);
26862
+ const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
26863
+ const farMember = Boolean(p.spec.reinforcement && p.spec.units) && dist2 > MEMBER_CUT_REACH * breachReach;
26864
+ const dealt = farMember ? applyDamage(o, p, Math.min(amount, Math.max(0, p.st.hp - p.st.maxHp * FAR_MEMBER_HP_FLOOR)), "explosive", null, null, Ein * 0.3, 40, src) : applyDamage(o, p, amount, "explosive", point, null, Ein * 0.3, 40, src);
26721
26865
  res.damage += dealt;
26722
26866
  if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach, src);
26723
- const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
26724
- if (p.spec.units && p.spec.units.mortar !== p.spec.material) blastUnits(o, p, wp, energy, dist2, src);
26725
- else if (p.spec.reinforcement && p.spec.units && dist2 > MEMBER_CUT_REACH * breachReach) blastUnits(o, p, wp, energy, dist2, src);
26867
+ if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
26868
+ blastPanel(o, p, point, energy, src);
26869
+ if (!isLost(p)) blastUnits(o, p, wp, energy, dist2, src);
26870
+ } else if (farMember) blastUnits(o, p, wp, energy, dist2, src);
26726
26871
  else if (dist2 <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
26727
26872
  return reach;
26728
26873
  };
@@ -28833,27 +28978,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28833
28978
  });
28834
28979
  return changed ? { parts, supports: input.supports } : input;
28835
28980
  }
28836
- function supportBondBeam(context, plate2) {
28981
+ function supportBondBeam(context, plate3) {
28837
28982
  const { options } = context;
28838
- const dir = plate2.aabb[2] - plate2.aabb[0] >= plate2.aabb[3] - plate2.aabb[1] ? "u" : "v";
28839
- const line = lineOf(plate2.aabb, dir);
28840
- const width = dir === "u" ? plate2.aabb[3] - plate2.aabb[1] : plate2.aabb[2] - plate2.aabb[0];
28983
+ const dir = plate3.aabb[2] - plate3.aabb[0] >= plate3.aabb[3] - plate3.aabb[1] ? "u" : "v";
28984
+ const line = lineOf(plate3.aabb, dir);
28985
+ const width = dir === "u" ? plate3.aabb[3] - plate3.aabb[1] : plate3.aabb[2] - plate3.aabb[0];
28841
28986
  const dist2 = distancesOf(context);
28842
- const floor2 = plate2.floor;
28843
- const props = propsUnder(context, dist2, plate2.y0, plate2.y1, floor2);
28987
+ const floor2 = plate3.floor;
28988
+ const props = propsUnder(context, dist2, plate3.y0, plate3.y1, floor2);
28844
28989
  const storey = { floor: floor2, below: floor2 >= 1 ? `slab_${floor2}` : void 0, bottom: context.structure.levels[floor2] ?? 0 };
28845
28990
  const spots = [];
28846
28991
  const near = props.length ? Math.min(...props.map((p) => p.dist)) : pillarDist(context, dist2, storey);
28847
28992
  const held = pillarsFor(line, width, props, spots, near, options, false);
28848
28993
  const span = beamSpan(line.to - line.from, held).span;
28849
28994
  if (span > 1.5) {
28850
- const depth = Math.max(plate2.y1 - plate2.y0, beamDepthFor(Math.min(span, options.maxSpan), options));
28851
- plate2.y0 = round2(plate2.y1 - depth);
28852
- plate2.mass = Math.max(1, Math.round((plate2.aabb[2] - plate2.aabb[0]) * (plate2.aabb[3] - plate2.aabb[1]) * depth * densityOf(plate2.material)));
28995
+ const depth = Math.max(plate3.y1 - plate3.y0, beamDepthFor(Math.min(span, options.maxSpan), options));
28996
+ plate3.y0 = round2(plate3.y1 - depth);
28997
+ plate3.mass = Math.max(1, Math.round((plate3.aabb[2] - plate3.aabb[0]) * (plate3.aabb[3] - plate3.aabb[1]) * depth * densityOf(plate3.material)));
28853
28998
  }
28854
28999
  for (const spot of spots) {
28855
- const pillar = addPillar(context, spot, storey.bottom, plate2.y0 + PLAN_TOLERANCE, floor2, storey.below, plate2.id);
28856
- rest(context, pillar, plate2, "rebar");
29000
+ const pillar = addPillar(context, spot, storey.bottom, plate3.y0 + PLAN_TOLERANCE, floor2, storey.below, plate3.id);
29001
+ rest(context, pillar, plate3, "rebar");
28857
29002
  }
28858
29003
  }
28859
29004
  function applySlabPanels(input, structure, options) {
@@ -29757,7 +29902,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29757
29902
  const tributary = bay[0] * bay[1];
29758
29903
  const load = COLUMN_SHARE * tributary * storeys * (o.superimposed + slab * 2500);
29759
29904
  const columnSize = o.columnSize ?? Math.max(TOWER_DEFAULTS.columnSize, round23(ceilTo2(Math.sqrt(load / COLUMN_KG_M2), 0.1)));
29760
- const plate2 = [round23(span[0] + columnSize + 0.2), round23(span[1] + columnSize + 0.2)];
29905
+ const plate3 = [round23(span[0] + columnSize + 0.2), round23(span[1] + columnSize + 0.2)];
29761
29906
  const mech = o.mechanicalEvery === false ? void 0 : o.mechanicalEvery;
29762
29907
  const relays = o.mechanical === false ? [] : mechanicalStoreys(storeys, o.mechanical === void 0 ? mech : o.mechanical.every ?? mech);
29763
29908
  const mechanical = o.mechanical === false ? [] : [...relays, storeys - 1];
@@ -29771,11 +29916,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29771
29916
  const shaft = given2.shaft ?? CORE_DEFAULTS.shaft;
29772
29917
  const fit = Math.max(1, Math.floor((bay[1] - 2 * CORE_CLEARANCE - 0.2 - 2 * wallThickness + ti) / (shaft + ti)));
29773
29918
  const probe = coreSize({ ...given2, wallThickness, elevators: 2 });
29774
- const wanted = given2.elevators ?? Math.max(2, Math.ceil((o.coreRatio * plate2[0] * plate2[1] / probe[0] - 2 * wallThickness + ti) / (shaft + ti)));
29919
+ const wanted = given2.elevators ?? Math.max(2, Math.ceil((o.coreRatio * plate3[0] * plate3[1] / probe[0] - 2 * wallThickness + ti) / (shaft + ti)));
29775
29920
  const elevators = Math.max(1, Math.min(wanted, fit));
29776
29921
  const narrow = coreSize({ ...given2, wallThickness, elevators });
29777
29922
  const room = bay[0] - columnSize - 2 * CORE_CLEARANCE - narrow[0];
29778
- const extra = given2.shaftDepth !== void 0 ? 0 : Math.max(0, Math.min(room, o.coreRatio * plate2[0] * plate2[1] / narrow[1] - narrow[0]));
29923
+ const extra = given2.shaftDepth !== void 0 ? 0 : Math.max(0, Math.min(room, o.coreRatio * plate3[0] * plate3[1] / narrow[1] - narrow[0]));
29779
29924
  const xs = Array.from({ length: bays[0] + 1 }, (_, i) => -span[0] / 2 + i * bay[0]);
29780
29925
  const middle = Math.floor(bays[0] / 2);
29781
29926
  const center = given2.center ?? [bays[0] % 2 === 1 ? (xs[middle] + xs[middle + 1]) / 2 : xs[middle] + bay[0] / 2, 0];
@@ -29819,9 +29964,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29819
29964
  columnsZ: bays[1] + 1,
29820
29965
  columnSize,
29821
29966
  beamHeight,
29822
- plate: plate2,
29967
+ plate: plate3,
29823
29968
  core: coreLayout,
29824
- coreRatio: coreLayout ? coreLayout.size[0] * coreLayout.size[1] / (plate2[0] * plate2[1]) : 0,
29969
+ coreRatio: coreLayout ? coreLayout.size[0] * coreLayout.size[1] / (plate3[0] * plate3[1]) : 0,
29825
29970
  facade: o.facade,
29826
29971
  mechanical,
29827
29972
  damper: damperOn,
@@ -29879,7 +30024,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29879
30024
  }
29880
30025
  var storeyKinds = (layout) => Array.from({ length: layout.storeys }, (_, f) => f === 0 ? "ground" : layout.mechanical.includes(f) ? "mechanical" : "typical");
29881
30026
  var EDGE = 1e-6;
29882
- function exteriorWindows(id, rect, plate2, ceiling, o = {}) {
30027
+ function exteriorWindows(id, rect, plate3, ceiling, o = {}) {
29883
30028
  const [u0, v0, u1, v1] = rect;
29884
30029
  const spacing = o.spacing ?? 3;
29885
30030
  const out = [];
@@ -29888,9 +30033,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29888
30033
  out.push({ room: id, side, n, width: Math.min(o.width ?? 2.4, length2 / n * 0.8), y0: o.y0 ?? 0.3, y1: o.y1 ?? r2(ceiling - 0.5) });
29889
30034
  };
29890
30035
  if (Math.abs(v0) < EDGE) add2("front", u1 - u0);
29891
- if (Math.abs(v1 - plate2.d) < EDGE) add2("back", u1 - u0);
30036
+ if (Math.abs(v1 - plate3.d) < EDGE) add2("back", u1 - u0);
29892
30037
  if (Math.abs(u0) < EDGE) add2("left", v1 - v0);
29893
- if (Math.abs(u1 - plate2.w) < EDGE) add2("right", v1 - v0);
30038
+ if (Math.abs(u1 - plate3.w) < EDGE) add2("right", v1 - v0);
29894
30039
  return out;
29895
30040
  }
29896
30041
  var stripDoor = (id, strip, floor2, width = 1) => ({ a: id, b: `${strip.circulation}_${floor2}`, width, opensTo: id });
@@ -29898,33 +30043,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29898
30043
  const id = `plant_${floor2}_${strip.id}`;
29899
30044
  return { rooms: [{ id, type: "storage", label: "plant_room", rect: [...strip.rect] }], doors: [stripDoor(id, strip, floor2, 1.2)], windows: [] };
29900
30045
  };
29901
- function coreRooms(plate2, floor2, storeys) {
30046
+ function coreRooms(plate3, floor2, storeys) {
29902
30047
  const id = (name) => `${name}_${floor2}`;
29903
30048
  const link = floor2 < storeys - 1 ? [floor2, floor2 + 1] : [floor2 - 1, floor2];
29904
30049
  const rooms = [
29905
- { id: id("stairs"), type: "stairs", label: "stairs", rect: [...plate2.stairs], link },
29906
- ...plate2.service ? [{ id: id("service"), type: "storage", label: "service_shaft", rect: [...plate2.service] }] : [],
29907
- ...plate2.shafts.map((rect, k) => ({ id: id(`elevator_${k}`), type: "elevator", label: "elevator", rect: [...rect] })),
29908
- { id: id("lobby"), type: "hall", label: "elevator_lobby", rect: [...plate2.lobby] },
29909
- { id: id("corridor_w"), type: "corridor", label: "corridor", rect: [...plate2.corridors.w] },
29910
- { id: id("corridor_s"), type: "corridor", label: "corridor", rect: [...plate2.corridors.s] },
29911
- { id: id("corridor_n"), type: "corridor", label: "corridor", rect: [...plate2.corridors.n] }
30050
+ { id: id("stairs"), type: "stairs", label: "stairs", rect: [...plate3.stairs], link },
30051
+ ...plate3.service ? [{ id: id("service"), type: "storage", label: "service_shaft", rect: [...plate3.service] }] : [],
30052
+ ...plate3.shafts.map((rect, k) => ({ id: id(`elevator_${k}`), type: "elevator", label: "elevator", rect: [...rect] })),
30053
+ { id: id("lobby"), type: "hall", label: "elevator_lobby", rect: [...plate3.lobby] },
30054
+ { id: id("corridor_w"), type: "corridor", label: "corridor", rect: [...plate3.corridors.w] },
30055
+ { id: id("corridor_s"), type: "corridor", label: "corridor", rect: [...plate3.corridors.s] },
30056
+ { id: id("corridor_n"), type: "corridor", label: "corridor", rect: [...plate3.corridors.n] }
29912
30057
  ];
29913
30058
  const doors = [
29914
30059
  { a: id("stairs"), b: id("corridor_w"), width: 1, opensTo: id("corridor_w") },
29915
- ...plate2.service ? [{ a: id("service"), b: id("corridor_w"), width: 0.8, opensTo: id("service") }] : [],
29916
- ...plate2.shafts.map((_, k) => ({ a: id(`elevator_${k}`), b: id("lobby"), width: 1.2, opensTo: id("lobby") }))
30060
+ ...plate3.service ? [{ a: id("service"), b: id("corridor_w"), width: 0.8, opensTo: id("service") }] : [],
30061
+ ...plate3.shafts.map((_, k) => ({ a: id(`elevator_${k}`), b: id("lobby"), width: 1.2, opensTo: id("lobby") }))
29917
30062
  ];
29918
30063
  const openPairs = [[id("lobby"), id("corridor_s")], [id("lobby"), id("corridor_n")], [id("corridor_w"), id("corridor_s")], [id("corridor_w"), id("corridor_n")]];
29919
30064
  return { rooms, doors, openPairs };
29920
30065
  }
29921
30066
  function towerFloors(layout, plan) {
29922
- const plate2 = towerPlate(layout, plan);
30067
+ const plate3 = towerPlate(layout, plan);
29923
30068
  const fillers = { ground: plan.ground ?? plan.typical, typical: plan.typical, mechanical: plan.mechanical ?? plantRooms };
29924
30069
  return storeyKinds(layout).map((kind, floor2) => {
29925
- const context = { floor: floor2, kind, layout, plate: plate2, ceiling: layout.pitch };
29926
- const fills = plate2.strips.map((strip) => fillers[kind](strip, context));
29927
- const core = coreRooms(plate2, floor2, layout.storeys);
30070
+ const context = { floor: floor2, kind, layout, plate: plate3, ceiling: layout.pitch };
30071
+ const fills = plate3.strips.map((strip) => fillers[kind](strip, context));
30072
+ const core = coreRooms(plate3, floor2, layout.storeys);
29928
30073
  return {
29929
30074
  label: kind === "ground" ? "ground_floor" : kind === "mechanical" ? "mechanical_floor" : "typical_floor",
29930
30075
  ceiling: layout.pitch,
@@ -30002,7 +30147,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30002
30147
  var OPEN_ROOM_TYPES2 = /* @__PURE__ */ new Set(["balcony", "terrace", "veranda", "balcony_gourmet"]);
30003
30148
  var rectsOf = (c) => c.parts && c.parts.length ? c.parts : [[c.u0, c.v0, c.u1, c.v1]];
30004
30149
  var isOpenArea = (c) => OPEN_ROOM_TYPES2.has(c.type) || c.outdoor === true;
30005
- function installKernelGeometry(K, shared2) {
30150
+ function installKernelGeometry(K, shared3) {
30006
30151
  const { THREE } = K;
30007
30152
  const GEO = {};
30008
30153
  {
@@ -30075,9 +30220,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30075
30220
  const cursor = { group: "lot", accs: /* @__PURE__ */ new Map(), rot: [], org: [0, 0, 0], ry: 0 };
30076
30221
  const PARTS = [];
30077
30222
  const MIRRORS = [];
30078
- shared2.partCount = 0;
30223
+ shared3.partCount = 0;
30079
30224
  function part(type, pos, fn, meta = {}, parent, ry = 0) {
30080
- const gA = cursor.group, oA = cursor.org, rA = cursor.ry, pieceA = cursor.pc, name = "part:" + (meta.id || type) + ":" + shared2.partCount++;
30225
+ const gA = cursor.group, oA = cursor.org, rA = cursor.ry, pieceA = cursor.pc, name = "part:" + (meta.id || type) + ":" + shared3.partCount++;
30081
30226
  PARTS.push({ name, parent: parent || gA, pos: pos.slice(), type, meta, ry });
30082
30227
  cursor.group = name;
30083
30228
  cursor.org = pos;
@@ -30113,7 +30258,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30113
30258
  }
30114
30259
  const _Y = new THREE.Vector3(0, 1, 0), _qa = new THREE.Quaternion(), _qb = new THREE.Quaternion();
30115
30260
  function pieceRecord(id, mat, role, extra) {
30116
- const M = shared2.ctx.pieces;
30261
+ const M = shared3.ctx.pieces;
30117
30262
  let p = M.get(id);
30118
30263
  if (!p) {
30119
30264
  p = Object.assign({ id, mat, role: role || null }, extra);
@@ -30122,7 +30267,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30122
30267
  return p;
30123
30268
  }
30124
30269
  const structurePiece = (id) => {
30125
- const e = shared2.ctx.structureIndex && shared2.ctx.structureIndex[id];
30270
+ const e = shared3.ctx.structureIndex && shared3.ctx.structureIndex[id];
30126
30271
  return e ? pieceRecord(id, e.material, e.role, { floor: e.floor }) : null;
30127
30272
  };
30128
30273
  function accFor(mat) {
@@ -30580,14 +30725,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30580
30725
  const defined = { createMaterials: createMaterials2, antiTile, dirtMaterial, CLOTHES_UNIFORMS, clothesMaterial, ORDER: ORDER2, NO_SHADOW };
30581
30726
  Object.assign(K, defined);
30582
30727
  }
30583
- function installKernelCloseScene(K, shared2) {
30728
+ function installKernelCloseScene(K, shared3) {
30584
30729
  const { THREE, NO_SHADOW, ORDER: ORDER2, PARTS, applyPart, cursor } = K;
30585
30730
  const assembleCars = (...a) => K.assembleCars(...a);
30586
30731
  const assembleMirrors = (...a) => K.assembleMirrors(...a);
30587
30732
  const assembleVegetation = (...a) => K.assembleVegetation(...a);
30588
30733
  function markMesh(m, A) {
30589
30734
  const L = A.lim, fx = [];
30590
- const pieces = shared2.ctx.pieces;
30735
+ const pieces = shared3.ctx.pieces;
30591
30736
  for (let k = 0; k < L.length; k++) {
30592
30737
  const lim = L[k], pc = lim.pc;
30593
30738
  if (!pc) continue;
@@ -30649,7 +30794,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30649
30794
  if (P.meta.t0) applyPart(g, P.meta.t0);
30650
30795
  }
30651
30796
  (groups[P.parent] || (groups[P.parent] = new THREE.Group())).add(g);
30652
- if (P.meta.id) (shared2.ctx.parts || (shared2.ctx.parts = {}))[P.meta.id] = g;
30797
+ if (P.meta.id) (shared3.ctx.parts || (shared3.ctx.parts = {}))[P.meta.id] = g;
30653
30798
  }
30654
30799
  PARTS.length = 0;
30655
30800
  assembleMirrors(groups);
@@ -30660,20 +30805,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30660
30805
  const defined = { markMesh, closeScene };
30661
30806
  Object.assign(K, defined);
30662
30807
  }
30663
- function installHouseHelpers(K, shared2) {
30664
- shared2.ctx = {};
30808
+ function installHouseHelpers(K, shared3) {
30809
+ shared3.ctx = {};
30665
30810
  const OPEN_ROOM_TYPES22 = /* @__PURE__ */ new Set(["balcony", "terrace", "veranda", "balcony_gourmet"]);
30666
30811
  const NO_CEILING = OPEN_ROOM_TYPES22;
30667
30812
  const OPEN_AREA = (c) => OPEN_ROOM_TYPES22.has(c.type) || c.outdoor === true;
30668
30813
  const EPS6 = 1e-3;
30669
30814
  const Y0 = (f) => {
30670
- const A = shared2.ctx.r.floors;
30815
+ const A = shared3.ctx.r.floors;
30671
30816
  return A[Math.max(0, Math.min(A.length - 1, f))].y0;
30672
30817
  };
30673
- const colorOf = (v) => typeof v === "number" ? v : typeof v === "string" && shared2.ctx.colors[v] != null ? shared2.ctx.colors[v] : null;
30818
+ const colorOf = (v) => typeof v === "number" ? v : typeof v === "string" && shared3.ctx.colors[v] != null ? shared3.ctx.colors[v] : null;
30674
30819
  const rectsOf2 = (c) => c.parts && c.parts.length ? c.parts : [[c.u0, c.v0, c.u1, c.v1]];
30675
30820
  function roomAt(f, u, v) {
30676
- for (const c of shared2.ctx.r.rooms) if (c.floor === f) {
30821
+ for (const c of shared3.ctx.r.rooms) if (c.floor === f) {
30677
30822
  for (const [a, b, c2, d] of rectsOf2(c)) if (u > a + EPS6 && u < c2 - EPS6 && v > b + EPS6 && v < d - EPS6) return c;
30678
30823
  }
30679
30824
  return null;
@@ -30707,7 +30852,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30707
30852
  return [Math.min(...pts.map((p) => p[0])), Math.min(...pts.map((p) => p[1])), Math.max(...pts.map((p) => p[0])), Math.max(...pts.map((p) => p[1]))];
30708
30853
  }
30709
30854
  function effectiveHeight(f, h) {
30710
- const A = shared2.ctx.r.floors;
30855
+ const A = shared3.ctx.r.floors;
30711
30856
  if (f + 1 >= A.length) return h;
30712
30857
  const pitch = A[f + 1].y0 - A[f].y0;
30713
30858
  return h > pitch && h - pitch <= 0.45 ? pitch : h;
@@ -30715,7 +30860,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30715
30860
  const defined = { OPEN_ROOM_TYPES: OPEN_ROOM_TYPES22, NO_CEILING, OPEN_AREA, EPS: EPS6, Y0, colorOf, rectsOf: rectsOf2, roomAt, subRect, subRects, wallColor, floorColor, stairFootprint, effectiveHeight };
30716
30861
  Object.assign(K, defined);
30717
30862
  }
30718
- function installHouseWalls(K, shared2) {
30863
+ function installHouseWalls(K, shared3) {
30719
30864
  const { EPS: EPS6, Y0, boxC, bx, cursor, effectiveHeight, pieceRecord, structurePiece, wallColor } = K;
30720
30865
  const sh = (...a) => K.sh(...a);
30721
30866
  function wallBox(alongU, L, a, b, ya, yb, th, cL, cH, mL, mH) {
@@ -30729,10 +30874,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30729
30874
  }
30730
30875
  }
30731
30876
  function sideOf(id, frontLine) {
30732
- const R = shared2.ctx.r, F = R.facade;
30733
- if (id === "outside" || !shared2.ctx.roomById[id]) {
30877
+ const R = shared3.ctx.r, F = R.facade;
30878
+ if (id === "outside" || !shared3.ctx.roomById[id]) {
30734
30879
  const ac = F.finish;
30735
- let mat = "plaster", color2 = shared2.ctx.colors.facade;
30880
+ let mat = "plaster", color2 = shared3.ctx.colors.facade;
30736
30881
  if (ac === "roughcast") mat = "roughcast";
30737
30882
  else if (ac === "exposed_block") {
30738
30883
  mat = "block";
@@ -30743,12 +30888,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30743
30888
  }
30744
30889
  return { color: color2, mat, exterior: true };
30745
30890
  }
30746
- return { color: wallColor(shared2.ctx.roomById[id]), mat: "plaster", exterior: false };
30891
+ return { color: wallColor(shared3.ctx.roomById[id]), mat: "plaster", exterior: false };
30747
30892
  }
30748
30893
  const pieceOf = (w) => !w.id ? null : structurePiece(w.id) || pieceRecord(w.id, w.material || "brick", w.role || "partition", { floor: w.floor });
30749
30894
  function nearestWall(f, axis2, L, c) {
30750
30895
  let m = null, md = 1e9;
30751
- for (const w of shared2.ctx.r.walls) {
30896
+ for (const w of shared3.ctx.r.walls) {
30752
30897
  if (w.floor !== f || w.axis !== axis2 || w.type !== "wall" || Math.abs((axis2 === "u" ? w.v0 : w.u0) - L) > EPS6) continue;
30753
30898
  const a = Math.min(axis2 === "u" ? w.u0 : w.v0, axis2 === "u" ? w.u1 : w.v1), b = Math.max(axis2 === "u" ? w.u0 : w.v0, axis2 === "u" ? w.u1 : w.v1), d = c < a ? a - c : c > b ? c - b : 0;
30754
30899
  if (d < md) {
@@ -30759,11 +30904,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30759
30904
  return m;
30760
30905
  }
30761
30906
  function walls() {
30762
- const R = shared2.ctx.r, cut = shared2.ctx.cut, nA = R.floors.length, vMin = Math.min(...R.walls.map((w) => w.axis === "u" ? w.v0 : Math.min(w.v0, w.v1)));
30907
+ const R = shared3.ctx.r, cut = shared3.ctx.cut, nA = R.floors.length, vMin = Math.min(...R.walls.map((w) => w.axis === "u" ? w.v0 : Math.min(w.v0, w.v1)));
30763
30908
  const corners = /* @__PURE__ */ new Map();
30764
30909
  const looks = /* @__PURE__ */ new Map();
30765
30910
  for (const w of R.walls) {
30766
- const f = w.floor, colliders = shared2.ctx.colliders;
30911
+ const f = w.floor, colliders = shared3.ctx.colliders;
30767
30912
  cursor.group = "f" + f;
30768
30913
  cursor.pc = pieceOf(w);
30769
30914
  const y0 = Y0(f), pitch = f + 1 < nA ? Y0(f + 1) - y0 : Infinity, th = w.thickness || 0.15, alongU = w.axis === "u";
@@ -30777,7 +30922,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30777
30922
  }
30778
30923
  colliders.push({ type: "wall", piece: w.id, f, x0: alongU ? s0 : L - th / 2, z0: alongU ? L - th / 2 : s0, x1: alongU ? s1 : L + th / 2, z1: alongU ? L + th / 2 : s1 });
30779
30924
  if (w.type === "railing") {
30780
- const c0 = shared2.ctx.colors.metal != null ? shared2.ctx.colors.metal : 9080466;
30925
+ const c0 = shared3.ctx.colors.metal != null ? shared3.ctx.colors.metal : 9080466;
30781
30926
  const sx = alongU ? 1 : 0, sz = alongU ? 0 : 1, len = s1 - s0, n = Math.max(1, Math.round(len / 1.4));
30782
30927
  const cx_ = alongU ? (s0 + s1) / 2 : L, cz_ = alongU ? L : (s0 + s1) / 2;
30783
30928
  boxC("glass", cx_, y0 + 0.55, cz_, alongU ? len : 0.02, 0.85, alongU ? 0.02 : len, 16777215);
@@ -30821,7 +30966,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30821
30966
  cursor.group = "f" + e.f;
30822
30967
  bx(e.color.mat, e.pu - e.th / 2, e.y0, e.pv - e.th / 2, e.pu + e.th / 2, e.y0 + e.hh, e.pv + e.th / 2, e.color.color);
30823
30968
  }
30824
- if (shared2.ctx.showPillars) wallPillars(looks);
30969
+ if (shared3.ctx.showPillars) wallPillars(looks);
30825
30970
  }
30826
30971
  const PILLAR_IN_WALL = /^(wall_column_|column_\d|jamb_column_)/;
30827
30972
  const wallOf = (pillar, parts) => {
@@ -30829,7 +30974,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30829
30974
  return parts.find((q) => (q.role === "wall" || q.role === "partition") && q.assembly !== void 0 && q.floor === pillar.floor && u >= q.aabb[0] - 1e-3 && u <= q.aabb[2] + 1e-3 && v >= q.aabb[1] - 1e-3 && v <= q.aabb[3] + 1e-3);
30830
30975
  };
30831
30976
  function wallPillars(looks) {
30832
- const parts = Object.values(shared2.ctx.structureIndex);
30977
+ const parts = Object.values(shared3.ctx.structureIndex);
30833
30978
  for (const e of parts) {
30834
30979
  if (e.role !== "column" || !PILLAR_IN_WALL.test(e.id)) continue;
30835
30980
  const host = wallOf(e, parts);
@@ -30844,7 +30989,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30844
30989
  const defined = { wallBox, sideOf, pieceOf, nearestWall, walls, wallPillars };
30845
30990
  Object.assign(K, defined);
30846
30991
  }
30847
- function installHouseDoors(K, shared2) {
30992
+ function installHouseDoors(K, shared3) {
30848
30993
  const seedKey = (id) => K.seedKey(id);
30849
30994
  const { EPS: EPS6, Y0, boxC, bx, cursor, effectiveHeight, nearestWall, part, pieceOf, pieceRecord, roomAt, sideOf, wallBox } = K;
30850
30995
  const SEED = (...a) => K.SEED(...a);
@@ -30852,15 +30997,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30852
30997
  const rngString = (...a) => K.rngString(...a);
30853
30998
  const sh = (...a) => K.sh(...a);
30854
30999
  function doorLineSides(p) {
30855
- const R = shared2.ctx.r, alongU = p.axis === "u", a = p.at - p.width / 2, b = p.at + p.width / 2;
31000
+ const R = shared3.ctx.r, alongU = p.axis === "u", a = p.at - p.width / 2, b = p.at + p.width / 2;
30856
31001
  const w = R.walls.find((w2) => w2.floor === p.floor && w2.axis === p.axis && Math.abs((alongU ? w2.v0 : w2.u0) - p.pos) < EPS6 && w2.type === "wall" && (Math.abs((alongU ? w2.u1 : w2.v1) - a) < 0.02 || Math.abs((alongU ? w2.u0 : w2.v0) - b) < 0.02));
30857
31002
  const sides = w ? w.sides : [p.a, p.b];
30858
31003
  return [sideOf(sides[0], false), sideOf(sides[1], false)];
30859
31004
  }
30860
- shared2.doorState = /* @__PURE__ */ new Map();
31005
+ shared3.doorState = /* @__PURE__ */ new Map();
30861
31006
  function doors() {
30862
- const leaves = shared2.ctx.leaves = [], doorState = shared2.doorState, colliders = shared2.ctx.colliders;
30863
- const R = shared2.ctx.r, cut = shared2.ctx.cut, C = shared2.ctx.colors, wood = C.wood != null ? C.wood : 8016948, frame2 = sh(wood, 0.55);
31007
+ const leaves = shared3.ctx.leaves = [], doorState = shared3.doorState, colliders = shared3.ctx.colliders;
31008
+ const R = shared3.ctx.r, cut = shared3.ctx.cut, C = shared3.ctx.colors, wood = C.wood != null ? C.wood : 8016948, frame2 = sh(wood, 0.55);
30864
31009
  for (const p of R.doors) {
30865
31010
  const f = p.floor;
30866
31011
  cursor.group = "f" + f;
@@ -30990,12 +31135,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30990
31135
  const defined = { doorLineSides, doors };
30991
31136
  Object.assign(K, defined);
30992
31137
  }
30993
- function installHouseWindows(K, shared2) {
31138
+ function installHouseWindows(K, shared3) {
30994
31139
  const { EPS: EPS6, Y0, boxC, bx, cursor, pieceRecord, roomAt } = K;
30995
31140
  const FRAME_COLORS = { budget: 15856110, mid: 12830924, high: 2829875, commercial: 11844287 };
30996
31141
  const SILL_COLORS = { budget: 15131870, mid: 14277076, high: 3816770, commercial: 13225166 };
30997
31142
  function windows() {
30998
- const R = shared2.ctx.r, cut = shared2.ctx.cut, C = shared2.ctx.colors, structure = R.style, fr = FRAME_COLORS[structure] || FRAME_COLORS.budget, pe_ = SILL_COLORS[structure] || SILL_COLORS.budget;
31143
+ const R = shared3.ctx.r, cut = shared3.ctx.cut, C = shared3.ctx.colors, structure = R.style, fr = FRAME_COLORS[structure] || FRAME_COLORS.budget, pe_ = SILL_COLORS[structure] || SILL_COLORS.budget;
30999
31144
  const boardItems = new Set(R.stateItems.filter((e) => e.type === "window_boards" && e.window).map((e) => e.window));
31000
31145
  for (const j of R.windows) {
31001
31146
  const f = j.floor;
@@ -31049,11 +31194,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31049
31194
  const defined = { FRAME_COLORS, SILL_COLORS, windows };
31050
31195
  Object.assign(K, defined);
31051
31196
  }
31052
- function installHouseFloors(K, shared2) {
31197
+ function installHouseFloors(K, shared3) {
31053
31198
  const { rectsOf: rectsOf2, EPS: EPS6, OPEN_AREA, Y0, bx, cursor, floorColor, stairFootprint, structurePiece, subRects } = K;
31054
31199
  function flights() {
31055
- if (shared2.ctx._flights && shared2.ctx._flights.r === shared2.ctx.r) return shared2.ctx._flights.l;
31056
- const R = shared2.ctx.r, mp = /* @__PURE__ */ new Map();
31200
+ if (shared3.ctx._flights && shared3.ctx._flights.r === shared3.ctx.r) return shared3.ctx._flights.l;
31201
+ const R = shared3.ctx.r, mp = /* @__PURE__ */ new Map();
31057
31202
  for (const m of R.items) {
31058
31203
  if (m.type !== "stairs" || !m.link || typeof m.link !== "object") continue;
31059
31204
  const k = [m.link.from, m.link.to, m.x.toFixed(2), m.z.toFixed(2), (m.ry || 0).toFixed(2)].join("|");
@@ -31069,12 +31214,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31069
31214
  v.LP = LP;
31070
31215
  v.top = stairFootprint({ x: m.x + lz * Math.sin(m.ry), z: m.z + lz * Math.cos(m.ry), ry: m.ry, w: m.w, d: LP });
31071
31216
  }
31072
- shared2.ctx._flights = { r: R, l };
31217
+ shared3.ctx._flights = { r: R, l };
31073
31218
  return l;
31074
31219
  }
31075
31220
  const panelRects = (p) => p.footprint && p.footprint.length ? p.footprint : [p.aabb];
31076
31221
  function tilesOf(parent, rc) {
31077
- const ps = parent ? shared2.ctx.panelsOf && shared2.ctx.panelsOf.get(parent) : void 0;
31222
+ const ps = parent ? shared3.ctx.panelsOf && shared3.ctx.panelsOf.get(parent) : void 0;
31078
31223
  if (!ps) return [[parent ? structurePiece(parent) : null, rc]];
31079
31224
  const out = [], taken = [];
31080
31225
  for (const p of ps) for (const q of panelRects(p)) {
@@ -31088,14 +31233,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31088
31233
  return out;
31089
31234
  }
31090
31235
  function panelAt(parent, x, z) {
31091
- const ps = shared2.ctx.panelsOf && shared2.ctx.panelsOf.get(parent);
31236
+ const ps = shared3.ctx.panelsOf && shared3.ctx.panelsOf.get(parent);
31092
31237
  if (!ps) return structurePiece(parent);
31093
31238
  for (const p of ps) for (const q of panelRects(p)) if (x >= q[0] - EPS6 && x <= q[2] + EPS6 && z >= q[1] - EPS6 && z <= q[3] + EPS6) return structurePiece(p.id);
31094
31239
  return null;
31095
31240
  }
31096
- const hasSlab = (id) => !!(shared2.ctx.structureIndex[id] || shared2.ctx.panelsOf && shared2.ctx.panelsOf.has(id));
31241
+ const hasSlab = (id) => !!(shared3.ctx.structureIndex[id] || shared3.ctx.panelsOf && shared3.ctx.panelsOf.has(id));
31097
31242
  function floorsAndSlabs() {
31098
- const R = shared2.ctx.r, nA = R.floors.length, C = shared2.ctx.colors;
31243
+ const R = shared3.ctx.r, nA = R.floors.length, C = shared3.ctx.colors;
31099
31244
  const V3 = flights(), holes = (f) => V3.filter((v) => v.to === f).flatMap((v) => {
31100
31245
  let rs = [v.rect];
31101
31246
  if (v.top) rs = subRects(rs, [v.top]);
@@ -31132,17 +31277,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31132
31277
  }
31133
31278
  Object.assign(K, { flights, floorsAndSlabs, tilesOf, panelAt });
31134
31279
  }
31135
- function installHouseStairs(K, shared2) {
31280
+ function installHouseStairs(K, shared3) {
31136
31281
  const { rectsOf: rectsOf2, Y0, boxC, bx, cursor, flights, stairFootprint, structurePiece } = K;
31137
31282
  const sh = (...a) => K.sh(...a);
31138
31283
  function buildStairs() {
31139
- const R = shared2.ctx.r, stairs = shared2.ctx.stairs = [];
31284
+ const R = shared3.ctx.r, stairs = shared3.ctx.stairs = [];
31140
31285
  for (const vo of flights()) {
31141
31286
  const m = vo.m, f = vo.from, Dr = m.d - (vo.LP || 0);
31142
31287
  cursor.group = "f" + f;
31143
31288
  cursor.pc = structurePiece("stairs_" + vo.from + "_" + vo.to);
31144
31289
  const y0 = Y0(f), H = Y0(vo.to) - y0, n = Math.max(8, Math.round(H / 0.18)), c = Math.cos(m.ry), s = Math.sin(m.ry);
31145
- const wood = shared2.ctx.colors.wood != null ? shared2.ctx.colors.wood : 9071176, under = sh(wood, 0.7);
31290
+ const wood = shared3.ctx.colors.wood != null ? shared3.ctx.colors.wood : 9071176, under = sh(wood, 0.7);
31146
31291
  const P = (lx, lz) => [m.x + lx * c + lz * s, m.z - lx * s + lz * c];
31147
31292
  const boxL = (mat, lx, y, lz, w, h, d, color2, rx = 0) => {
31148
31293
  const [px, pz] = P(lx, lz);
@@ -31168,12 +31313,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31168
31313
  }
31169
31314
  }
31170
31315
  function elevator() {
31171
- const R = shared2.ctx.r;
31316
+ const R = shared3.ctx.r;
31172
31317
  for (const c of R.rooms.filter((c2) => c2.type === "elevator" && c2.floor === 0)) {
31173
31318
  cursor.group = "f0";
31174
31319
  const [u0, v0, u1, v1] = rectsOf2(c)[0], y0 = Y0(0);
31175
31320
  bx("metal", u0 + 0.15, y0 + 0.05, v0 + 0.15, u1 - 0.15, y0 + 2.3, v1 - 0.15, 10133670);
31176
- bx("emissive", u0 + 0.3, y0 + 2.28, v0 + 0.3, u1 - 0.3, y0 + 2.3, v1 - 0.3, shared2.ctx.night ? 16773320 : 13619924);
31321
+ bx("emissive", u0 + 0.3, y0 + 2.28, v0 + 0.3, u1 - 0.3, y0 + 2.3, v1 - 0.3, shared3.ctx.night ? 16773320 : 13619924);
31177
31322
  for (const f of R.floors) {
31178
31323
  const yy = Y0(f.index);
31179
31324
  cursor.group = "f" + f.index;
@@ -31184,7 +31329,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31184
31329
  const defined = { buildStairs, elevator };
31185
31330
  Object.assign(K, defined);
31186
31331
  }
31187
- function installLightsFixtures(K, shared2) {
31332
+ function installLightsFixtures(K, shared3) {
31188
31333
  const seedKey = (id) => K.seedKey(id);
31189
31334
  const { cursor, part, polyFace } = K;
31190
31335
  const makeApi = (...a) => K.makeApi(...a);
@@ -31202,9 +31347,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31202
31347
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
31203
31348
  };
31204
31349
  }
31205
- const SEED = () => shared2.ctx.r && shared2.ctx.r.seed || 0;
31206
- const STYLE = () => shared2.ctx.r && shared2.ctx.r.style || "budget";
31207
- shared2.api0 = null;
31350
+ const SEED = () => shared3.ctx.r && shared3.ctx.r.seed || 0;
31351
+ const STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
31352
+ shared3.api0 = null;
31208
31353
  function kit2(M, A, y0 = M.y || 0) {
31209
31354
  const c = Math.cos(M.ry), s = Math.sin(M.ry);
31210
31355
  let api = A;
@@ -31237,7 +31382,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31237
31382
  return null;
31238
31383
  }
31239
31384
  const a0 = api;
31240
- api = shared2.api0 || (shared2.api0 = makeApi());
31385
+ api = shared3.api0 || (shared3.api0 = makeApi());
31241
31386
  try {
31242
31387
  return part(type, W(lx, ly, lz), fn, meta || {}, void 0, M.ry);
31243
31388
  } finally {
@@ -31331,7 +31476,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31331
31476
  yLight = yc - 0.3;
31332
31477
  range3 = 6.5;
31333
31478
  } else if (type === "chandelier") {
31334
- const yc = t - 0.5, gold = shared2.ctx.colors && shared2.ctx.colors.metal != null ? shared2.ctx.colors.metal : 9075290, N = 6;
31479
+ const yc = t - 0.5, gold = shared3.ctx.colors && shared3.ctx.colors.metal != null ? shared3.ctx.colors.metal : 9075290, N = 6;
31335
31480
  K2.c("metal", 0, yc, 0, 0.012, 0.5, gold);
31336
31481
  K2.e("metal", 0, yc - 0.03, 0, 0.055, 0.08, gold);
31337
31482
  K2.c("metal", 0, yc - 0.06, 0, 0.14, 0.015, gold);
@@ -31410,24 +31555,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31410
31555
  const defined = { hashString, rngString, SEED, STYLE, kit2, arcPoints, TEMP_WARM, TEMP_NEUTRAL, TEMP_COOL, colorTemperature, lightStyle, ceilingLamp, tableLamp, floorLamp, sconce, outdoorLamp, lightSwitch };
31411
31556
  Object.assign(K, defined);
31412
31557
  }
31413
- function installLightsDecor(K, shared2) {
31558
+ function installLightsDecor(K, shared3) {
31414
31559
  const { EPS: EPS6, OPEN_AREA, SEED, Y0, cursor, rngString, roomAt, stairFootprint } = K;
31415
31560
  const lightItem = (...a) => K.lightItem(...a);
31416
31561
  function decorLights(api) {
31417
- const R = shared2.ctx.r, T2 = shared2.ctx.types, structure = R.style, chance = structure === "budget" ? 0.35 : structure === "mid" ? 0.75 : 1, rnd2 = rngString(SEED() + "|decorluz");
31562
+ const R = shared3.ctx.r, T2 = shared3.ctx.types, structure = R.style, chance = structure === "budget" ? 0.35 : structure === "mid" ? 0.75 : 1, rnd2 = rngString(SEED() + "|decorluz");
31418
31563
  const itemsF = (f) => R.items.filter((m) => (m.outdoor ? -1 : m.floor) === f && m.type !== "stairs");
31419
31564
  const rectsF = (f) => itemsF(f).filter((m) => (m.h || 0) > 0.3 && !/rug|floor|concrete|dirt|lawn|ceiling_light|curtain|blinds|picture|mirror|pendant|chandelier|spot/.test(m.type)).map((m) => stairFootprint(m));
31420
31565
  const free = (f, x, z, margin) => {
31421
31566
  if (!roomAt(f, x, z)) return false;
31422
- for (const c of shared2.ctx.colliders) if (c.f === f && x > c.x0 - margin && x < c.x1 + margin && z > c.z0 - margin && z < c.z1 + margin) return false;
31567
+ for (const c of shared3.ctx.colliders) if (c.f === f && x > c.x0 - margin && x < c.x1 + margin && z > c.z0 - margin && z < c.z1 + margin) return false;
31423
31568
  for (const r of rectsF(f)) if (x > r[0] - margin && x < r[2] + margin && z > r[1] - margin && z < r[3] + margin) return false;
31424
31569
  return true;
31425
31570
  };
31426
31571
  const puts = (f, type, m0, extra) => {
31427
31572
  const ent = T2[type];
31428
31573
  if (!ent) return;
31429
- const com = shared2.ctx.roomById[m0.room], g = "f" + f, base = Y0(f);
31430
- const M = Object.assign({ x: m0.x, z: m0.z, ry: m0.ry || 0, w: m0.w || 0.3, d: m0.d || 0.3, h: m0.h || 0.3, y: 0, base, floor: f, colors: shared2.ctx.colors, seed: m0.id, room: m0.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.8, on: shared2.ctx.night, light: shared2.ctx.night, lit: shared2.ctx.night }, extra || {});
31574
+ const com = shared3.ctx.roomById[m0.room], g = "f" + f, base = Y0(f);
31575
+ const M = Object.assign({ x: m0.x, z: m0.z, ry: m0.ry || 0, w: m0.w || 0.3, d: m0.d || 0.3, h: m0.h || 0.3, y: 0, base, floor: f, colors: shared3.ctx.colors, seed: m0.id, room: m0.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.8, on: shared3.ctx.night, light: shared3.ctx.night, lit: shared3.ctx.night }, extra || {});
31431
31576
  cursor.group = g;
31432
31577
  lightItem({ id: m0.id, room: m0.room }, M, ent, api, g);
31433
31578
  };
@@ -31476,18 +31621,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31476
31621
  const defined = { decorLights };
31477
31622
  Object.assign(K, defined);
31478
31623
  }
31479
- function installLotTerrain(K, shared2) {
31624
+ function installLotTerrain(K, shared3) {
31480
31625
  const { rectsOf: rectsOf2, MIRRORS, PARTS, bx, cursor } = K;
31481
31626
  function terrain() {
31482
31627
  PARTS.length = 0;
31483
31628
  MIRRORS.length = 0;
31484
31629
  K.CARS.length = 0;
31485
- shared2.partCount = 0;
31486
- shared2.ctx.parts = {};
31487
- shared2.tapCount = 0;
31488
- shared2.ctx.clotheslines = [];
31489
- if (shared2.ctx.noTerrain) return;
31490
- const R = shared2.ctx.r, lt2 = R.lot, C = shared2.ctx.colors;
31630
+ shared3.partCount = 0;
31631
+ shared3.ctx.parts = {};
31632
+ shared3.tapCount = 0;
31633
+ shared3.ctx.clotheslines = [];
31634
+ if (shared3.ctx.noTerrain) return;
31635
+ const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
31491
31636
  cursor.group = "floor";
31492
31637
  const light = (c, f) => {
31493
31638
  const m = (k) => Math.round((c >> k & 255) * (1 - f) + 255 * f);
@@ -31501,13 +31646,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31501
31646
  bx("sidewalk", u0 - 40, -0.06, v0 - 1.8, u1 + 40, 0.02, v0, 14999766);
31502
31647
  for (let x = u0 - 38; x < u1 + 40; x += 6) bx("plaster", x, 0, v0 - 5.6, x + 2.6, 5e-3, v0 - 5.4, 15262904);
31503
31648
  } else {
31504
- const b = shared2.ctx.limits;
31649
+ const b = shared3.ctx.limits;
31505
31650
  bx("sidewalk", b.x0 - 6, -0.09, b.z0 - 6, b.x1 + 6, -0.03, b.z1 + 6, 14605010);
31506
31651
  }
31507
31652
  }
31508
31653
  function freeSpans(alongU, L, a, b) {
31509
31654
  const blocks = [];
31510
- for (const c of shared2.ctx.r.rooms) {
31655
+ for (const c of shared3.ctx.r.rooms) {
31511
31656
  if (c.type === "void" || c.floor < 0) continue;
31512
31657
  for (const [u0, v0, u1, v1] of rectsOf2(c)) {
31513
31658
  const c0 = alongU ? v0 : u0, c1 = alongU ? v1 : u1, lo = alongU ? u0 : v0, hi = alongU ? u1 : v1;
@@ -31528,12 +31673,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31528
31673
  const defined = { terrain, freeSpans };
31529
31674
  Object.assign(K, defined);
31530
31675
  }
31531
- function installLotPerimeter(K, shared2) {
31676
+ function installLotPerimeter(K, shared3) {
31532
31677
  const { EPS: EPS6, boxC, bx, colorOf, cursor, freeSpans, pieceRecord } = K;
31533
31678
  const makeApi = (...a) => K.makeApi(...a);
31534
31679
  const sh = (...a) => K.sh(...a);
31535
31680
  function perimeter() {
31536
- const R = shared2.ctx.r, lt2 = R.lot, C = shared2.ctx.colors;
31681
+ const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
31537
31682
  if (!lt2) return;
31538
31683
  cursor.group = "lot";
31539
31684
  const rnd2 = /* @__PURE__ */ (() => {
@@ -31547,7 +31692,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31547
31692
  const th = s.thickness || 0.15, h = s.height, color2 = colorOf(s.color) ?? (C.wall || 12104874), len = b - a;
31548
31693
  const B = (mat, u0, y0, u1, y1, t, c, off = 0) => alongU ? bx(mat, u0, y0, L + off - t / 2, u1, y1, L + off + t / 2, c) : bx(mat, L + off - t / 2, y0, u0, L + off + t / 2, y1, u1, c);
31549
31694
  const col = { type: "lot_wall", f: -1, x0: alongU ? a : L - th / 2, z0: alongU ? L - th / 2 : a, x1: alongU ? b : L + th / 2, z1: alongU ? L + th / 2 : b };
31550
- shared2.ctx.colliders.push(col);
31695
+ shared3.ctx.colliders.push(col);
31551
31696
  if (s.type === "wall") {
31552
31697
  B("plaster", a, 0, b, h, th, color2);
31553
31698
  B("plaster", a, h, b, h + 0.05, th + 0.06, sh(color2, 1.15));
@@ -31586,7 +31731,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31586
31731
  const w2 = x1 - x0, cm = (x0 + x1) / 2;
31587
31732
  const M = top === "razor_wire" ? { x: alongU ? cm : L, z: alongU ? L : cm, ry: alongU ? 0 : K.PE, w: w2, d: 0.4, h: 0.4, y: ym, base: 0, floor: -1, colors: C, seed: s.id } : { x: alongU ? cm : L, z: alongU ? L : cm, ry: alongU ? 0 : K.PE, w: w2, d: 0.1, h: 0.3, y: 0, base: ym, floor: -1, colors: C, seed: s.id };
31588
31733
  try {
31589
- shared2.ctx.mv.builders[top](M, api);
31734
+ shared3.ctx.mv.builders[top](M, api);
31590
31735
  } catch (e) {
31591
31736
  console.warn(e);
31592
31737
  }
@@ -31607,7 +31752,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31607
31752
  }
31608
31753
  }
31609
31754
  function paths() {
31610
- const lt2 = shared2.ctx.r.lot;
31755
+ const lt2 = shared3.ctx.r.lot;
31611
31756
  if (!lt2 || !lt2.paths) return;
31612
31757
  cursor.group = "lot";
31613
31758
  for (const c of lt2.paths) {
@@ -31621,14 +31766,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31621
31766
  const defined = { perimeter, paths };
31622
31767
  Object.assign(K, defined);
31623
31768
  }
31624
- function installLotGates(K, shared2) {
31769
+ function installLotGates(K, shared3) {
31625
31770
  const { bx, colorOf, cursor, cylBase } = K;
31626
31771
  const sh = (...a) => K.sh(...a);
31627
31772
  function slideDirection(g, lt2) {
31628
31773
  return g.u + g.width / 2 + g.width + 1.2 <= lt2.rect[2] ? 1 : -1;
31629
31774
  }
31630
31775
  function gates() {
31631
- const R = shared2.ctx.r, lt2 = R.lot, C = shared2.ctx.colors;
31776
+ const R = shared3.ctx.r, lt2 = R.lot, C = shared3.ctx.colors;
31632
31777
  if (!lt2) return;
31633
31778
  cursor.group = "lot";
31634
31779
  const structure = R.style, auto = structure !== "budget", wall = colorOf("wall") || 12104874, cu = (lt2.rect[0] + lt2.rect[2]) / 2, cz = (lt2.rect[1] + lt2.rect[3]) / 2;
@@ -31702,13 +31847,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31702
31847
  bx("emissive", mx + 0.1, 0.28, zc + sd * 0.452, mx + 0.14, 0.31, zc + sd * 0.455, 6479994);
31703
31848
  }
31704
31849
  }
31705
- if (!g.open || ped) shared2.ctx.colliders.push({ type: "gate", f: -1, x0: a, z0: v - 0.1, x1: b, z1: v + 0.1 });
31850
+ if (!g.open || ped) shared3.ctx.colliders.push({ type: "gate", f: -1, x0: a, z0: v - 0.1, x1: b, z1: v + 0.1 });
31706
31851
  }
31707
31852
  }
31708
31853
  const defined = { slideDirection, gates };
31709
31854
  Object.assign(K, defined);
31710
31855
  }
31711
- function installRoofRoofs(K, shared2) {
31856
+ function installRoofRoofs(K, shared3) {
31712
31857
  const { rectsOf: rectsOf2, EPS: EPS6, OPEN_AREA, Y0, bx, cursor } = K;
31713
31858
  const gutter = (...a) => K.gutter(...a);
31714
31859
  const gutterConfig = (...a) => K.gutterConfig(...a);
@@ -31716,14 +31861,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31716
31861
  const sh = (...a) => K.sh(...a);
31717
31862
  const slabs = (...a) => K.slabs(...a);
31718
31863
  function roofs() {
31719
- const R = shared2.ctx.r, F = R.facade, C = shared2.ctx.colors, nA = R.floors.length, type = F.roof;
31864
+ const R = shared3.ctx.r, F = R.facade, C = shared3.ctx.colors, nA = R.floors.length, type = F.roof;
31720
31865
  cursor.group = "roof";
31721
- const roofRects = shared2.ctx.roofRects = [];
31722
- const G = shared2.ctx.gutter = gutterConfig();
31866
+ const roofRects = shared3.ctx.roofRects = [];
31867
+ const G = shared3.ctx.gutter = gutterConfig();
31723
31868
  G.ncond = 0;
31724
31869
  G.nbuz = 0;
31725
31870
  G.bz = /* @__PURE__ */ new Set();
31726
- shared2.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] };
31871
+ shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] };
31727
31872
  const roofColor = C.roof != null ? C.roof : 11031610, gable = (Number(R.seed) | 0) % 2 === 0;
31728
31873
  for (let f = 0; f < nA; f++) {
31729
31874
  const rs = R.rooms.filter((c) => c.floor === f && c.type !== "void" && !c.outbuilding && !OPEN_AREA(c)).flatMap(rectsOf2), up = R.rooms.filter((c) => c.floor === f + 1 && c.type !== "void").flatMap(rectsOf2);
@@ -31776,7 +31921,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31776
31921
  if (G.on) gutter(type, f, x0, z0, x1, z1, ybq, touchesU);
31777
31922
  }
31778
31923
  }
31779
- for (const e of shared2.ctx.outbuildingList || []) {
31924
+ for (const e of shared3.ctx.outbuildingList || []) {
31780
31925
  const [x0, z0, x1, z1] = e.aabb, yb = Y0(0) + (e.ceiling || 2.6) + 0.2;
31781
31926
  roofRects.push({ f: 0, r: [x0, z0, x1, z1], outbuilding: e.id });
31782
31927
  if (type === "slab") {
@@ -31785,10 +31930,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31785
31930
  for (const [a, b, c2, d] of [[x0 - 0.08, z0 - 0.08, x1 + 0.08, z0 - 0.04], [x0 - 0.08, z1 + 0.04, x1 + 0.08, z1 + 0.08], [x0 - 0.08, z0 - 0.08, x0 - 0.04, z1 + 0.08], [x1 + 0.04, z0 - 0.08, x1 + 0.08, z1 + 0.08]]) bx("plaster", a, yb, b, c2, yb + 0.4, d, c);
31786
31931
  continue;
31787
31932
  }
31788
- shared2.ctx.noPiece = true;
31933
+ shared3.ctx.noPiece = true;
31789
31934
  roofRect(type, x0, z0, x1, z1, yb, roofColor, true, F, [0, 0, 0, 0]);
31790
31935
  cursor.pc = null;
31791
- shared2.ctx.noPiece = false;
31936
+ shared3.ctx.noPiece = false;
31792
31937
  if (G.on) gutter(type, 0, x0, z0, x1, z1, yb, [0, 0, 0, 0]);
31793
31938
  }
31794
31939
  }
@@ -31796,11 +31941,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31796
31941
  Object.assign(K, defined);
31797
31942
  }
31798
31943
  var paletteMeta = (colors) => colors.meta;
31799
- function installRoofGutters(K, shared2) {
31944
+ function installRoofGutters(K, shared3) {
31800
31945
  const { boxC, bx, cursor, roomAt } = K;
31801
31946
  const sh = (...a) => K.sh(...a);
31802
31947
  function gutterConfig() {
31803
- const R = shared2.ctx.r, structure = R.style, high = structure === "high" || structure === "luxury", p = high || structure === "mid" ? 0.6 : 0.3;
31948
+ const R = shared3.ctx.r, structure = R.style, high = structure === "high" || structure === "luxury", p = high || structure === "mid" ? 0.6 : 0.3;
31804
31949
  let h = 2166136261;
31805
31950
  for (const ch of String(R.seed) + "|" + K.seedKey(R.template) + "|calha") h = Math.imul(h ^ ch.charCodeAt(0), 16777619);
31806
31951
  const rnd2 = () => {
@@ -31812,10 +31957,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31812
31957
  const draw2 = rnd2() < p, light = rnd2() < 0.6;
31813
31958
  void draw2;
31814
31959
  const on = true;
31815
- return { on, rnd: rnd2, color: high ? 3816770 : light ? 15527921 : 10857392, bad: paletteMeta(shared2.ctx.colors)?.state === "abandoned" || R.state === "abandoned", fallback: false };
31960
+ return { on, rnd: rnd2, color: high ? 3816770 : light ? 15527921 : 10857392, bad: paletteMeta(shared3.ctx.colors)?.state === "abandoned" || R.state === "abandoned", fallback: false };
31816
31961
  }
31817
31962
  function gutter(type, f, X0, Z0, X1, Z1, yb, touchesU) {
31818
- const G = shared2.ctx.gutter, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), c = G.color, y = yb - 0.05;
31963
+ const G = shared3.ctx.gutter, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), c = G.color, y = yb - 0.05;
31819
31964
  const run = (ax, a, b, p, outside, breaks) => {
31820
31965
  const seg2 = (u0, u1, tilt) => {
31821
31966
  const L = u1 - u0, m = (u0 + u1) / 2, dy = tilt ? -Math.abs(tilt) * L * 0.5 : 0;
@@ -31839,7 +31984,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31839
31984
  sides.forEach((l, i) => {
31840
31985
  if (l[0]) run(l[1], l[2], l[3], l[4], l[5], G.bad && !G.fallback && i === larger && (G.fallback = true));
31841
31986
  });
31842
- const INF = shared2.ctx.gutterInfo || (shared2.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] });
31987
+ const INF = shared3.ctx.gutterInfo || (shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] });
31843
31988
  sides.forEach((l, i) => {
31844
31989
  if (l[0]) INF.gutters.push({ f, side: ["z0", "z1", "x0", "x1"][i], axis: l[1], a: l[2], b: l[3], p: l[4], y });
31845
31990
  });
@@ -31902,7 +32047,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31902
32047
  const defined = { gutterConfig, gutter, drain };
31903
32048
  Object.assign(K, defined);
31904
32049
  }
31905
- function installRoofSlabs(K, shared2) {
32050
+ function installRoofSlabs(K, shared3) {
31906
32051
  const { boxC, bx, cursor, drain, roomAt, structurePiece } = K;
31907
32052
  const sh = (...a) => K.sh(...a);
31908
32053
  function slabs(f, xs, zs, O, U, nx, nz, full, pe, C) {
@@ -31932,7 +32077,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31932
32077
  side(free(j, i + 1), x1 + o - t, z0 - ez0, x1 + o, z1 + ez1);
31933
32078
  side(free(j - 1, i), x0 - ex0, z0 - o, x1 + ex1, z0 - o + t);
31934
32079
  side(free(j + 1, i), x0 - ex0, z1 + o - t, x1 + ex1, z1 + o);
31935
- const G = shared2.ctx.gutter;
32080
+ const G = shared3.ctx.gutter;
31936
32081
  if (G && G.on && G.bz) for (const [ok, dx, dz] of [[free(j - 1, i), 0, -1], [free(j + 1, i), 0, 1], [free(j, i - 1), -1, 0], [free(j, i + 1), 1, 0]]) {
31937
32082
  const kd = f + ":" + dx + ":" + dz;
31938
32083
  if (!ok || G.bz.has(kd)) continue;
@@ -31954,8 +32099,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31954
32099
  boxC("plain", tx, 0.9, tz, 0.12, 0.04, 0.12, sh(cc, 0.8));
31955
32100
  const rx = tx + dx * 0.24, rz = tz + dz * 0.24;
31956
32101
  drain(rx, rz, tx, tz, cc);
31957
- (shared2.ctx.gutterInfo || (shared2.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] })).downpipes.push({ f, x: tx, z: tz, y0: 0.045, y1: yb + 0.04, drain: [rx, rz], hornBox: true });
31958
- shared2.ctx.gutterInfo.drains.push({ x: rx, z: rz });
32102
+ (shared3.ctx.gutterInfo || (shared3.ctx.gutterInfo = { gutters: [], downpipes: [], drains: [] })).downpipes.push({ f, x: tx, z: tz, y0: 0.045, y1: yb + 0.04, drain: [rx, rz], hornBox: true });
32103
+ shared3.ctx.gutterInfo.drains.push({ x: rx, z: rz });
31959
32104
  }
31960
32105
  }
31961
32106
  }
@@ -31964,10 +32109,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31964
32109
  const defined = { slabs };
31965
32110
  Object.assign(K, defined);
31966
32111
  }
31967
- function installRoofTiles(K, shared2) {
32112
+ function installRoofTiles(K, shared3) {
31968
32113
  const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
31969
32114
  const sh = (...a) => K.sh(...a);
31970
- const R_STYLE = () => shared2.ctx.r && shared2.ctx.r.style || "budget";
32115
+ const R_STYLE = () => shared3.ctx.r && shared3.ctx.r.style || "budget";
31971
32116
  function tileRelief(mat, pts, color2, type) {
31972
32117
  const n = pts.length;
31973
32118
  if (n < 3) return;
@@ -32008,7 +32153,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32008
32153
  S.push(rx * ex + ry * ey + rz * ez);
32009
32154
  T2.push(rx * dx + ry * dy + rz * dz);
32010
32155
  }
32011
- const colonial = type !== "fiber_cement", P = colonial ? 0.2 : 0.177, A = colonial ? 0.032 : 0.0255, seg2 = shared2.quality === "game" ? colonial ? 4 : 4 : colonial ? 8 : 6, h = P / seg2;
32156
+ const colonial = type !== "fiber_cement", P = colonial ? 0.2 : 0.177, A = colonial ? 0.032 : 0.0255, seg2 = shared3.quality === "game" ? colonial ? 4 : 4 : colonial ? 8 : 6, h = P / seg2;
32012
32157
  const smin = Math.min(...S), smax = Math.max(...S);
32013
32158
  if (smax - smin < 1e-4) return;
32014
32159
  const xs = new Set(S.map((v) => +v.toFixed(5)));
@@ -32080,9 +32225,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32080
32225
  }
32081
32226
  }
32082
32227
  function pieceOfPane(x, z) {
32083
- if (shared2.ctx.noPiece || !shared2.ctx.panes.length) return null;
32228
+ if (shared3.ctx.noPiece || !shared3.ctx.panes.length) return null;
32084
32229
  let m = null, md = 1e9;
32085
- for (const a of shared2.ctx.panes) {
32230
+ for (const a of shared3.ctx.panes) {
32086
32231
  const b = a.aabb;
32087
32232
  if (!b) continue;
32088
32233
  const dx = x < b[0] ? b[0] - x : x > b[2] ? x - b[2] : 0, dz = z < b[1] ? b[1] - z : z > b[3] ? z - b[3] : 0, d = Math.hypot(dx, dz) * 1e3 + (b[2] - b[0]) * (b[3] - b[1]) * 1e-3;
@@ -32096,11 +32241,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32096
32241
  const defined = { R_STYLE, tileRelief, ridge, pieceOfPane };
32097
32242
  Object.assign(K, defined);
32098
32243
  }
32099
- function installRoofRect(K, shared2) {
32244
+ function installRoofRect(K, shared3) {
32100
32245
  const { R_STYLE, bx, cursor, pieceOfPane, polyFace, ridge, tileRelief } = K;
32101
32246
  const sh = (...a) => K.sh(...a);
32102
32247
  function roofRect(type, X0, Z0, X1, Z1, yb, roofColor, gable, F, touchesU = [0, 0, 0, 0]) {
32103
- const C = shared2.ctx.colors, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), dx = x1 - x0, dz = z1 - z0, xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
32248
+ const C = shared3.ctx.colors, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), dx = x1 - x0, dz = z1 - z0, xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
32104
32249
  const mat = type === "fiber_cement" ? "fiber_cement" : "tile", tp = type === "fiber_cement" ? 0.2 : 0.5, alongX = dx >= dz, up = [0, 1, 0];
32105
32250
  const Q = (pts) => {
32106
32251
  let cx = 0, cz = 0;
@@ -32138,7 +32283,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32138
32283
  }
32139
32284
  const rm = alongX ? dz / 2 : dx / 2;
32140
32285
  {
32141
- const roofRects = shared2.ctx.roofRects, rr = roofRects[roofRects.length - 1];
32286
+ const roofRects = shared3.ctx.roofRects, rr = roofRects[roofRects.length - 1];
32142
32287
  if (rr && !rr.yb) Object.assign(rr, { yb, tp, gable: !!gable, alongX, exterior: [x0, z0, x1, z1], rm });
32143
32288
  }
32144
32289
  if (gable) {
@@ -32178,12 +32323,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32178
32323
  const defined = { roofRect };
32179
32324
  Object.assign(K, defined);
32180
32325
  }
32181
- function installMirrors(K, shared2) {
32326
+ function installMirrors(K, shared3) {
32182
32327
  const { DOC, THREE, Reflector, MIRRORS, Y0, _Y, roomAt } = K;
32183
- shared2.mirrorEnv = null;
32184
- shared2.mirrorMat = null;
32328
+ shared3.mirrorEnv = null;
32329
+ shared3.mirrorMat = null;
32185
32330
  function mirrorEnv() {
32186
- if (shared2.mirrorEnv) return shared2.mirrorEnv;
32331
+ if (shared3.mirrorEnv) return shared3.mirrorEnv;
32187
32332
  const mk = (f) => {
32188
32333
  if (!DOC) throw new Error("game-floorplan-three: the mirrors need a document (options.document)");
32189
32334
  const c = DOC.createElement("canvas");
@@ -32221,18 +32366,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32221
32366
  const t = new THREE.CubeTexture(faces);
32222
32367
  t.colorSpace = THREE.SRGBColorSpace;
32223
32368
  t.needsUpdate = true;
32224
- shared2.mirrorEnv = t;
32225
- shared2.mirrorMat = new THREE.MeshStandardMaterial({ color: 16054008, metalness: 1, roughness: 0.06, envMap: t, envMapIntensity: 1 });
32369
+ shared3.mirrorEnv = t;
32370
+ shared3.mirrorMat = new THREE.MeshStandardMaterial({ color: 16054008, metalness: 1, roughness: 0.06, envMap: t, envMapIntensity: 1 });
32226
32371
  return t;
32227
32372
  }
32228
32373
  const newMirrorState = () => ({ list: [], active: null, tmp: new THREE.Vector3(), house: null });
32229
- shared2.mirrors = newMirrorState();
32374
+ shared3.mirrors = newMirrorState();
32230
32375
  function assembleMirrors(groups) {
32231
- shared2.mirrors.list.length = 0;
32232
- shared2.mirrors.active = null;
32376
+ shared3.mirrors.list.length = 0;
32377
+ shared3.mirrors.active = null;
32233
32378
  if (!MIRRORS.length) return;
32234
32379
  mirrorEnv();
32235
- if (shared2.quality === "game" || !Reflector) {
32380
+ if (shared3.quality === "game" || !Reflector) {
32236
32381
  const by = /* @__PURE__ */ new Map(), m4 = new THREE.Matrix4(), qy = new THREE.Quaternion(), um = new THREE.Vector3(1, 1, 1), ps = new THREE.Vector3(), nm = new THREE.Matrix3(), v = new THREE.Vector3();
32237
32382
  for (const E of MIRRORS) {
32238
32383
  const geo = new THREE.PlaneGeometry(E.w, E.h);
@@ -32259,7 +32404,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32259
32404
  g.setAttribute("uv", new THREE.Float32BufferAttribute(B.U, 2));
32260
32405
  g.setIndex(B.I);
32261
32406
  g.computeBoundingSphere();
32262
- const m = new THREE.Mesh(g, shared2.mirrorMat);
32407
+ const m = new THREE.Mesh(g, shared3.mirrorMat);
32263
32408
  m.name = "mirror/environment";
32264
32409
  m.userData.part = "mirror";
32265
32410
  (groups[parent] || (groups[parent] = new THREE.Group())).add(m);
@@ -32274,7 +32419,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32274
32419
  g.userData.part = "mirror";
32275
32420
  g.userData.room = E.room;
32276
32421
  const geo = new THREE.PlaneGeometry(E.w, E.h);
32277
- const fake = new THREE.Mesh(geo, shared2.mirrorMat);
32422
+ const fake = new THREE.Mesh(geo, shared3.mirrorMat);
32278
32423
  fake.userData.part = "mirror";
32279
32424
  fake.name = "mirror/environment";
32280
32425
  g.add(fake);
@@ -32290,27 +32435,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32290
32435
  console.warn("mirror real", e);
32291
32436
  }
32292
32437
  (groups[E.parent] || (groups[E.parent] = new THREE.Group())).add(g);
32293
- shared2.mirrors.list.push({ E, g, fake, real });
32438
+ shared3.mirrors.list.push({ E, g, fake, real });
32294
32439
  }
32295
32440
  }
32296
32441
  function floorAtY(y) {
32297
- const A = shared2.ctx.r.floors;
32442
+ const A = shared3.ctx.r.floors;
32298
32443
  let f = 0;
32299
32444
  for (let i = 0; i < A.length; i++) if (y >= A[i].y0 - 0.2) f = i;
32300
32445
  return f;
32301
32446
  }
32302
32447
  function chooseMirror(camera2) {
32303
- if (!shared2.mirrors.list.length) return;
32448
+ if (!shared3.mirrors.list.length) return;
32304
32449
  let target = null;
32305
- if (shared2.mirrors.house && shared2.ctx.r) {
32306
- shared2.mirrors.tmp.copy(camera2.position);
32307
- shared2.mirrors.house.worldToLocal(shared2.mirrors.tmp);
32308
- const f = floorAtY(shared2.mirrors.tmp.y), c = roomAt(f, shared2.mirrors.tmp.x, shared2.mirrors.tmp.z);
32309
- if (c && shared2.mirrors.tmp.y > Y0(f) && shared2.mirrors.tmp.y < Y0(f) + 4) {
32450
+ if (shared3.mirrors.house && shared3.ctx.r) {
32451
+ shared3.mirrors.tmp.copy(camera2.position);
32452
+ shared3.mirrors.house.worldToLocal(shared3.mirrors.tmp);
32453
+ const f = floorAtY(shared3.mirrors.tmp.y), c = roomAt(f, shared3.mirrors.tmp.x, shared3.mirrors.tmp.z);
32454
+ if (c && shared3.mirrors.tmp.y > Y0(f) && shared3.mirrors.tmp.y < Y0(f) + 4) {
32310
32455
  let best = 1e9;
32311
- for (const m of shared2.mirrors.list) {
32456
+ for (const m of shared3.mirrors.list) {
32312
32457
  if (m.E.room !== c.id || m.E.floor !== f || !m.g.parent || !m.g.parent.visible) continue;
32313
- const d = Math.hypot(m.E.x - shared2.mirrors.tmp.x, m.E.z - shared2.mirrors.tmp.z);
32458
+ const d = Math.hypot(m.E.x - shared3.mirrors.tmp.x, m.E.z - shared3.mirrors.tmp.z);
32314
32459
  if (d < best) {
32315
32460
  best = d;
32316
32461
  target = m;
@@ -32318,9 +32463,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32318
32463
  }
32319
32464
  }
32320
32465
  }
32321
- if (target === shared2.mirrors.active) return;
32322
- shared2.mirrors.active = target;
32323
- for (const m of shared2.mirrors.list) {
32466
+ if (target === shared3.mirrors.active) return;
32467
+ shared3.mirrors.active = target;
32468
+ for (const m of shared3.mirrors.list) {
32324
32469
  const on = m === target && !!m.real;
32325
32470
  if (m.real) m.real.visible = on;
32326
32471
  m.fake.visible = !on;
@@ -32329,7 +32474,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32329
32474
  const defined = { mirrorEnv, newMirrorState, assembleMirrors, floorAtY, chooseMirror };
32330
32475
  Object.assign(K, defined);
32331
32476
  }
32332
- function installCars(K, shared2) {
32477
+ function installCars(K, shared3) {
32333
32478
  const { THREE, FLEET, _Y } = K;
32334
32479
  const CARS = [];
32335
32480
  const CAR_BY_STYLE = Object.assign({
@@ -32358,12 +32503,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32358
32503
  return b;
32359
32504
  }
32360
32505
  function carModel(k, seed) {
32361
- const kc = k + "|" + shared2.quality + "|" + (seed || 0);
32506
+ const kc = k + "|" + shared3.quality + "|" + (seed || 0);
32362
32507
  if (CAR_CACHE.has(kc)) return CAR_CACHE.get(kc) ?? null;
32363
32508
  if (!FLEET) return null;
32364
32509
  let res = null;
32365
32510
  try {
32366
- const v0 = FLEET.build(k, { quality: shared2.quality, seed: seed || 0 }), c = { root: v0.group, g: v0.group };
32511
+ const v0 = FLEET.build(k, { quality: shared3.quality, seed: seed || 0 }), c = { root: v0.group, g: v0.group };
32367
32512
  c.root.updateMatrixWorld(true);
32368
32513
  const inv = new THREE.Matrix4();
32369
32514
  const byMaterial = /* @__PURE__ */ new Map(), tmp = new THREE.Matrix4(), v = new THREE.Vector3(), nm = new THREE.Matrix3(), bb = new THREE.Box3();
@@ -32485,7 +32630,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32485
32630
  return g;
32486
32631
  }
32487
32632
  function assembleCars(groups) {
32488
- if (shared2.quality === "game") {
32633
+ if (shared3.quality === "game") {
32489
32634
  assembleMergedCars(groups);
32490
32635
  return;
32491
32636
  }
@@ -32542,10 +32687,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32542
32687
  const defined = { CARS, CAR_BY_STYLE, CAR_CACHE, materialSignature, BUCKETS, bucketMaterial, carModel, carGroup, assembleCars, assembleMergedCars };
32543
32688
  Object.assign(K, defined);
32544
32689
  }
32545
- function installHouseBuilding(K, shared2) {
32690
+ function installHouseBuilding(K, shared3) {
32546
32691
  const { bx, cursor } = K;
32547
32692
  function building() {
32548
- const R = shared2.ctx.r, P = R.building, C = shared2.ctx.colors, N = shared2.ctx.pa, uf = shared2.ctx.pf, pe = P.ceilingHeight, fa = C.facade != null ? C.facade : 14209216;
32693
+ const R = shared3.ctx.r, P = R.building, C = shared3.ctx.colors, N = shared3.ctx.pa, uf = shared3.ctx.pf, pe = P.ceilingHeight, fa = C.facade != null ? C.facade : 14209216;
32549
32694
  cursor.group = "building";
32550
32695
  const uw = P.unit.w, ud = P.unit.d, un = P.units;
32551
32696
  const unitBox = (u) => {
@@ -32553,7 +32698,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32553
32698
  return [x[0], z[0], x[1], z[1]];
32554
32699
  };
32555
32700
  const un0 = unitBox(un[0]), color2 = P.corridor, hall = P.hall, el = P.elevator.rect, es = P.stairs.rect;
32556
- const sel = un[shared2.ctx.pu] || un[0], selR = unitBox(sel);
32701
+ const sel = un[shared3.ctx.pu] || un[0], selR = unitBox(sel);
32557
32702
  const shell = (rc, y0, y1, thickness = 0.15) => {
32558
32703
  const [a, b, c, d] = rc;
32559
32704
  bx("building", a, y0, b, c, y1, b + thickness, fa);
@@ -32592,12 +32737,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32592
32737
  }
32593
32738
  const ytop = N * pe - 0.2;
32594
32739
  bx("plaster", Math.min(hall[0] - 3, color2[0]), ytop, Math.min(un[1] ? unitBox(un[1])[1] : 0, el[1]), Math.max(color2[2], un0[2]), ytop + 0.2, Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0), 11841704);
32595
- shared2.ctx.limits = { x0: Math.min(hall[0] - 3, color2[0]), z0: Math.min(el[1], un[1] ? unitBox(un[1])[1] : 0), x1: Math.max(color2[2], un0[2]), z1: Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0) };
32740
+ shared3.ctx.limits = { x0: Math.min(hall[0] - 3, color2[0]), z0: Math.min(el[1], un[1] ? unitBox(un[1])[1] : 0), x1: Math.max(color2[2], un0[2]), z1: Math.max(un0[3], un[1] ? unitBox(un[1])[3] : 0) };
32596
32741
  }
32597
32742
  const defined = { building };
32598
32743
  Object.assign(K, defined);
32599
32744
  }
32600
- function installUtilitiesWater(K, shared2) {
32745
+ function installUtilitiesWater(K, shared3) {
32601
32746
  const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
32602
32747
  function createWater(r, state) {
32603
32748
  const H = r.utilities?.plumbing, cap = H ? +H.capacityL || 0 : 0, ls = { dry: [], full: [] }, points = {}, itemPoint = {};
@@ -32689,14 +32834,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32689
32834
  }
32690
32835
  const _v3 = new THREE.Vector3();
32691
32836
  function waterPipes() {
32692
- const H = shared2.ctx.r.utilities?.plumbing;
32837
+ const H = shared3.ctx.r.utilities?.plumbing;
32693
32838
  if (!H || !H.visibleRuns) return;
32694
- const nA = shared2.ctx.r.floors.length;
32839
+ const nA = shared3.ctx.r.floors.length;
32695
32840
  const groupOf = (c) => c && c.floor >= 0 ? "f" + Math.min(c.floor, nA - 1) : "lot", xyz = (p) => [p[0], p[2], p[1]];
32696
32841
  for (const tr of H.visibleRuns) {
32697
32842
  const pts = tr.points.map(xyz), d = tr.diameter || 0.025;
32698
32843
  if (tr.exposed === "wall") {
32699
- const pt = H.points.find((p) => p.run === tr.id), com = tr.to != null ? shared2.ctx.roomById[tr.to] : void 0, g2 = groupOf(com || pt && { floor: pt.floor });
32844
+ const pt = H.points.find((p) => p.run === tr.id), com = tr.to != null ? shared3.ctx.roomById[tr.to] : void 0, g2 = groupOf(com || pt && { floor: pt.floor });
32700
32845
  part("wall_pipe", [0, 0, 0], () => {
32701
32846
  for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
32702
32847
  for (const p of pts) cylBase("plain", p[0], p[1] - d, p[2], d * 0.7, d * 2, PIPE_COLOR);
@@ -32704,7 +32849,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32704
32849
  continue;
32705
32850
  }
32706
32851
  let g;
32707
- if (tr.exposed === "tank_outlet") g = shared2.ctx.waterTankPos && shared2.ctx.waterTankPos.group || "f0";
32852
+ if (tr.exposed === "tank_outlet") g = shared3.ctx.waterTankPos && shared3.ctx.waterTankPos.group || "f0";
32708
32853
  else {
32709
32854
  const pt = H.points.find((p) => p.id === tr.to);
32710
32855
  g = groupOf(pt);
@@ -32721,15 +32866,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32721
32866
  const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
32722
32867
  Object.assign(K, defined);
32723
32868
  }
32724
- function installUtilitiesElectrical(K, shared2) {
32869
+ function installUtilitiesElectrical(K, shared3) {
32725
32870
  const { _Y, _q, _v3, bx, cursor, cylBase, pieceRecord, put } = K;
32726
32871
  const sh = (...a) => K.sh(...a);
32727
32872
  function electricalStructure() {
32728
- const R = shared2.ctx.r, E = R.utilities?.electrical;
32729
- shared2.ctx.electricalInfo = null;
32873
+ const R = shared3.ctx.r, E = R.utilities?.electrical;
32874
+ shared3.ctx.electricalInfo = null;
32730
32875
  if (!E) return;
32731
32876
  const nA = R.floors.length, lotGroup = R.lot ? "lot" : "f0", concreteColor = 11973547, iron = 4869200, wireRun = 1842206, info = { pole: null, meter: null, panel: null, conduits: [], outlets: [], switches: [], circuits: E.circuits || [], exposed: !!E.exposed };
32732
- const en22 = E.serviceEntrance, KV = shared2.ctx.iv ? shared2.ctx.iv.plane : null;
32877
+ const en22 = E.serviceEntrance, KV = shared3.ctx.iv ? shared3.ctx.iv.plane : null;
32733
32878
  const wireL = (a, b, r_ = 8e-3) => {
32734
32879
  const L = Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
32735
32880
  if (L < 1e-3) return;
@@ -32807,7 +32952,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32807
32952
  info.conduits.push(t.id);
32808
32953
  continue;
32809
32954
  }
32810
- const c = circ[t.circuit], com = c && shared2.ctx.roomById[c.room];
32955
+ const c = circ[t.circuit], com = c && shared3.ctx.roomById[c.room];
32811
32956
  cursor.group = "f" + Math.max(0, Math.min(nA - 1, com ? com.floor : 0));
32812
32957
  const d = t.diameter || 0.02, P = t.points.map((p) => [p[0], p[2], p[1]]), seg2 = [];
32813
32958
  for (let i = 0; i + 1 < P.length; i++) {
@@ -32825,7 +32970,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32825
32970
  }
32826
32971
  for (const t of E.outlets || []) info.outlets.push({ id: t.id, pos: [t.u, t.y, t.v], normal: [t.frontU || 0, 0, t.frontV || 0], room: t.room, floor: t.floor, type: t.type, voltage: t.voltage });
32827
32972
  for (const t of E.switches || []) info.switches.push({ id: t.id, pos: [t.u, t.y, t.v], normal: [t.frontU || 0, 0, t.frontV || 0], room: t.room, floor: t.floor, controls: t.controls });
32828
- shared2.ctx.electricalInfo = info;
32973
+ shared3.ctx.electricalInfo = info;
32829
32974
  }
32830
32975
  function pipe2(a, b, diameter, color2) {
32831
32976
  const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], L = Math.hypot(dx, dy, dz);
@@ -32838,11 +32983,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32838
32983
  }
32839
32984
  var BASEBOARD_TILES = { length: 0.6, joint: 3e-3, material: "ceramic", density: 2300 };
32840
32985
  var SIDEWALK_SLABS = { length: 1.2, joint: 0.01, material: "concrete", density: 2400 };
32841
- function installHouseBaseboard(K, shared2) {
32986
+ function installHouseBaseboard(K, shared3) {
32842
32987
  const { Y0, bx, cursor, pieceRecord, sideOf } = K;
32843
32988
  const sh = (...a) => K.sh(...a);
32844
32989
  function baseboardAndSidewalk() {
32845
- const R = shared2.ctx.r, W = 0.6, t = 0.012, ht = 0.35, color2 = sh(shared2.ctx.colors.facade != null ? shared2.ctx.colors.facade : 14209216, 0.62), y0 = Y0(0), cal = 13947078;
32990
+ const R = shared3.ctx.r, W = 0.6, t = 0.012, ht = 0.35, color2 = sh(shared3.ctx.colors.facade != null ? shared3.ctx.colors.facade : 14209216, 0.62), y0 = Y0(0), cal = 13947078;
32846
32991
  const ws = R.walls.filter((w) => w.floor === 0 && w.type === "wall").map((w) => {
32847
32992
  const au = w.axis === "u";
32848
32993
  return { w, au, L: au ? w.v0 : w.u0, a: Math.min(au ? w.u0 : w.v0, au ? w.u1 : w.v1), b: Math.max(au ? w.u0 : w.v0, au ? w.u1 : w.v1), th: w.thickness || 0.15 };
@@ -32875,7 +33020,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32875
33020
  box5(a, b);
32876
33021
  };
32877
33022
  if (!piece2) box5(s0, s1);
32878
- else if (shared2.ctx.baseboardBand) tile(piece2, s0, s1);
33023
+ else if (shared3.ctx.baseboardBand) tile(piece2, s0, s1);
32879
33024
  else {
32880
33025
  const n = Math.max(1, Math.round((s1 - s0) / laid.length)), w = (s1 - s0) / n, j = laid.joint / 2;
32881
33026
  for (let i = 0; i < n; i++) tile(`${piece2}:${i}`, s0 + i * w + (i > 0 ? j : 0), s0 + (i + 1) * w - (i < n - 1 ? j : 0));
@@ -32889,11 +33034,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32889
33034
  const defined = { baseboardAndSidewalk };
32890
33035
  Object.assign(K, defined);
32891
33036
  }
32892
- function installUtilitiesSolar(K, shared2) {
33037
+ function installUtilitiesSolar(K, shared3) {
32893
33038
  const { Y0, boxC, bx, cursor, cylBase } = K;
32894
33039
  function roofHeightAt(u, v, f) {
32895
33040
  let y = null;
32896
- for (const rr of shared2.ctx.roofRects || []) {
33041
+ for (const rr of shared3.ctx.roofRects || []) {
32897
33042
  if (rr.yb == null || f != null && rr.f !== f) continue;
32898
33043
  if (rr.slab) {
32899
33044
  const [a, b, c, d] = rr.r;
@@ -32909,8 +33054,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32909
33054
  return y;
32910
33055
  }
32911
33056
  function solar() {
32912
- const R = shared2.ctx.r, S = R.utilities?.solar;
32913
- shared2.ctx.solarInfo = null;
33057
+ const R = shared3.ctx.r, S = R.utilities?.solar;
33058
+ shared3.ctx.solarInfo = null;
32914
33059
  if (!S || !S.panels || !S.panels.length) return;
32915
33060
  cursor.group = "roof";
32916
33061
  const silver = 13225426, blue = 1780302, line = 9279142, sv = S.north === "front" ? -1 : 1, info = { type: S.type, panels: [], inverter: null }, onRack = S.type === "slab_rack";
@@ -32952,16 +33097,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32952
33097
  bx("plain", iv.u - W * 0.6, y0 + 0.05, iv.v + fa0, iv.u + W * 0.6, y0 + 0.17, iv.v + fa1, 2106924);
32953
33098
  bx("emissive", iv.u - 0.03, y0 - 0.12, iv.v + fa0, iv.u + 0.03, y0 - 0.09, iv.v + fa1, 6479994);
32954
33099
  }
32955
- const top = Math.max(...(shared2.ctx.roofRects || []).flatMap((t2) => t2.yb != null ? [t2.yb] : []), Y0(fa) + 2.8);
33100
+ const top = Math.max(...(shared3.ctx.roofRects || []).flatMap((t2) => t2.yb != null ? [t2.yb] : []), Y0(fa) + 2.8);
32956
33101
  cylBase("plain", iv.u, y0 + h / 2, iv.v, 0.016, Math.max(0.2, top - 0.2 - (y0 + h / 2)), 15262936);
32957
33102
  info.inverter = { id: iv.id, pos: [iv.u, y0, iv.v], side: iv.side, link: iv.link };
32958
33103
  }
32959
- shared2.ctx.solarInfo = info;
33104
+ shared3.ctx.solarInfo = info;
32960
33105
  }
32961
33106
  const defined = { roofHeightAt, solar };
32962
33107
  Object.assign(K, defined);
32963
33108
  }
32964
- function installHouseOutbuildings(K, shared2) {
33109
+ function installHouseOutbuildings(K, shared3) {
32965
33110
  const { t, bx, cursor, floorColor } = K;
32966
33111
  const sh = (...a) => K.sh(...a);
32967
33112
  const OUTBUILDING_USE = { guest_room: ["bedroom", "bedroom", t("outbuilding.guest_room")], office: ["office", "office", t("outbuilding.office")], storage: ["stockroom", "stockroom", t("outbuilding.storage")], gourmet: ["living", "gourmet", t("outbuilding.gourmet")] };
@@ -33008,17 +33153,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
33008
33153
  return Object.assign({}, r, { rooms, walls, doors, windows, items });
33009
33154
  }
33010
33155
  function outbuildings() {
33011
- const E = (shared2.ctx.r.outbuildings || []).filter((e) => shared2.ctx.roomById[e.id] && shared2.ctx.roomById[e.id].outbuilding);
33012
- shared2.ctx.outbuildingList = E;
33156
+ const E = (shared3.ctx.r.outbuildings || []).filter((e) => shared3.ctx.roomById[e.id] && shared3.ctx.roomById[e.id].outbuilding);
33157
+ shared3.ctx.outbuildingList = E;
33013
33158
  if (!E.length) return;
33014
33159
  cursor.group = "f0";
33015
33160
  for (const e of E) {
33016
- const c = shared2.ctx.roomById[e.id], col = floorColor(c);
33161
+ const c = shared3.ctx.roomById[e.id], col = floorColor(c);
33017
33162
  for (const [a, b, c2, d] of e.interior) bx("plaster", a - 0.075, 0, b - 0.075, c2 + 0.075, 0.04, d + 0.075, col);
33018
33163
  for (const p of e.doors || []) {
33019
33164
  const alongU = p.axis === "u", th = e.thickness || 0.15;
33020
- if (alongU) bx("plaster", p.at - p.width / 2, 0, p.pos - th / 2 - 0.12, p.at + p.width / 2, 0.03, p.pos + th / 2 + 0.12, sh(shared2.ctx.colors.facade || 14209216, 0.8));
33021
- else bx("plaster", p.pos - th / 2 - 0.12, 0, p.at - p.width / 2, p.pos + th / 2 + 0.12, 0.03, p.at + p.width / 2, sh(shared2.ctx.colors.facade || 14209216, 0.8));
33165
+ if (alongU) bx("plaster", p.at - p.width / 2, 0, p.pos - th / 2 - 0.12, p.at + p.width / 2, 0.03, p.pos + th / 2 + 0.12, sh(shared3.ctx.colors.facade || 14209216, 0.8));
33166
+ else bx("plaster", p.pos - th / 2 - 0.12, 0, p.at - p.width / 2, p.pos + th / 2 + 0.12, 0.03, p.at + p.width / 2, sh(shared3.ctx.colors.facade || 14209216, 0.8));
33022
33167
  }
33023
33168
  }
33024
33169
  }
@@ -33757,10 +33902,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
33757
33902
  const defined = { typeTable };
33758
33903
  Object.assign(K, defined);
33759
33904
  }
33760
- function installFurnitureTaps(K, shared2) {
33761
- shared2.tapCount = 0;
33905
+ function installFurnitureTaps(K, shared3) {
33906
+ shared3.tapCount = 0;
33762
33907
  function counterTap(K2, x, y, z, reach, back, meta = {}) {
33763
- const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared2.tapCount++;
33908
+ const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++;
33764
33909
  K2.c("metal", x, y, z, 0.028, 0.012, cr);
33765
33910
  K2.c("metal", x, y + 0.012, z, 0.014, 0.12, cr);
33766
33911
  const pts = [];
@@ -33791,7 +33936,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
33791
33936
  return id;
33792
33937
  }
33793
33938
  function wallTap(K2, x, y, zw, direction, back, meta = {}) {
33794
- const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared2.tapCount++, s = direction || 1;
33939
+ const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++, s = direction || 1;
33795
33940
  K2.t("metal", [x, y, zw], [x, y, zw + s * 0.025], 0.03, cr);
33796
33941
  K2.t("metal", [x, y, zw + s * 0.02], [x, y, zw + s * 0.1], 0.016, cr);
33797
33942
  K2.e("metal", x, y, zw + s * 0.105, 0.019, 0.04, cr);
@@ -34043,7 +34188,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34043
34188
  const defined = { GREENS: GREENS2, FLOWERS, blobs, potModel, arcLeaf, tuft, palm_tree, treeModel, shrubModel, potPlant, tablePot, planterModel };
34044
34189
  Object.assign(K, defined);
34045
34190
  }
34046
- function installFurnitureYard(K, shared2) {
34191
+ function installFurnitureYard(K, shared3) {
34047
34192
  const seedKey = (id) => K.seedKey(id);
34048
34193
  const { FURNITURE, SEED, STYLE, kit2, rngString, sh, wallTap } = K;
34049
34194
  FURNITURE.laundry_tub = function(M, A) {
@@ -34133,7 +34278,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34133
34278
  }
34134
34279
  }
34135
34280
  }, { id: "laundry_" + M.seed, swing: true, room: "yard" });
34136
- (shared2.ctx.clotheslines || (shared2.ctx.clotheslines = [])).push(M.seed);
34281
+ (shared3.ctx.clotheslines || (shared3.ctx.clotheslines = [])).push(M.seed);
34137
34282
  };
34138
34283
  FURNITURE.water_tank = function(M, A) {
34139
34284
  const K2 = kit2(M, A), w = M.w || 1, d = M.d || 1, onGround = !M.onSlab && (M.y || 0) < 0.5, color2 = M.palette && M.palette.tank_water != null ? M.palette.tank_water : 3107496, r = Math.min(w, d) * 0.46, rc = 11841700;
@@ -34277,13 +34422,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34277
34422
  const defined = { extraTypes };
34278
34423
  Object.assign(K, defined);
34279
34424
  }
34280
- function installFurniturePlaceItems(K, shared2) {
34425
+ function installFurniturePlaceItems(K, shared3) {
34281
34426
  const { THREE, Y0, _col, boxC, colorOf, cursor, decorLights, makeApi, structurePiece } = K;
34282
34427
  const buildItem2 = (...a) => K.buildItem(...a);
34283
34428
  const registerCollision = (...a) => K.registerCollision(...a);
34284
34429
  const vegItem = (...a) => K.vegItem(...a);
34285
34430
  function houseItems() {
34286
- const R = shared2.ctx.r, T2 = shared2.ctx.types, api = makeApi(), noModel = /* @__PURE__ */ new Map();
34431
+ const R = shared3.ctx.r, T2 = shared3.ctx.types, api = makeApi(), noModel = /* @__PURE__ */ new Map();
34287
34432
  const list2 = R.items.concat(R.stateItems.filter((e) => e.w != null && e.d != null && e.type !== "razor_wire" && e.type !== "barbed_wire"));
34288
34433
  const rect = (poly) => {
34289
34434
  let a = 0;
@@ -34295,8 +34440,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34295
34440
  if (m.type === "stairs") continue;
34296
34441
  const exterior = m.outdoor || m.floor < 0, f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
34297
34442
  cursor.group = exterior ? "lot" : "f" + f;
34298
- const com = m.room != null ? shared2.ctx.roomById[m.room] : void 0, base = exterior ? 0 : Y0(f);
34299
- const M = { x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base, floor: exterior ? -1 : f, palette: shared2.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color) ?? void 0, seed: m.id, room: m.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.9, on: shared2.ctx.night, light: shared2.ctx.night, lit: shared2.ctx.night, open: !!m.doorOpen, overhead: m.overhead, assembly: m.assembly, hose: m.hose };
34443
+ const com = m.room != null ? shared3.ctx.roomById[m.room] : void 0, base = exterior ? 0 : Y0(f);
34444
+ const M = { x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base, floor: exterior ? -1 : f, palette: shared3.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color) ?? void 0, seed: m.id, room: m.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.9, on: shared3.ctx.night, light: shared3.ctx.night, lit: shared3.ctx.night, open: !!m.doorOpen, overhead: m.overhead, assembly: m.assembly, hose: m.hose };
34300
34445
  if (m.category === "ground_cover" && m.polygon) {
34301
34446
  const xs = m.polygon.map((p) => p[0]), zs = m.polygon.map((p) => p[1]);
34302
34447
  M.x = (Math.min(...xs) + Math.max(...xs)) / 2;
@@ -34306,8 +34451,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34306
34451
  M.ry = 0;
34307
34452
  if (!rect(m.polygon)) M.poly = m.polygon.map((p) => [p[0] - M.x, p[1] - M.z]);
34308
34453
  }
34309
- if (shared2.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
34310
- if (shared2.ctx.iv && shared2.ctx.iv.replace.has(m.id)) {
34454
+ if (shared3.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
34455
+ if (shared3.ctx.iv && shared3.ctx.iv.replace.has(m.id)) {
34311
34456
  registerCollision(m, M);
34312
34457
  continue;
34313
34458
  }
@@ -34339,13 +34484,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34339
34484
  return noModel;
34340
34485
  }
34341
34486
  function waterTankOfHouse(api) {
34342
- const cd = shared2.ctx.r.waterTank;
34343
- if (!cd || !shared2.ctx.types.water_tank) return;
34344
- const lc = cd.place === "raised_slab" && cd.platform, slab = cd.place === "slab" || !!lc, nA = shared2.ctx.r.floors.length, f = Math.max(0, Math.min(nA - 1, cd.floor));
34345
- const base = lc ? cd.platform.topY : cd.y + (shared2.ctx.r.rooms.some((c) => c.id === cd.room && c.type === "terrace") ? 0 : 0.2 + (slab ? 0.03 : 0));
34487
+ const cd = shared3.ctx.r.waterTank;
34488
+ if (!cd || !shared3.ctx.types.water_tank) return;
34489
+ const lc = cd.place === "raised_slab" && cd.platform, slab = cd.place === "slab" || !!lc, nA = shared3.ctx.r.floors.length, f = Math.max(0, Math.min(nA - 1, cd.floor));
34490
+ const base = lc ? cd.platform.topY : cd.y + (shared3.ctx.r.rooms.some((c) => c.id === cd.room && c.type === "terrace") ? 0 : 0.2 + (slab ? 0.03 : 0));
34346
34491
  cursor.group = slab ? "f" + f : "attic_tank";
34347
34492
  if (lc) {
34348
- const P = cd.platform, [x0, z0, x1, z1] = P.aabb, e = P.thickness, color2 = shared2.ctx.colors.slab != null ? shared2.ctx.colors.slab : 12170668;
34493
+ const P = cd.platform, [x0, z0, x1, z1] = P.aabb, e = P.thickness, color2 = shared3.ctx.colors.slab != null ? shared3.ctx.colors.slab : 12170668;
34349
34494
  cursor.pc = structurePiece("tank_slab");
34350
34495
  boxC("plain", (x0 + x1) / 2, P.topY - e / 2, (z0 + z1) / 2, x1 - x0, e, z1 - z0, color2, 0, 0, 0);
34351
34496
  P.pillars.forEach((p, k) => {
@@ -34355,13 +34500,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34355
34500
  cursor.pc = null;
34356
34501
  }
34357
34502
  if (!slab) {
34358
- const color2 = shared2.ctx.colors.slab != null ? shared2.ctx.colors.slab : 12170668, yp = Y0(f), hw = cd.w / 2 + 0.1, hd = cd.d / 2 + 0.1;
34503
+ const color2 = shared3.ctx.colors.slab != null ? shared3.ctx.colors.slab : 12170668, yp = Y0(f), hw = cd.w / 2 + 0.1, hd = cd.d / 2 + 0.1;
34359
34504
  boxC("plain", cd.u, base - 0.06, cd.v, hw * 2, 0.12, hd * 2, color2);
34360
34505
  for (const sx of [-1, 1]) for (const sz of [-1, 1]) boxC("plain", cd.u + sx * (hw - 0.07), (yp + base - 0.12) / 2, cd.v + sz * (hd - 0.07), 0.1, base - 0.12 - yp, 0.1, color2);
34361
34506
  }
34362
- const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base, floor: f, colors: shared2.ctx.colors, seed: "water_tank", room: cd.room, onSlab: true, ceiling: 2.9 };
34363
- shared2.ctx.waterTankPos = { x: cd.u, z: cd.v, y: base, group: cursor.group };
34364
- shared2.ctx.types.water_tank.f(M, api);
34507
+ const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base, floor: f, colors: shared3.ctx.colors, seed: "water_tank", room: cd.room, onSlab: true, ceiling: 2.9 };
34508
+ shared3.ctx.waterTankPos = { x: cd.u, z: cd.v, y: base, group: cursor.group };
34509
+ shared3.ctx.types.water_tank.f(M, api);
34365
34510
  }
34366
34511
  function hashColor(s) {
34367
34512
  let h = 7;
@@ -34371,12 +34516,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34371
34516
  function labeledBox(m, M, group) {
34372
34517
  const color2 = M.color != null ? M.color : hashColor(m.category || m.type), h = Math.max(0.05, m.h || 0.5);
34373
34518
  boxC("plain", m.x, M.base + (m.y || 0) + h / 2, m.z, m.w, h, m.d, color2, 0, m.ry || 0, 0);
34374
- shared2.ctx.labels.push({ pos: new THREE.Vector3(m.x, M.base + (m.y || 0) + h + 0.15, m.z), text: m.type, group, type: "no_model" });
34519
+ shared3.ctx.labels.push({ pos: new THREE.Vector3(m.x, M.base + (m.y || 0) + h + 0.15, m.z), text: m.type, group, type: "no_model" });
34375
34520
  }
34376
34521
  const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
34377
34522
  Object.assign(K, defined);
34378
34523
  }
34379
- function installVegetationBridge(K, shared2) {
34524
+ function installVegetationBridge(K, shared3) {
34380
34525
  const seedKey = (id) => K.seedKey(id);
34381
34526
  const { THREE, SEED, rngString } = K;
34382
34527
  const VEG_POT = ["potted_areca", "potted_snake_plant", "potted_fern"], VEG_CACTUS = { cactus_mandacaru: "mandacaru", cactus_palm: "prickly_pear", cactus_crown: "crown_cactus", cactus_xique: "xique_xique", cactus_pot: "potted_cactus" };
@@ -34402,7 +34547,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34402
34547
  for (const k of Object.keys(VEG_CACTUS)) VEG_MAP[k] = [VEG_CACTUS[k]];
34403
34548
  const VEG_PLANTER = { planter_bed: ["rose_bush_red", "rose_bush_pink", "rose_bush_white", "marigold", "periwinkle_pink", "periwinkle_white", "daisy"], planter_bed_small: ["rose_bush_red", "marigold", "periwinkle_pink", "daisy"], garden_bed: ["lawn_tuft", "wild_flowers"] };
34404
34549
  function vegItem(m, M, group) {
34405
- const V3 = shared2.ctx.veg;
34550
+ const V3 = shared3.ctx.veg;
34406
34551
  if (!V3) return false;
34407
34552
  const ids = VEG_MAP[m.type], can2 = VEG_PLANTER[m.type];
34408
34553
  if (!ids && !can2) return false;
@@ -34443,7 +34588,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34443
34588
  return true;
34444
34589
  }
34445
34590
  function assembleVegetation(groups) {
34446
- const V3 = shared2.ctx.veg;
34591
+ const V3 = shared3.ctx.veg;
34447
34592
  if (!V3) return;
34448
34593
  let pl = 0, tri = 0;
34449
34594
  const col = [], lod = [0, 0, 0], mats = V3.mats();
@@ -34466,18 +34611,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34466
34611
  for (const c of lot.colliders) col.push(Object.assign({ y: G.y, group: G.group }, c));
34467
34612
  for (let i = 0; i < 3; i++) lod[i] += lot.lodCounts[i];
34468
34613
  }
34469
- shared2.ctx.vegInfo = { plants: pl, triangles: tri, colliders: col, lodCounts: lod, materials: mats };
34614
+ shared3.ctx.vegInfo = { plants: pl, triangles: tri, colliders: col, lodCounts: lod, materials: mats };
34470
34615
  }
34471
34616
  const defined = { VEG_POT, VEG_CACTUS, VEG_MAP, VEG_PLANTER, vegItem, assembleVegetation };
34472
34617
  Object.assign(K, defined);
34473
34618
  }
34474
- function installInteractionState(K, shared2) {
34619
+ function installInteractionState(K, shared3) {
34475
34620
  const { THREE, cfg, colliderChanged, invalidateShadow, invalidate, UV_SCALE, applyPart, texture } = K;
34476
34621
  const ivRoomEffective = (...a) => K.ivRoomEffective(...a);
34477
34622
  const ivRoomLight = (...a) => K.ivRoomLight(...a);
34478
- shared2.partState = /* @__PURE__ */ new Map();
34623
+ shared3.partState = /* @__PURE__ */ new Map();
34479
34624
  const newInteractiveState = () => ({ defs: /* @__PURE__ */ new Map(), items: [], pieces: [], lights: /* @__PURE__ */ new Map(), litRooms: /* @__PURE__ */ new Set(), objs: [], anim: /* @__PURE__ */ new Set(), msg: null, target: null });
34480
- shared2.inter = newInteractiveState();
34625
+ shared3.inter = newInteractiveState();
34481
34626
  const MESSAGE_MS = 2200;
34482
34627
  UV_SCALE.doorWood = 1;
34483
34628
  UV_SCALE.doorPaint = 1;
@@ -34532,15 +34677,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34532
34677
  }
34533
34678
  const _EY = new THREE.Vector3(0, 1, 0), _UM3 = new THREE.Vector3(1, 1, 1);
34534
34679
  const hudMessage = (text) => {
34535
- shared2.inter.msg = { text, until: performance.now() + MESSAGE_MS };
34680
+ shared3.inter.msg = { text, until: performance.now() + MESSAGE_MS };
34536
34681
  if (cfg.onMessage) cfg.onMessage(text);
34537
34682
  };
34538
- const I = () => shared2.inter;
34683
+ const I = () => shared3.inter;
34539
34684
  function definePiece(name, definition) {
34540
34685
  const def = definition;
34541
34686
  def.name = name;
34542
34687
  def.meshes = [];
34543
- def.t = def.target = shared2.partState.has(name) ? shared2.partState.get(name) : def.t0 || 0;
34688
+ def.t = def.target = shared3.partState.has(name) ? shared3.partState.get(name) : def.t0 || 0;
34544
34689
  I().defs.set(name, def);
34545
34690
  I().pieces.push(def);
34546
34691
  return def;
@@ -34641,20 +34786,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34641
34786
  }
34642
34787
  function togglePiece(p) {
34643
34788
  p.target = p.target > 0.5 ? 0 : 1;
34644
- shared2.partState.set(p.name, p.target);
34789
+ shared3.partState.set(p.name, p.target);
34645
34790
  if (p.col && p.col.off !== p.target > 0.5) {
34646
34791
  p.col.off = p.target > 0.5;
34647
34792
  colliderChanged(p.col);
34648
34793
  }
34649
34794
  I().anim.add(p);
34650
34795
  }
34651
- const lightBase = (roomId) => roomId == null ? true : shared2.partState.has("light:" + roomId) ? !!shared2.partState.get("light:" + roomId) : !!shared2.ctx.night;
34796
+ const lightBase = (roomId) => roomId == null ? true : shared3.partState.has("light:" + roomId) ? !!shared3.partState.get("light:" + roomId) : !!shared3.ctx.night;
34652
34797
  const lightOn = (roomId) => {
34653
- const S = roomId != null && shared2.ctx.iv && shared2.ctx.iv.roomStates.get(roomId);
34798
+ const S = roomId != null && shared3.ctx.iv && shared3.ctx.iv.roomStates.get(roomId);
34654
34799
  return S ? S.ef : lightBase(roomId);
34655
34800
  };
34656
34801
  function applyLight(roomId) {
34657
- const on = lightOn(roomId), inter = I(), mats = shared2.mats;
34802
+ const on = lightOn(roomId), inter = I(), mats = shared3.mats;
34658
34803
  for (const d of inter.lights.get(roomId) || []) for (const m of d.meshes) if (m.name.endsWith("/emissive")) m.material = on ? mats.emissive : mats.off;
34659
34804
  const sw = inter.defs.get("ix:int:" + roomId);
34660
34805
  if (sw) {
@@ -34664,9 +34809,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34664
34809
  invalidate();
34665
34810
  }
34666
34811
  function toggleLight(roomId) {
34667
- const S = shared2.ctx.iv && shared2.ctx.iv.roomStates.get(roomId);
34812
+ const S = shared3.ctx.iv && shared3.ctx.iv.roomStates.get(roomId);
34668
34813
  if (S) {
34669
- const IV = shared2.ctx.iv;
34814
+ const IV = shared3.ctx.iv;
34670
34815
  ivRoomLight(IV, roomId, !S.ef);
34671
34816
  const ef = ivRoomEffective(IV, S);
34672
34817
  if (ef !== S.ef) {
@@ -34676,15 +34821,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34676
34821
  }
34677
34822
  return;
34678
34823
  }
34679
- shared2.partState.set("light:" + roomId, !lightOn(roomId));
34824
+ shared3.partState.set("light:" + roomId, !lightOn(roomId));
34680
34825
  applyLight(roomId);
34681
34826
  if (cfg.onLight) cfg.onLight(roomId, lightOn(roomId));
34682
34827
  }
34683
34828
  const defined = { newInteractiveState, MESSAGE_MS, createInteractiveMaterials, _EY, _UM3, hudMessage, definePiece, localOf, visibleChain, assembleInteractive, applyPiece, DURATION, animateInteractive, togglePiece, lightBase, lightOn, applyLight, toggleLight };
34684
34829
  Object.assign(K, defined);
34685
34830
  }
34686
- function installInteractionCollision(K, shared2) {
34687
- const inter = () => shared2.inter;
34831
+ function installInteractionCollision(K, shared3) {
34832
+ const inter = () => shared3.inter;
34688
34833
  const NO_COLLIDE = /(^|_)(rug|floor|concrete|dirt|lawn|deck|ceiling_light|pendant|chandelier|spot|picture|curtain|blinds|wall_shelving|plank_shelf|wall_ac|ac_condenser|pool|soaking_tub|pergola|stairs|mirror)/;
34689
34834
  function registerCollision(m, M) {
34690
34835
  const h = m.h || 0, y = M.y || 0;
@@ -34712,7 +34857,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34712
34857
  function collideAt(x, z, floor2, opt) {
34713
34858
  opt = opt || {};
34714
34859
  const R = opt.radius != null ? opt.radius : 0.24;
34715
- for (const c of shared2.ctx.colliders) {
34860
+ for (const c of shared3.ctx.colliders) {
34716
34861
  if (c.off) continue;
34717
34862
  if (c.f !== -1 && c.f !== floor2) continue;
34718
34863
  if (c.f === -1 && floor2 !== 0) continue;
@@ -34725,12 +34870,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34725
34870
  const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt };
34726
34871
  Object.assign(K, defined);
34727
34872
  }
34728
- function installInteractionItems(K, shared2) {
34873
+ function installInteractionItems(K, shared3) {
34729
34874
  const { t, LIGHTS, cursor, definePiece, localOf, registerCollision, togglePiece } = K;
34730
34875
  const DOOR_ITEM = /^(tv_unit|tv_unit_small|tv_unit_large|sideboard|china_cabinet|filing_cabinet|pantry|laundry_cabinet|wardrobe|wardrobe_small|wardrobe_large|closet_wardrobe|kitchen_cabinet|kitchen_cabinet_large|kitchen_cabinet_small|fridge|fridge_large|display_fridge_medium|display_fridge)$/;
34731
34876
  const DRAWER_ITEM = /^(console_table|dresser|nightstand|vanity_table)$/;
34732
34877
  const LIGHT_TYPES = /* @__PURE__ */ new Set(["ceiling_light", "pendant", "chandelier", "track_spot", "hanging_plant"]);
34733
- const I = () => shared2.inter;
34878
+ const I = () => shared3.inter;
34734
34879
  function objectName(type, drawer) {
34735
34880
  return drawer ? "drawer" : /^wardrobe/.test(type) ? "wardrobe" : /fridge|refrig|freezer/.test(type) ? "fridge" : /pantry/.test(type) ? "pantry" : "cabinet";
34736
34881
  }
@@ -34751,7 +34896,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34751
34896
  }
34752
34897
  function lightItem(m, M, ent, api, parent) {
34753
34898
  M.on = M.light = M.lit = true;
34754
- const n0 = LIGHTS.length, name = shared2.quality === "game" ? "ix:light:" + m.room + "@" + parent : "ix:light:" + m.id;
34899
+ const n0 = LIGHTS.length, name = shared3.quality === "game" ? "ix:light:" + m.room + "@" + parent : "ix:light:" + m.id;
34755
34900
  cursor.group = name;
34756
34901
  try {
34757
34902
  ent.f(M, api);
@@ -34793,7 +34938,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34793
34938
  const al = first.target > 0.5 ? 0 : 1;
34794
34939
  for (const p of parts) {
34795
34940
  p.target = al;
34796
- shared2.partState.set(p.name, al);
34941
+ shared3.partState.set(p.name, al);
34797
34942
  I().anim.add(p);
34798
34943
  }
34799
34944
  } });
@@ -34883,10 +35028,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34883
35028
  const defined = { DOOR_ITEM, DRAWER_ITEM, LIGHT_TYPES, objectName, recordApi, buildItem: buildItem2, lightItem, curtainItem, furnitureItem };
34884
35029
  Object.assign(K, defined);
34885
35030
  }
34886
- function installInteractionFittings(K, shared2) {
35031
+ function installInteractionFittings(K, shared3) {
34887
35032
  const { t, EPS: EPS6, OPEN_AREA, Y0, applyPiece, bx, cursor, definePiece, gates, lightOn, roomAt, slideDirection, toggleLight, togglePiece } = K;
34888
- const I = () => shared2.inter;
34889
- const house = () => shared2.ctx.r;
35033
+ const I = () => shared3.inter;
35034
+ const house = () => shared3.ctx.r;
34890
35035
  function gatesInteractive() {
34891
35036
  const lt2 = house().lot;
34892
35037
  if (!lt2) return;
@@ -34910,7 +35055,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34910
35055
  }
34911
35056
  orig(mat, x0, y0, z0, x1, y1, z1, color2);
34912
35057
  });
34913
- const colliders = shared2.ctx.colliders, n0 = colliders.length;
35058
+ const colliders = shared3.ctx.colliders, n0 = colliders.length;
34914
35059
  try {
34915
35060
  gs.forEach((g) => {
34916
35061
  g.open = false;
@@ -34937,7 +35082,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34937
35082
  function mailboxInteractive() {
34938
35083
  for (const m of house().items) {
34939
35084
  if (m.type !== "mailbox") continue;
34940
- const g = shared2.ctx.parts && shared2.ctx.parts["mailbox_" + m.id];
35085
+ const g = shared3.ctx.parts && shared3.ctx.parts["mailbox_" + m.id];
34941
35086
  if (!g) continue;
34942
35087
  const name = "ix:correio:" + m.id, def = definePiece(name, { kind: "part", pivot: [0, 0, 0], ry: 0, parent: "lot" });
34943
35088
  def.inner = g;
@@ -34949,7 +35094,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34949
35094
  function placeSwitches() {
34950
35095
  const R = house(), used = /* @__PURE__ */ new Set();
34951
35096
  for (const c of R.rooms) {
34952
- if (c.type === "void" || OPEN_AREA(c) || !I().litRooms.has(c.id) || used.has(c.id) || shared2.ctx.iv && shared2.ctx.iv.switchRooms.has(c.id)) continue;
35097
+ if (c.type === "void" || OPEN_AREA(c) || !I().litRooms.has(c.id) || used.has(c.id) || shared3.ctx.iv && shared3.ctx.iv.switchRooms.has(c.id)) continue;
34953
35098
  const doors = R.doors.filter((p) => p.floor === c.floor && (p.a === c.id || p.b === c.id));
34954
35099
  doors.sort((p, q) => ((q.exterior ? 1 : 0) - (p.exterior ? 1 : 0)) * (c.type === "living" ? 1 : -1));
34955
35100
  for (const p of doors) if (putSwitch(c, p)) {
@@ -34994,11 +35139,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
34994
35139
  const defined = { gatesInteractive, mailboxInteractive, placeSwitches, putSwitch };
34995
35140
  Object.assign(K, defined);
34996
35141
  }
34997
- function installInteractionDoors(K, shared2) {
35142
+ function installInteractionDoors(K, shared3) {
34998
35143
  const { t, colliderChanged, invalidateShadow, applyPiece, hudMessage } = K;
34999
- const leaves = () => shared2.ctx.leaves;
35144
+ const leaves = () => shared3.ctx.leaves;
35000
35145
  function linkDoorLeaves() {
35001
- const I = shared2.inter;
35146
+ const I = shared3.inter;
35002
35147
  for (const fo of leaves()) fo.handles = (fo.handleNames || []).map((n) => I.defs.get(n)).filter((d) => !!d);
35003
35148
  }
35004
35149
  function handleApply(fo) {
@@ -35012,7 +35157,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35012
35157
  const col = fo.col;
35013
35158
  if (fo.phase === "handle" || fo.phase === "swing") {
35014
35159
  fo.open = !fo.open;
35015
- shared2.doorState.set(fo.id, fo.open);
35160
+ shared3.doorState.set(fo.id, fo.open);
35016
35161
  col.off = fo.open;
35017
35162
  colliderChanged(col);
35018
35163
  fo.anim = true;
@@ -35022,23 +35167,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35022
35167
  if (fo.blockedFlag || fo.locked) {
35023
35168
  fo.phase = "rattle";
35024
35169
  fo.jig = 0.7;
35025
- shared2.ctx.animateDoorsOn = true;
35170
+ shared3.ctx.animateDoorsOn = true;
35026
35171
  hudMessage(t(fo.blockedFlag ? "message.boarded" : "message.locked"));
35027
35172
  return;
35028
35173
  }
35029
35174
  fo.open = !fo.open;
35030
- shared2.doorState.set(fo.id, fo.open);
35175
+ shared3.doorState.set(fo.id, fo.open);
35031
35176
  col.off = fo.open;
35032
35177
  colliderChanged(col);
35033
35178
  fo.anim = true;
35034
- shared2.ctx.animateDoorsOn = true;
35179
+ shared3.ctx.animateDoorsOn = true;
35035
35180
  if (fo.handles && fo.handles.length) {
35036
35181
  fo.phase = "handle";
35037
35182
  fo.hT = fo.hT || 0;
35038
35183
  } else fo.phase = "swing";
35039
35184
  }
35040
35185
  function animateDoors(dt) {
35041
- if (!shared2.ctx.animateDoorsOn) return;
35186
+ if (!shared3.ctx.animateDoorsOn) return;
35042
35187
  let active = false;
35043
35188
  for (const fo of leaves()) {
35044
35189
  if (!fo.phase) continue;
@@ -35070,11 +35215,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35070
35215
  }
35071
35216
  }
35072
35217
  }
35073
- shared2.ctx.animateDoorsOn = active;
35218
+ shared3.ctx.animateDoorsOn = active;
35074
35219
  invalidateShadow();
35075
35220
  }
35076
35221
  function wallBlocks(ex, ez, ax, az, floor2) {
35077
- const n = shared2.ctx.wallColliders != null ? shared2.ctx.wallColliders : 0, colliders = shared2.ctx.colliders;
35222
+ const n = shared3.ctx.wallColliders != null ? shared3.ctx.wallColliders : 0, colliders = shared3.ctx.colliders;
35078
35223
  for (let i = 0; i < n; i++) {
35079
35224
  const c = colliders[i];
35080
35225
  if (c.f !== floor2 && !(c.f === -1 && floor2 === 0)) continue;
@@ -35109,19 +35254,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35109
35254
  const defined = { linkDoorLeaves, handleApply, toggleDoor, animateDoors, wallBlocks, doorText, applyLeaf };
35110
35255
  Object.assign(K, defined);
35111
35256
  }
35112
- function installInteractionTarget(K, shared2) {
35257
+ function installInteractionTarget(K, shared3) {
35113
35258
  const { doorText, toggleDoor, visibleChain, wallBlocks } = K;
35114
35259
  const ivTarget = (...a) => K.ivTarget(...a);
35115
35260
  function targetOf(o, opt) {
35116
35261
  if (!o) return null;
35117
35262
  opt = opt || {};
35118
- const I = shared2.inter;
35263
+ const I = shared3.inter;
35119
35264
  const ex = o.x, ey = o.y, ez = o.z, floor2 = o.floor, cp = Math.cos(o.pitch || 0), vx2 = Math.sin(o.yaw) * cp, vy2 = Math.sin(o.pitch || 0), vz2 = Math.cos(o.yaw) * cp;
35120
35265
  let best = null;
35121
35266
  const tries = (score, text, action, target) => {
35122
35267
  if (!best || score < best.score) best = { score, text, action, target };
35123
35268
  };
35124
- for (const fo of shared2.ctx.leaves) {
35269
+ for (const fo of shared3.ctx.leaves) {
35125
35270
  if (fo.floor !== floor2) continue;
35126
35271
  const d = Math.hypot(fo.cx - ex, fo.cz - ez);
35127
35272
  if (d > 1.7) continue;
@@ -35130,7 +35275,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35130
35275
  tries(angle * 1.6 + d * 0.5 + (angle < 0.25 ? 0 : 0.6), doorText(fo), () => toggleDoor(fo), fo);
35131
35276
  }
35132
35277
  const vis = I.pieces.flatMap((p) => p.meshes).filter(visibleChain), hit = vis.length && opt.strike ? opt.strike(vis) : null;
35133
- const kitA = shared2.ctx.iv ? ivTarget(shared2.ctx.iv, o, opt && opt.interactives) : null;
35278
+ const kitA = shared3.ctx.iv ? ivTarget(shared3.ctx.iv, o, opt && opt.interactives) : null;
35134
35279
  const nearKit = kitA && hit && Math.hypot(kitA.target.pos[0] - ex, kitA.target.pos[1] - ey, kitA.target.pos[2] - ez) < hit.distance + 0.1;
35135
35280
  const pieceHit = hit && !nearKit && hit.object.userData.piece;
35136
35281
  for (const it of I.items) {
@@ -35149,14 +35294,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35149
35294
  const defined = { targetOf };
35150
35295
  Object.assign(K, defined);
35151
35296
  }
35152
- function installInteractablesBridge(K, shared2) {
35297
+ function installInteractablesBridge(K, shared3) {
35153
35298
  const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord, put, rgbOf, sh, wallBlocks } = K;
35154
35299
  const enter = (...a) => K.enter(...a);
35155
35300
  const roomLightMask = (...a) => K.roomLightMask(...a);
35156
35301
  const IV_MATERIAL = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", plant: "plant", water: "water", emissive: "emissive", atlas_picture: "picture", atlas_floor: "floor" };
35157
35302
  const IV_WIRE = { conduit: 13618628, cable: 2762532, drop: 1381653, cord: 1776413, earth: 3111482, hose: 11556124 };
35158
35303
  const IV_DOOR = /^(door|drawer)/;
35159
- const ivGroup = (e) => e.floor < 0 ? "lot" : "f" + Math.min(e.floor, shared2.ctx.r.floors.length - 1);
35304
+ const ivGroup = (e) => e.floor < 0 ? "lot" : "f" + Math.min(e.floor, shared3.ctx.r.floors.length - 1);
35160
35305
  function ivAccumulate(mat, g, ox, oy, oz, ry, color2) {
35161
35306
  const P = g.attributes.position, N = g.attributes.normal, C = color2 == null ? g.attributes.color : null, U = g.attributes.uv, I = g.index, nv = P.count, ni = I ? I.count : nv;
35162
35307
  const A = accFor(mat);
@@ -35200,7 +35345,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35200
35345
  A.ni += ni;
35201
35346
  }
35202
35347
  function ivBuild(h, water) {
35203
- const ik = K.IVK, r = shared2.ctx.r, A = ik.A, world0 = null;
35348
+ const ik = K.IVK, r = shared3.ctx.r, A = ik.A, world0 = null;
35204
35349
  void world0;
35205
35350
  const source = r;
35206
35351
  const plane2 = A.plan(source, { seed: r.seed });
@@ -35222,8 +35367,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35222
35367
  const wants = (roomId) => lightBase(roomId);
35223
35368
  const entById = new Map(plane2.items.map((e) => [e.id, e]));
35224
35369
  const entByItem = new Map(plane2.items.map((e) => [e.item, e]));
35225
- const mats = shared2.mats;
35226
- IV.mats = { plain: mats.plain, metal: shared2.mats.metal, wood: shared2.mats.wood, glass: shared2.mats.glass, fabric: shared2.mats.fabric, plant: shared2.mats.plant, water: shared2.mats.water, emissive: shared2.mats.emissive, atlas_picture: shared2.mats.picture, atlas_floor: shared2.mats.floor };
35370
+ const mats = shared3.mats;
35371
+ IV.mats = { plain: mats.plain, metal: shared3.mats.metal, wood: shared3.mats.wood, glass: shared3.mats.glass, fabric: shared3.mats.fabric, plant: shared3.mats.plant, water: shared3.mats.water, emissive: shared3.mats.emissive, atlas_picture: shared3.mats.picture, atlas_floor: shared3.mats.floor };
35227
35372
  const ev = (e) => ivEvent(h, e);
35228
35373
  const world = IV.world = A.createWorld(source, { water, seed: r.seed, onEvent: ev });
35229
35374
  const add0 = world.add;
@@ -35231,7 +35376,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35231
35376
  const e = entById.get(id);
35232
35377
  if (e && e.type === "lamp") {
35233
35378
  const roomId = IV.lampRoom.get(id);
35234
- spec.devices[0].on = roomId ? wants(roomId) : !!shared2.ctx.night;
35379
+ spec.devices[0].on = roomId ? wants(roomId) : !!shared3.ctx.night;
35235
35380
  spec.parts = (spec.parts || []).concat([{ id: "_x", pivot: [0, 0, 0], motion: { kind: "slide", axis: [0, 1, 0], distance: 1e-3 }, label: "" }]);
35236
35381
  spec.interactions = [{ id: "device.lamp", pos: [0, 0, 0], action: { do: "toggle_device", device: "lamp" }, label: "", requires: { object: id, part: "_x" } }];
35237
35382
  } else if (e && e.type === "wall_switch") {
@@ -35257,7 +35402,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35257
35402
  }
35258
35403
  if (e.type === "lamp" && o.devices && o.devices.lamp) {
35259
35404
  const roomId = IV.lampRoom.get(id);
35260
- o.devices.lamp.on = roomId ? wants(roomId) : !!shared2.ctx.night;
35405
+ o.devices.lamp.on = roomId ? wants(roomId) : !!shared3.ctx.night;
35261
35406
  } else if (e.type === "wall_switch" && o.parts && o.parts.rocker !== void 0) {
35262
35407
  const l = (e.connections.controls || [])[0], roomId = l && IV.lampRoom.get(l);
35263
35408
  if (roomId) o.parts.rocker = wants(roomId) ? 1 : 0;
@@ -35350,7 +35495,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35350
35495
  const ik = IV.k, w = IV.world, wl = (o, p) => ik.GI.localToWorld(o.transform, p), g0 = cursor.group;
35351
35496
  const tube2 = (pts, radius, color2, ox, oy, oz, ry) => {
35352
35497
  try {
35353
- const m = ik.gfx.createCord(pts, radius, shared2.mats.plain);
35498
+ const m = ik.gfx.createCord(pts, radius, shared3.mats.plain);
35354
35499
  ivAccumulate("plain", m.geometry, ox, oy, oz, ry, color2);
35355
35500
  m.geometry.dispose();
35356
35501
  } catch (e) {
@@ -35393,7 +35538,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35393
35538
  for (const E of IV.roots) {
35394
35539
  (gs[E.group] || (gs[E.group] = new THREE.Group())).add(E.root);
35395
35540
  }
35396
- for (const [roomId] of IV.roomStates) if (!shared2.inter.litRooms.has(roomId)) IV.roomStates.delete(roomId);
35541
+ for (const [roomId] of IV.roomStates) if (!shared3.inter.litRooms.has(roomId)) IV.roomStates.delete(roomId);
35397
35542
  for (const E of IV.entries.values()) if (E.parts && Object.keys(E.parts).length) IV.k.gfx.syncObject(IV.world, E.id, E.parts, { time: 0 });
35398
35543
  for (const E of IV.entries.values()) if (E.screen) ivScreen(IV, E);
35399
35544
  }
@@ -35425,7 +35570,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35425
35570
  break;
35426
35571
  case "device": {
35427
35572
  const roomId = IV.lampRoom.get(e.object);
35428
- if (roomId) shared2.partState.set("light:" + roomId, !!e.on);
35573
+ if (roomId) shared3.partState.set("light:" + roomId, !!e.on);
35429
35574
  invalidate();
35430
35575
  break;
35431
35576
  }
@@ -35581,7 +35726,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35581
35726
  gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
35582
35727
  gm.computeBoundingSphere();
35583
35728
  if (!IV.items) {
35584
- const mesh3 = new THREE.Mesh(gm, shared2.mats.plain);
35729
+ const mesh3 = new THREE.Mesh(gm, shared3.mats.plain);
35585
35730
  IV.items = mesh3;
35586
35731
  mesh3.name = "iv-items";
35587
35732
  mesh3.castShadow = false;
@@ -35724,17 +35869,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35724
35869
  const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate, IV_SHAPE, ivItems, ivTarget, ivRoomLight, ivParts, ivDispose, ivPublish };
35725
35870
  Object.assign(K, defined);
35726
35871
  }
35727
- function installAnimationClotheslines(K, shared2) {
35872
+ function installAnimationClotheslines(K, shared3) {
35728
35873
  const { invalidate, CLOTHES_UNIFORMS } = K;
35729
35874
  const WIND = { t0: performance.now(), last: 0, base: 0.55 };
35730
35875
  function animateClotheslines(now) {
35731
- if (!shared2.ctx.clotheslines || !shared2.ctx.clotheslines.length) return;
35876
+ if (!shared3.ctx.clotheslines || !shared3.ctx.clotheslines.length) return;
35732
35877
  if (now - WIND.last < 33) return;
35733
35878
  WIND.last = now;
35734
35879
  const t = (now - WIND.t0) / 1e3;
35735
35880
  CLOTHES_UNIFORMS.uTime.value = t;
35736
35881
  CLOTHES_UNIFORMS.uVento.value = WIND.base + 0.45 * Math.sin(t * 0.23) * Math.sin(t * 0.11 + 1.3) + 0.25 * Math.max(0, Math.sin(t * 0.57));
35737
- const g = shared2.ctx.parts && shared2.ctx.parts["laundry_" + shared2.ctx.clotheslines[0]];
35882
+ const g = shared3.ctx.parts && shared3.ctx.parts["laundry_" + shared3.ctx.clotheslines[0]];
35738
35883
  if (g) {
35739
35884
  let vis = true;
35740
35885
  for (let n = g; n; n = n.parent) if (!n.visible) {
@@ -35748,31 +35893,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35748
35893
  const defined = { WIND, animateClotheslines };
35749
35894
  Object.assign(K, defined);
35750
35895
  }
35751
- function installBuildInstance(K, shared2) {
35896
+ function installBuildInstance(K, shared3) {
35752
35897
  const { PROPS, THREE, DOC, cfg, HP, createInteractiveMaterials, createMaterials: createMaterials2, typeTable } = K;
35753
35898
  const props = PROPS.create(THREE, { document: DOC, emit: () => {
35754
35899
  } });
35755
35900
  const TYPES = typeTable(props);
35756
- shared2.mats = createMaterials2(props);
35757
- createInteractiveMaterials(shared2.mats);
35901
+ shared3.mats = createMaterials2(props);
35902
+ createInteractiveMaterials(shared3.mats);
35758
35903
  if (cfg.materials) for (const k of Object.keys(cfg.materials)) {
35759
35904
  const v = cfg.materials[k];
35760
- shared2.mats[k] = typeof v === "function" ? v(shared2.mats[k], k) || shared2.mats[k] : v;
35905
+ shared3.mats[k] = typeof v === "function" ? v(shared3.mats[k], k) || shared3.mats[k] : v;
35761
35906
  }
35762
35907
  const newState = () => ({ doors: /* @__PURE__ */ new Map(), inter: /* @__PURE__ */ new Map(), water: null, iv: null });
35763
35908
  function enter(h) {
35764
- shared2.ctx = h.ctx;
35765
- shared2.inter = h.inter;
35766
- shared2.doorState = h.state.doors;
35767
- shared2.partState = h.state.inter;
35768
- shared2.mirrors = h.mirrors;
35769
- shared2.quality = h.quality;
35909
+ shared3.ctx = h.ctx;
35910
+ shared3.inter = h.inter;
35911
+ shared3.doorState = h.state.doors;
35912
+ shared3.partState = h.state.inter;
35913
+ shared3.mirrors = h.mirrors;
35914
+ shared3.quality = h.quality;
35770
35915
  }
35771
35916
  const tagDamage = (type) => ({ type, hp: HP[type], hpMax: HP[type] });
35772
35917
  const defined = { props, TYPES, newState, enter, tagDamage };
35773
35918
  Object.assign(K, defined);
35774
35919
  }
35775
- function installInteractablesKit(K, shared2) {
35920
+ function installInteractablesKit(K, shared3) {
35776
35921
  const { t, THREE, DOC, cfg, Reflector } = K;
35777
35922
  const roomLightMask = (...a) => K.roomLightMask(...a);
35778
35923
  const IVK = (() => {
@@ -35790,8 +35935,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35790
35935
  const l = cfg.vegetation || null, G = l && (l.GameVegetation || (l.buildLot ? l : null)), S = l && (l.GameVegetationSpecies || (l.toSpec ? l : null));
35791
35936
  return G && S && G.buildLot && S.toSpec ? { G, S } : null;
35792
35937
  })();
35793
- shared2.vegMaterials = null;
35794
- const vegMaterials = () => shared2.vegMaterials || (shared2.vegMaterials = (() => {
35938
+ shared3.vegMaterials = null;
35939
+ const vegMaterials = () => shared3.vegMaterials || (shared3.vegMaterials = (() => {
35795
35940
  const m = VEG.G.createVegetationMaterials(THREE);
35796
35941
  for (const k of ["wood", "foliage", "flowers", "fruit", "spines"]) roomLightMask(m[k]);
35797
35942
  return m;
@@ -35800,7 +35945,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35800
35945
  Object.assign(K, defined);
35801
35946
  }
35802
35947
  var newGroup = (k, house, exterior) => ({ k, house, ls: [], exterior, pos: [0, 0, 0], color: 0, n: 0, range: 0, rects: [], y: [0, 0], exclusion: null, lumens: 0, dist: 0, decay: 0, floor: 0, roomId: null, dm: 0, d: 0 });
35803
- function installLightsRoomLight(K, shared2) {
35948
+ function installLightsRoomLight(K, shared3) {
35804
35949
  const { THREE, rectsOf: rectsOf2, cfg } = K;
35805
35950
  const MAX_LIGHTS = 12, EMPTY = [1e9, 1e9, -1e9, -1e9];
35806
35951
  const LZU = { uRB0: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB1: { value: new Float32Array(MAX_LIGHTS * 4) }, uRB2: { value: new Float32Array(MAX_LIGHTS * 4) }, uRBY: { value: new Float32Array(MAX_LIGHTS * 2) }, uREx: { value: new Float32Array(MAX_LIGHTS * 4) }, uIndK: { value: 0.06 } };
@@ -35840,7 +35985,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
35840
35985
  function lighting(options) {
35841
35986
  const o = options || {};
35842
35987
  const scene = o.scene, N = Math.max(1, Math.min(MAX_LIGHTS, o.n || 6)), NS = Math.max(0, Math.min(N, o.shadows != null ? o.shadows : 2)), size = o.shadowSize || 512, MAX_EXTERNAL = o.external != null ? o.external : 2;
35843
- const mats = shared2.mats;
35988
+ const mats = shared3.mats;
35844
35989
  for (const k of Object.keys(mats)) roomLightMask(mats[k]);
35845
35990
  const budget = o.budget, lease = budget ? budget.lease({ owner: "floorplan.rooms", point: N, shadows: NS }) : null;
35846
35991
  if (budget && !lease) throw new Error("lighting: the LightBudget has no " + N + " free point slots (" + NS + " with shadow) for the rooms");
@@ -36166,9 +36311,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36166
36311
  }
36167
36312
  return view;
36168
36313
  }
36169
- function installDestructionPieces(K, shared2) {
36314
+ function installDestructionPieces(K, shared3) {
36170
36315
  const { THREE, floorAtY, pieceRecord } = K;
36171
- shared2.destructionSeq = 0;
36316
+ shared3.destructionSeq = 0;
36172
36317
  const FRAGMENT_COLOR = { brick: 11031866, concrete: 10132118, plaster: 14210248, ceramic: 11821630, glass: 11456472, tempered_glass: 11456472, wood_soft: 11569752, wood_hard: 8016948, plywood: 12098154, mdf: 12098154, steel: 9080466, aluminium: 12106944, plastic: 3107496, copper: 12088115, stone: 9079428, fabric: 13616296 };
36173
36318
  const FRAGMENT_GEO = new THREE.BoxGeometry(1, 1, 1), FRAGMENT_MAT = {};
36174
36319
  const fragmentMaterial = (m) => FRAGMENT_MAT[m] || (FRAGMENT_MAT[m] = new THREE.MeshLambertMaterial({ color: FRAGMENT_COLOR[m] != null ? FRAGMENT_COLOR[m] : 9079428 }));
@@ -36177,7 +36322,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36177
36322
  objs = objs.filter(Boolean);
36178
36323
  if (!objs.length) return;
36179
36324
  const pc = pieceRecord(id, mat, role, extra);
36180
- shared2.ctx.pieceObjects.set(id, objs);
36325
+ shared3.ctx.pieceObjects.set(id, objs);
36181
36326
  for (const o of objs) o.traverse((m) => {
36182
36327
  if (!m.isMesh) return;
36183
36328
  const u = m.userData;
@@ -36188,22 +36333,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36188
36333
  if (pc.explodes) u.destructionExplodes = pc.explodes;
36189
36334
  });
36190
36335
  };
36191
- for (const fo of shared2.ctx.leaves) {
36336
+ for (const fo of shared3.ctx.leaves) {
36192
36337
  const pr = r.doors.find((p) => p.id === fo.id);
36193
36338
  tagObject("door:" + fo.id, fo.gs, fo.type === "steel" ? "steel" : pr && pr.exterior ? "wood_hard" : "mdf", null, { floor: fo.floor, mass: fo.type === "steel" ? 60 : 18, tags: ["door"] });
36194
36339
  }
36195
36340
  const cap = r.utilities.plumbing ? +r.utilities.plumbing.capacityL || 0 : 0;
36196
- for (const [id, g] of Object.entries(shared2.ctx.parts || {})) {
36341
+ for (const [id, g] of Object.entries(shared3.ctx.parts || {})) {
36197
36342
  const tp = g.userData.part;
36198
36343
  if (tp === "water_tank") {
36199
- const e = shared2.ctx.structureIndex.water_tank, L = cap || (g.userData.volume ? Math.round(g.userData.volume * 1e3) : 0);
36344
+ const e = shared3.ctx.structureIndex.water_tank, L = cap || (g.userData.volume ? Math.round(g.userData.volume * 1e3) : 0);
36200
36345
  tagObject("water_tank", [g], "plastic", e ? e.role : null, { floor: e ? e.floor : 0, contains: L ? { fluid: "water", liters: L } : void 0, mass: e ? e.mass : 25, thickness: 4e-3, fill: 0.05, tags: ["tank"] });
36201
36346
  } else if (tp === "gas_cylinder") tagObject(id, [g], "steel", null, { mass: 11, form: "cylinder", thickness: 3e-3, fill: 0.03, contains: { fluid: "gas", liters: 13, pressurized: true }, explodes: { energy: 12e4, radius: 5, atC: 300 }, tags: ["gas_bottle"] });
36202
36347
  else if (tp === "wall_pipe") tagObject(id, [g], "plastic", null, { mass: 3, tags: ["pipe"] });
36203
36348
  else if (tp === "shower_door") tagObject(id, [g], "tempered_glass", null, { mass: 25 });
36204
36349
  else if (tp === "gate_leaf" || tp === "mailbox_door") tagObject(id, [g], "steel", null, { mass: 30 });
36205
36350
  }
36206
- for (const def of shared2.inter.defs.values()) {
36351
+ for (const def of shared3.inter.defs.values()) {
36207
36352
  if (!def.outer) continue;
36208
36353
  if (/^gate/.test(def.kind)) tagObject(def.name, [def.outer], "steel", null, { mass: 80, tags: ["gate"] });
36209
36354
  else if (def.kind === "swing" || def.kind === "drawer") tagObject(def.name, [def.outer], "mdf", null, { mass: 6 });
@@ -36223,13 +36368,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36223
36368
  for (const f of o.userData.ranges) add2(f.id, { mesh: o, v0: f.v0, v1: f.v1, i0: f.i0, i1: f.i1, whole: f.v0 === 0 && f.v1 === nv });
36224
36369
  }
36225
36370
  });
36226
- for (const [id, objs] of shared2.ctx.pieceObjects) for (const o of objs) add2(id, { obj: o });
36371
+ for (const [id, objs] of shared3.ctx.pieceObjects) for (const o of objs) add2(id, { obj: o });
36227
36372
  const box32 = (id) => {
36228
36373
  const b = new THREE.Box3(), v = new THREE.Vector3();
36229
36374
  for (const it of meshes.get(id) || []) {
36230
36375
  if (it.obj) {
36231
36376
  const bb = new THREE.Box3().setFromObject(it.obj);
36232
- if (!bb.isEmpty()) for (const x of [bb.min.x, bb.max.x]) for (const y of [bb.min.y, bb.max.y]) for (const z of [bb.min.z, bb.max.z]) b.expandByPoint(v.set(x, y, z).applyMatrix4(shared2.ctx.unitInverse));
36377
+ if (!bb.isEmpty()) for (const x of [bb.min.x, bb.max.x]) for (const y of [bb.min.y, bb.max.y]) for (const z of [bb.min.z, bb.max.z]) b.expandByPoint(v.set(x, y, z).applyMatrix4(shared3.ctx.unitInverse));
36233
36378
  } else {
36234
36379
  const P = it.mesh.geometry.attributes.position.array;
36235
36380
  for (let k = it.v0; k < it.v1; k++) b.expandByPoint(v.set(P[k * 3], P[k * 3 + 1], P[k * 3 + 2]));
@@ -36239,15 +36384,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36239
36384
  };
36240
36385
  const parts = [], byId = /* @__PURE__ */ new Map(), supports = E0.supports.map((a) => Object.assign({}, a));
36241
36386
  for (const e of E0.parts) {
36242
- const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared2.ctx.pieces.get(e.id);
36387
+ const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared3.ctx.pieces.get(e.id);
36243
36388
  if (pc) {
36244
36389
  for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null && p[k] == null) p[k] = pc[k];
36245
36390
  }
36246
36391
  parts.push(p);
36247
36392
  byId.set(p.id, p);
36248
36393
  }
36249
- const base = parts.length, view = shared2.ctx.panelView || panelViewOf(null, false), panelIds = new Set(view.panels.map((e) => e.id));
36250
- for (const [id, pc] of shared2.ctx.pieces) {
36394
+ const base = parts.length, view = shared3.ctx.panelView || panelViewOf(null, false), panelIds = new Set(view.panels.map((e) => e.id));
36395
+ for (const [id, pc] of shared3.ctx.pieces) {
36251
36396
  if (byId.has(id) || panelIds.has(id) || !meshes.has(id)) continue;
36252
36397
  const b = box32(id);
36253
36398
  if (!b) continue;
@@ -36285,7 +36430,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36285
36430
  parts.splice(0, parts.length, ...parts.filter((p) => !gone.has(p.id)));
36286
36431
  for (const id of gone) byId.delete(id);
36287
36432
  for (const e of view.panels) {
36288
- const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared2.ctx.pieces.get(e.id);
36433
+ const p = Object.assign({}, e, { meshes: (meshes.get(e.id) || []).length, extra: false }), pc = shared3.ctx.pieces.get(e.id);
36289
36434
  if (pc) {
36290
36435
  for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null && p[k] == null) p[k] = pc[k];
36291
36436
  }
@@ -36948,7 +37093,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
36948
37093
  Object.assign(K, { createBreachView, breachPaintQueue: paintQueue });
36949
37094
  }
36950
37095
  var FOLLOW_FLUSH_FALLBACK_MS = 100;
36951
- function installDestructionWorld(K, shared2) {
37096
+ function installDestructionWorld(K, shared3) {
36952
37097
  const { THREE, cfg, invalidateShadow, invalidate, rngString, FRAGMENT_GEO, fragmentMaterial, createBreachView } = K;
36953
37098
  function createHouseDestruction(root, house, structure, parts, colliders, water) {
36954
37099
  const D = { world: cfg.destruction || null, id: null, active: false }, hiddenPieces = /* @__PURE__ */ new Set(), bodies = /* @__PURE__ */ new Map(), frags = [], facets = /* @__PURE__ */ new Map();
@@ -37184,7 +37329,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37184
37329
  house.matrixWorld.decompose(p, q, sc);
37185
37330
  D.specOptions = specOptions || null;
37186
37331
  D.spec = structure.spec(specOptions);
37187
- D.id = D.world.add(D.spec, { id: "house3d:" + ++shared2.destructionSeq, position: [p.x, p.y, p.z], rotation: [q.x, q.y, q.z, q.w] });
37332
+ D.id = D.world.add(D.spec, { id: "house3d:" + ++shared3.destructionSeq, position: [p.x, p.y, p.z], rotation: [q.x, q.y, q.z, q.w] });
37188
37333
  breach.claim();
37189
37334
  if (R) R.bind(D.id, house, { parts: rangesOf(), onFrame: () => breach.flush() });
37190
37335
  off = D.world.on("*", handleEvent);
@@ -37332,7 +37477,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37332
37477
  }
37333
37478
  Object.assign(K, { createHouseDestruction });
37334
37479
  }
37335
- function installBuildBuild(K, shared2) {
37480
+ function installBuildBuild(K, shared3) {
37336
37481
  const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS6, LIGHTS, MIRRORS, Y0, animateClotheslines, animateDoors, animateInteractive, applyLeaf, applyOutbuildings, applyPart, applyPiece, assembleInteractive, baseboardAndSidewalk, buildStairs, building, carModel, chooseMirror, closeScene, collideAt, createWater, cursor, doorText, doors, electricalStructure, elevator, floorsAndSlabs, gatesInteractive, houseItems, ivAssemble, ivBuild, ivDispose, ivParts, ivPublish, ivUpdate, lightOn, linkDoorLeaves, mailboxInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, createHouseDestruction, newState, enter, tagDamage } = K;
37337
37482
  function build(r0, options) {
37338
37483
  const opts = options || {};
@@ -37343,45 +37488,45 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37343
37488
  cursor.accs.clear();
37344
37489
  LIGHTS.length = 0;
37345
37490
  const pr = opts.building || {};
37346
- shared2.ctx.r = r;
37347
- shared2.ctx.colors = r.colors;
37348
- shared2.ctx.cut = !!opts.cut;
37349
- shared2.ctx.night = !!opts.night;
37350
- shared2.ctx.labels = [];
37351
- shared2.ctx.colliders = [];
37352
- shared2.ctx.stairs = [];
37353
- shared2.ctx.noTerrain = opts.terrain === false;
37354
- shared2.ctx.roomById = {};
37355
- for (const c of r.rooms) shared2.ctx.roomById[c.id] = c;
37356
- shared2.ctx.pieces = /* @__PURE__ */ new Map();
37357
- shared2.ctx.pieceObjects = /* @__PURE__ */ new Map();
37358
- shared2.ctx.structureIndex = {};
37359
- for (const e of r0.structure?.parts || []) shared2.ctx.structureIndex[e.id] = e;
37491
+ shared3.ctx.r = r;
37492
+ shared3.ctx.colors = r.colors;
37493
+ shared3.ctx.cut = !!opts.cut;
37494
+ shared3.ctx.night = !!opts.night;
37495
+ shared3.ctx.labels = [];
37496
+ shared3.ctx.colliders = [];
37497
+ shared3.ctx.stairs = [];
37498
+ shared3.ctx.noTerrain = opts.terrain === false;
37499
+ shared3.ctx.roomById = {};
37500
+ for (const c of r.rooms) shared3.ctx.roomById[c.id] = c;
37501
+ shared3.ctx.pieces = /* @__PURE__ */ new Map();
37502
+ shared3.ctx.pieceObjects = /* @__PURE__ */ new Map();
37503
+ shared3.ctx.structureIndex = {};
37504
+ for (const e of r0.structure?.parts || []) shared3.ctx.structureIndex[e.id] = e;
37360
37505
  {
37361
- const view = shared2.ctx.panelView = panelViewOf(r0.structure, !!cfg.destruction);
37362
- shared2.ctx.panelsOf = /* @__PURE__ */ new Map();
37363
- for (const id of view.replaced) delete shared2.ctx.structureIndex[id];
37506
+ const view = shared3.ctx.panelView = panelViewOf(r0.structure, !!cfg.destruction);
37507
+ shared3.ctx.panelsOf = /* @__PURE__ */ new Map();
37508
+ for (const id of view.replaced) delete shared3.ctx.structureIndex[id];
37364
37509
  for (const e of view.panels) {
37365
- shared2.ctx.structureIndex[e.id] = e;
37366
- const l = shared2.ctx.panelsOf.get(e.slab);
37510
+ shared3.ctx.structureIndex[e.id] = e;
37511
+ const l = shared3.ctx.panelsOf.get(e.slab);
37367
37512
  if (l) l.push(e);
37368
- else shared2.ctx.panelsOf.set(e.slab, [e]);
37513
+ else shared3.ctx.panelsOf.set(e.slab, [e]);
37369
37514
  }
37370
37515
  }
37371
- shared2.ctx.panes = r0.roof?.panes || [];
37372
- shared2.ctx.noPiece = false;
37516
+ shared3.ctx.panes = r0.roof?.panes || [];
37517
+ shared3.ctx.noPiece = false;
37373
37518
  cursor.separate = opts.pieces === "meshes";
37374
37519
  cursor.pc = null;
37375
- shared2.ctx.showPillars = opts.pillars !== "hidden";
37376
- shared2.ctx.baseboardBand = opts.baseboard === "band";
37377
- shared2.ctx.apartment = r.template === "apartment_modern";
37378
- shared2.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
37379
- shared2.ctx.pf = Math.max(1, Math.min(shared2.ctx.pa, pr.floor != null ? pr.floor : 3));
37380
- shared2.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
37381
- shared2.ctx.showBuilding = shared2.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
37382
- shared2.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
37383
- shared2.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), opts: shared2.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
37384
- shared2.ctx.vegInfo = null;
37520
+ shared3.ctx.showPillars = opts.pillars !== "hidden";
37521
+ shared3.ctx.baseboardBand = opts.baseboard === "band";
37522
+ shared3.ctx.apartment = r.template === "apartment_modern";
37523
+ shared3.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
37524
+ shared3.ctx.pf = Math.max(1, Math.min(shared3.ctx.pa, pr.floor != null ? pr.floor : 3));
37525
+ shared3.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
37526
+ shared3.ctx.showBuilding = shared3.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
37527
+ shared3.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
37528
+ shared3.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), opts: shared3.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
37529
+ shared3.ctx.vegInfo = null;
37385
37530
  terrain();
37386
37531
  if (r.lot) {
37387
37532
  if (!opts.noPerimeter) {
@@ -37392,7 +37537,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37392
37537
  }
37393
37538
  walls();
37394
37539
  baseboardAndSidewalk();
37395
- shared2.ctx.wallColliders = shared2.ctx.colliders.length;
37540
+ shared3.ctx.wallColliders = shared3.ctx.colliders.length;
37396
37541
  doors();
37397
37542
  windows();
37398
37543
  floorsAndSlabs();
@@ -37400,14 +37545,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37400
37545
  buildStairs();
37401
37546
  elevator();
37402
37547
  const water = createWater(r, h.state);
37403
- shared2.ctx.iv = null;
37548
+ shared3.ctx.iv = null;
37404
37549
  h.IV = null;
37405
37550
  if (IVK) {
37406
37551
  try {
37407
- h.IV = shared2.ctx.iv = ivBuild(h, water);
37552
+ h.IV = shared3.ctx.iv = ivBuild(h, water);
37408
37553
  } catch (e) {
37409
37554
  console.warn("interactables", e);
37410
- shared2.ctx.iv = h.IV = null;
37555
+ shared3.ctx.iv = h.IV = null;
37411
37556
  }
37412
37557
  }
37413
37558
  const noModel = houseItems();
@@ -37416,14 +37561,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37416
37561
  electricalStructure();
37417
37562
  roofs();
37418
37563
  solar();
37419
- if (shared2.ctx.showBuilding) building();
37564
+ if (shared3.ctx.showBuilding) building();
37420
37565
  for (const c of r.rooms) {
37421
37566
  if (c.type === "void") continue;
37422
37567
  const [a, b, c2, d] = rectsOf2(c)[0];
37423
- shared2.ctx.labels.push({ pos: new THREE.Vector3((a + c2) / 2, Y0(c.floor) + 1.1, (b + d) / 2), text: c.name, group: "f" + c.floor, type: "room", floor: c.floor });
37568
+ shared3.ctx.labels.push({ pos: new THREE.Vector3((a + c2) / 2, Y0(c.floor) + 1.1, (b + d) / 2), text: c.name, group: "f" + c.floor, type: "room", floor: c.floor });
37424
37569
  }
37425
- const mirrorsCopy = MIRRORS.map((E, i) => Object.assign({ i }, E)), gs = closeScene(shared2.mats);
37426
- for (const fo of shared2.ctx.leaves) {
37570
+ const mirrorsCopy = MIRRORS.map((E, i) => Object.assign({ i }, E)), gs = closeScene(shared3.mats);
37571
+ for (const fo of shared3.ctx.leaves) {
37427
37572
  const parent = gs["f" + fo.floor] || (gs["f" + fo.floor] = new THREE.Group());
37428
37573
  fo.gs = [];
37429
37574
  for (const gd of fo.groups) {
@@ -37436,22 +37581,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37436
37581
  }
37437
37582
  applyLeaf(fo);
37438
37583
  }
37439
- if (shared2.ctx.iv) ivAssemble(shared2.ctx.iv, gs);
37584
+ if (shared3.ctx.iv) ivAssemble(shared3.ctx.iv, gs);
37440
37585
  assembleInteractive(gs);
37441
37586
  linkDoorLeaves();
37442
37587
  mailboxInteractive();
37443
37588
  const root = markKitOrigin(new THREE.Group(), { owner: "game-floorplan-three", kind: "structure", id: r.template }), house = new THREE.Group();
37444
37589
  root.name = "house3d";
37445
37590
  root.add(house);
37446
- shared2.mirrors.house = house;
37447
- if (shared2.ctx.apartment) {
37448
- const units = r.building.units, u = units[Math.min(shared2.ctx.pu, units.length - 1)];
37449
- house.position.set(u.u, shared2.ctx.showBuilding ? 0 : -r.floors[0].y0, u.v);
37591
+ shared3.mirrors.house = house;
37592
+ if (shared3.ctx.apartment) {
37593
+ const units = r.building.units, u = units[Math.min(shared3.ctx.pu, units.length - 1)];
37594
+ house.position.set(u.u, shared3.ctx.showBuilding ? 0 : -r.floors[0].y0, u.v);
37450
37595
  house.rotation.y = u.ry;
37451
- shared2.ctx.unitRy = u.ry;
37596
+ shared3.ctx.unitRy = u.ry;
37452
37597
  }
37453
37598
  house.updateMatrixWorld(true);
37454
- shared2.ctx.unitInverse = house.matrixWorld.clone().invert();
37599
+ shared3.ctx.unitInverse = house.matrixWorld.clone().invert();
37455
37600
  for (const [k, g] of Object.entries(gs)) {
37456
37601
  g.name = k;
37457
37602
  (k === "floor" || k === "building" ? root : house).add(g);
@@ -37460,31 +37605,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37460
37605
  h.root = root;
37461
37606
  h.house = house;
37462
37607
  h.houseGroup = house;
37463
- shared2.ctx.noModel = noModel;
37464
- shared2.ctx.lights = LIGHTS.filter((l) => l.type !== "lantern" && l.type !== "candles" || shared2.ctx.night).map((l) => ({ ...l }));
37465
- shared2.ctx.animateDoorsOn = shared2.ctx.animateDoorsOn || false;
37466
- for (const c of shared2.ctx.colliders) {
37608
+ shared3.ctx.noModel = noModel;
37609
+ shared3.ctx.lights = LIGHTS.filter((l) => l.type !== "lantern" && l.type !== "candles" || shared3.ctx.night).map((l) => ({ ...l }));
37610
+ shared3.ctx.animateDoorsOn = shared3.ctx.animateDoorsOn || false;
37611
+ for (const c of shared3.ctx.colliders) {
37467
37612
  c.aabb = [c.x0, c.z0, c.x1, c.z1];
37468
37613
  if (c.type === "wall") c.damageable = tagDamage("masonry");
37469
37614
  }
37470
- const colliders = shared2.ctx.colliders.concat(shared2.inter.objs.map((o) => ({ type: "furniture", f: o.f, obb: { cx: o.cx, cz: o.cz, hw: o.hw, hd: o.hd, c: o.c, s: o.s }, item: o.type, off: false })));
37615
+ const colliders = shared3.ctx.colliders.concat(shared3.inter.objs.map((o) => ({ type: "furniture", f: o.f, obb: { cx: o.cx, cz: o.cz, hw: o.hw, hd: o.hd, c: o.c, s: o.s }, item: o.type, off: false })));
37471
37616
  const parts = {}, setOpen = (def, t) => {
37472
37617
  def.target = t;
37473
37618
  def.t = t;
37474
- shared2.partState.set(def.name, t);
37619
+ shared3.partState.set(def.name, t);
37475
37620
  if (def.col) {
37476
37621
  def.col.off = t > 0.5;
37477
37622
  colliderChanged(def.col);
37478
37623
  }
37479
37624
  applyPiece(def);
37480
- shared2.inter.anim.delete(def);
37625
+ shared3.inter.anim.delete(def);
37481
37626
  invalidateShadow();
37482
37627
  };
37483
37628
  const mark = (o, id) => {
37484
37629
  if (o) o.userData.partId = id;
37485
37630
  };
37486
37631
  const PART_DAMAGE = { water_tank: "water", shower_door: "glass", gate_leaf: "metal", mailbox_door: "metal", mirror: "glass", cooking_gas_cylinder: "gas" };
37487
- for (const [id, g] of Object.entries(shared2.ctx.parts || {})) {
37632
+ for (const [id, g] of Object.entries(shared3.ctx.parts || {})) {
37488
37633
  const tp = g.userData.part, dn = PART_DAMAGE[tp];
37489
37634
  if (dn) g.userData.damageable = tagDamage(dn);
37490
37635
  mark(g, id);
@@ -37504,7 +37649,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37504
37649
  return g.userData.t || 0;
37505
37650
  }, meta: g.userData };
37506
37651
  }
37507
- for (const fo of shared2.ctx.leaves) {
37652
+ for (const fo of shared3.ctx.leaves) {
37508
37653
  const id = "door:" + fo.id, dn = tagDamage(fo.type === "steel" ? "metal" : "wood");
37509
37654
  fo.damageable = dn;
37510
37655
  for (const g of fo.gs) mark(g, id);
@@ -37516,14 +37661,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37516
37661
  fo.col.off = fo.open;
37517
37662
  colliderChanged(fo.col);
37518
37663
  }
37519
- shared2.doorState.set(fo.id, fo.open);
37664
+ shared3.doorState.set(fo.id, fo.open);
37520
37665
  applyLeaf(fo);
37521
37666
  invalidateShadow();
37522
37667
  }, get t() {
37523
37668
  return fo.t;
37524
37669
  }, leaf: fo };
37525
37670
  }
37526
- for (const def of shared2.inter.defs.values()) {
37671
+ for (const def of shared3.inter.defs.values()) {
37527
37672
  if (!def.outer) continue;
37528
37673
  const cab = def.kind === "swing" || def.kind === "drawer", gate = /^gate/.test(def.kind);
37529
37674
  const dn = cab ? tagDamage("wood") : gate ? tagDamage("metal") : null;
@@ -37533,7 +37678,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37533
37678
  return def.t;
37534
37679
  }, def };
37535
37680
  }
37536
- if (shared2.ctx.iv) ivParts(shared2.ctx.iv, parts, tagDamage);
37681
+ if (shared3.ctx.iv) ivParts(shared3.ctx.iv, parts, tagDamage);
37537
37682
  const cars = [];
37538
37683
  CARS.forEach((C, i) => {
37539
37684
  const mod2 = carModel(C.k, C.seed);
@@ -37574,18 +37719,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37574
37719
  const actOn = (e, a) => {
37575
37720
  enter(h);
37576
37721
  if (cfg.onInteract && cfg.onInteract(e, a) === false) return false;
37577
- shared2.inter.target = a || { target: e.ref, text: e.label, action: e._action };
37722
+ shared3.inter.target = a || { target: e.ref, text: e.label, action: e._action };
37578
37723
  e._action();
37579
37724
  return true;
37580
37725
  };
37581
- for (const fo of shared2.ctx.leaves) {
37726
+ for (const fo of shared3.ctx.leaves) {
37582
37727
  const e = { id: "door:" + fo.id, type: fo.type === "steel" ? "garage_door" : "door", floor: fo.floor, pos: [fo.cx, Y0(fo.floor) + 1, fo.cz], radius: 1.7, get label() {
37583
37728
  return doorText(fo);
37584
37729
  }, ref: fo, _action: () => toggleDoor(fo) };
37585
37730
  e.act = () => actOn(e);
37586
37731
  interactables.push(e);
37587
37732
  }
37588
- for (const it of shared2.inter.items) {
37733
+ for (const it of shared3.inter.items) {
37589
37734
  const k = it.type + ":" + it.id, n = usedMap.get(k) || 0;
37590
37735
  usedMap.set(k, n + 1);
37591
37736
  const e = { id: n ? k + "#" + n : k, type: it.type, floor: it.floor, pos: it.anchor.slice(), radius: it.range, angle: it.angle, get label() {
@@ -37595,12 +37740,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37595
37740
  interactables.push(e);
37596
37741
  it.pub = e;
37597
37742
  }
37598
- for (const fo of shared2.ctx.leaves) fo.pub = interactables.find((e) => e.ref === fo);
37743
+ for (const fo of shared3.ctx.leaves) fo.pub = interactables.find((e) => e.ref === fo);
37599
37744
  const lodObjects = [];
37600
- for (const def of shared2.inter.defs.values()) if (def.outer && /^(light|drawer|swing|curtain|light_switch|handle)$/.test(def.kind)) lodObjects.push(def.outer);
37601
- for (const [id, g] of Object.entries(shared2.ctx.parts || {})) if (/^(handle|shower_door)$/.test(g.userData.part) && g.visible !== false) lodObjects.push(g);
37602
- if (shared2.ctx.iv) {
37603
- for (const E of shared2.ctx.iv.roots) lodObjects.push(E.root);
37745
+ for (const def of shared3.inter.defs.values()) if (def.outer && /^(light|drawer|swing|curtain|light_switch|handle)$/.test(def.kind)) lodObjects.push(def.outer);
37746
+ for (const [id, g] of Object.entries(shared3.ctx.parts || {})) if (/^(handle|shower_door)$/.test(g.userData.part) && g.visible !== false) lodObjects.push(g);
37747
+ if (shared3.ctx.iv) {
37748
+ for (const E of shared3.ctx.iv.roots) lodObjects.push(E.root);
37604
37749
  }
37605
37750
  const countDraw = () => {
37606
37751
  let n = 0, t = 0;
@@ -37618,7 +37763,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37618
37763
  for (const o of lodObjects) o.visible = true;
37619
37764
  const budget = opts.drawCallBudget != null ? opts.drawCallBudget : cfg.drawCallBudget;
37620
37765
  const stats2 = { quality: h.quality, drawCalls: s0.n, drawCallsLOD1: s1.n, triangles: s0.t, trianglesLod1: s1.t, budget: budget || null, overBudget: !!budget && s0.n > budget, tBuild: performance.now() - t0 };
37621
- shared2.ctx.tBuild = stats2.tBuild;
37766
+ shared3.ctx.tBuild = stats2.tBuild;
37622
37767
  const applyLod = (level) => {
37623
37768
  const n = Math.max(0, Math.min(2, level | 0));
37624
37769
  if (n === h.lodCurrent) return;
@@ -37684,39 +37829,39 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37684
37829
  building: gs.building || null,
37685
37830
  waterTank: r.waterTank ? (() => {
37686
37831
  const pt = Object.values(parts).find((p) => p.type === "water_tank") || null;
37687
- return { part: pt, group: pt ? pt.group : null, pos: shared2.ctx.waterTankPos || null, plant: r.waterTank };
37832
+ return { part: pt, group: pt ? pt.group : null, pos: shared3.ctx.waterTankPos || null, plant: r.waterTank };
37688
37833
  })() : null,
37689
37834
  colliders,
37690
37835
  parts,
37691
37836
  cars,
37692
37837
  interactables,
37693
- doors: shared2.ctx.leaves,
37694
- stairs: shared2.ctx.stairs,
37695
- labels: shared2.ctx.labels,
37838
+ doors: shared3.ctx.leaves,
37839
+ stairs: shared3.ctx.stairs,
37840
+ labels: shared3.ctx.labels,
37696
37841
  noModel,
37697
37842
  lights: (() => {
37698
37843
  const by = {};
37699
- for (const l of shared2.ctx.lights) {
37844
+ for (const l of shared3.ctx.lights) {
37700
37845
  const k = String(l.roomId != null ? l.roomId : l.room);
37701
37846
  (by[k] || (by[k] = [])).push(l);
37702
37847
  }
37703
- return { list: shared2.ctx.lights, byRoom: by };
37848
+ return { list: shared3.ctx.lights, byRoom: by };
37704
37849
  })(),
37705
- limits: shared2.ctx.limits,
37706
- apartment: shared2.ctx.apartment,
37707
- showBuilding: shared2.ctx.showBuilding,
37708
- buildingConfig: { floors: shared2.ctx.pa, floor: shared2.ctx.pf, unit: shared2.ctx.pu },
37709
- unitRy: shared2.ctx.unitRy || 0,
37710
- night: shared2.ctx.night,
37711
- cut: shared2.ctx.cut,
37850
+ limits: shared3.ctx.limits,
37851
+ apartment: shared3.ctx.apartment,
37852
+ showBuilding: shared3.ctx.showBuilding,
37853
+ buildingConfig: { floors: shared3.ctx.pa, floor: shared3.ctx.pf, unit: shared3.ctx.pu },
37854
+ unitRy: shared3.ctx.unitRy || 0,
37855
+ night: shared3.ctx.night,
37856
+ cut: shared3.ctx.cut,
37712
37857
  interactives: h.IV ? ivPublish(h) : null,
37713
37858
  state: h.state,
37714
37859
  stats: stats2,
37715
- vegetation: shared2.ctx.vegInfo || null,
37716
- solar: shared2.ctx.solarInfo || null,
37860
+ vegetation: shared3.ctx.vegInfo || null,
37861
+ solar: shared3.ctx.solarInfo || null,
37717
37862
  water,
37718
- electrical: shared2.ctx.electricalInfo || null,
37719
- gutters: shared2.ctx.gutterInfo || null,
37863
+ electrical: shared3.ctx.electricalInfo || null,
37864
+ gutters: shared3.ctx.gutterInfo || null,
37720
37865
  // per frame: doors, parts, wind-blown laundry and (with a focus) distance LOD; dt in seconds, time in ms (rAF); focus = {x,y,z} in world coordinates
37721
37866
  update(dt, time, focus) {
37722
37867
  enter(h);
@@ -37726,9 +37871,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37726
37871
  if (destruction.active || destruction.statistics().falling || destruction.statistics().fragments) destruction.animate(dt);
37727
37872
  if (h.IV) ivUpdate(h, dt, time, focus);
37728
37873
  if (time != null) animateClotheslines(time);
37729
- if (shared2.vegMaterials) {
37730
- shared2.vegMaterials.update((time != null ? time : performance.now()) / 1e3);
37731
- shared2.vegMaterials.setActors(focus ? [{ x: focus.x, y: focus.y, z: focus.z, radius: 0.9 }] : []);
37874
+ if (shared3.vegMaterials) {
37875
+ shared3.vegMaterials.update((time != null ? time : performance.now()) / 1e3);
37876
+ shared3.vegMaterials.setActors(focus ? [{ x: focus.x, y: focus.y, z: focus.z, radius: 0.9 }] : []);
37732
37877
  }
37733
37878
  if (focus && cfg.lod !== false) {
37734
37879
  const L = Object.assign({ interior: 45, hide: 220 }, cfg.lod), d = distance3(focus), at4 = h.lodCurrent;
@@ -37740,12 +37885,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37740
37885
  show(options2) {
37741
37886
  enter(h);
37742
37887
  const o = options2 || {};
37743
- const rr = shared2.ctx.r, nA = rr.floors.length, a = o.floor == null ? -1 : o.floor, sel = a >= nA ? -1 : a, cut = !!o.cut;
37888
+ const rr = shared3.ctx.r, nA = rr.floors.length, a = o.floor == null ? -1 : o.floor, sel = a >= nA ? -1 : a, cut = !!o.cut;
37744
37889
  for (const [k, g] of Object.entries(gs)) {
37745
37890
  let v = true;
37746
37891
  if (k[0] === "f") v = sel < 0 || +k.slice(1) <= sel;
37747
37892
  else if (k[0] === "t") v = !cut && (sel < 0 || +k.slice(1) < sel);
37748
- else if (k === "roof") v = !cut && sel < 0 && (!shared2.ctx.apartment || !shared2.ctx.showBuilding || shared2.ctx.pf === shared2.ctx.pa);
37893
+ else if (k === "roof") v = !cut && sel < 0 && (!shared3.ctx.apartment || !shared3.ctx.showBuilding || shared3.ctx.pf === shared3.ctx.pa);
37749
37894
  else if (k === "attic_tank") v = (cut || sel >= 0) && (sel < 0 || nA - 1 <= sel);
37750
37895
  else if (k === "lot") v = o.lot == null ? true : !!o.lot;
37751
37896
  g.visible = v;
@@ -37762,11 +37907,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37762
37907
  return actOn(a.target && a.target.pub ? a.target.pub : { id: a.target && a.target.id || a.text, type: a.target && a.target.kit ? a.target.type : "door", label: a.text, ref: a.target, _action: a.action, floor: 0, pos: [], radius: 0 }, a);
37763
37908
  },
37764
37909
  message() {
37765
- return shared2.inter.msg && performance.now() < shared2.inter.msg.until ? shared2.inter.msg.text : null;
37910
+ return shared3.inter.msg && performance.now() < shared3.inter.msg.until ? shared3.inter.msg.text : null;
37766
37911
  },
37767
37912
  toggleDoor(fo) {
37768
37913
  enter(h);
37769
- toggleDoor(typeof fo === "string" ? shared2.ctx.leaves.find((f) => f.id === fo) : fo);
37914
+ toggleDoor(typeof fo === "string" ? shared3.ctx.leaves.find((f) => f.id === fo) : fo);
37770
37915
  },
37771
37916
  lightOn(roomId) {
37772
37917
  enter(h);
@@ -37838,14 +37983,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37838
37983
  });
37839
37984
  root.removeFromParent();
37840
37985
  },
37841
- internal: { h, ctx: shared2.ctx, inter: shared2.inter, partState: shared2.partState, doorState: shared2.doorState, mirrors: shared2.mirrors }
37986
+ internal: { h, ctx: shared3.ctx, inter: shared3.inter, partState: shared3.partState, doorState: shared3.doorState, mirrors: shared3.mirrors }
37842
37987
  };
37843
37988
  return res;
37844
37989
  }
37845
37990
  const defined = { build };
37846
37991
  Object.assign(K, defined);
37847
37992
  }
37848
- function buildApi(K, shared2) {
37993
+ function buildApi(K, shared3) {
37849
37994
  const { cfg, VERSION: VERSION2, ATLAS, TEX, applyPart, carGroup, carModel, props, TYPES, roomLightMask, lighting, effectLights, newState, build } = K;
37850
37995
  return {
37851
37996
  version: VERSION2,
@@ -37855,15 +38000,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37855
38000
  mv: props,
37856
38001
  applyPart,
37857
38002
  // the kernel and the shared state, for recorders that run the team's builders into something else than the house (`furnitureSpec`, `tapSpec`): not a stable api
37858
- internals: { K, shared: shared2 },
38003
+ internals: { K, shared: shared3 },
37859
38004
  get materials() {
37860
- return shared2.mats;
38005
+ return shared3.mats;
37861
38006
  },
37862
38007
  roomLightMask,
37863
38008
  lighting,
37864
38009
  effectLights,
37865
38010
  setNight(n) {
37866
- const glass = shared2.mats.glass;
38011
+ const glass = shared3.mats.glass;
37867
38012
  glass.emissive.set(n ? 9067040 : 0);
37868
38013
  glass.opacity = n ? 0.4 : 0.24;
37869
38014
  },
@@ -37875,11 +38020,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37875
38020
  return m && { parts: m.parts.length, tris: m.tris, L: m.L, W: m.W, H: m.H };
37876
38021
  } },
37877
38022
  dispose() {
37878
- if (shared2.vegMaterials) {
37879
- shared2.vegMaterials.dispose();
37880
- shared2.vegMaterials = null;
38023
+ if (shared3.vegMaterials) {
38024
+ shared3.vegMaterials.dispose();
38025
+ shared3.vegMaterials = null;
37881
38026
  }
37882
- for (const m of Object.values(shared2.mats)) {
38027
+ for (const m of Object.values(shared3.mats)) {
37883
38028
  if (m && m.dispose) m.dispose();
37884
38029
  }
37885
38030
  for (const [k, t] of Object.entries(TEX)) if (t && t.dispose && !(cfg.textures && cfg.textures[k])) t.dispose();
@@ -37904,7 +38049,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37904
38049
  const colliderChanged = (c) => {
37905
38050
  if (c && cfg.onCollider) cfg.onCollider(c);
37906
38051
  };
37907
- const shared2 = { mats: null, quality: cfg.quality === "game" ? "game" : "high" };
38052
+ const shared3 = { mats: null, quality: cfg.quality === "game" ? "game" : "high" };
37908
38053
  const seedKey = (id) => {
37909
38054
  if (cfg.seedKey && id != null) {
37910
38055
  const k = cfg.seedKey(String(id));
@@ -37913,61 +38058,61 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
37913
38058
  return id;
37914
38059
  };
37915
38060
  const K = { t: createTranslator2(cfg.locale), seedKey, THREE: shapeGeometries(THREE), cfg, DOC, PROPS, Reflector, FLEET, HP, invalidate, invalidateShadow, colliderChanged, VERSION, rectsOf, isOpenArea, OPEN_ROOM_TYPES: OPEN_ROOM_TYPES2 };
37916
- installKernelGeometry(K, shared2);
37917
- installKernelNoise(K, shared2);
37918
- installMaterialsTextures(K, shared2);
37919
- installMaterialsMaterials(K, shared2);
37920
- installKernelCloseScene(K, shared2);
37921
- installHouseHelpers(K, shared2);
37922
- installHouseWalls(K, shared2);
37923
- installHouseDoors(K, shared2);
37924
- installHouseWindows(K, shared2);
37925
- installHouseFloors(K, shared2);
37926
- installHouseStairs(K, shared2);
37927
- installLightsFixtures(K, shared2);
37928
- installLightsDecor(K, shared2);
37929
- installLotTerrain(K, shared2);
37930
- installLotPerimeter(K, shared2);
37931
- installLotGates(K, shared2);
37932
- installRoofRoofs(K, shared2);
37933
- installRoofGutters(K, shared2);
37934
- installRoofSlabs(K, shared2);
37935
- installRoofTiles(K, shared2);
37936
- installRoofRect(K, shared2);
37937
- installMirrors(K, shared2);
37938
- installCars(K, shared2);
37939
- installHouseBuilding(K, shared2);
37940
- installUtilitiesWater(K, shared2);
37941
- installUtilitiesElectrical(K, shared2);
37942
- installHouseBaseboard(K, shared2);
37943
- installUtilitiesSolar(K, shared2);
37944
- installHouseOutbuildings(K, shared2);
37945
- installFurnitureApi(K, shared2);
37946
- installFurnitureBuilders(K, shared2);
37947
- installFurnitureTypeTable(K, shared2);
37948
- installFurnitureTaps(K, shared2);
37949
- installFurnitureFixtures(K, shared2);
37950
- installFurniturePlants(K, shared2);
37951
- installFurnitureYard(K, shared2);
37952
- installFurnitureExtraTypes(K, shared2);
37953
- installFurniturePlaceItems(K, shared2);
37954
- installVegetationBridge(K, shared2);
37955
- installInteractionState(K, shared2);
37956
- installInteractionCollision(K, shared2);
37957
- installInteractionItems(K, shared2);
37958
- installInteractionFittings(K, shared2);
37959
- installInteractionDoors(K, shared2);
37960
- installInteractionTarget(K, shared2);
37961
- installInteractablesBridge(K, shared2);
37962
- installAnimationClotheslines(K, shared2);
37963
- installBuildInstance(K, shared2);
37964
- installInteractablesKit(K, shared2);
37965
- installLightsRoomLight(K, shared2);
37966
- installDestructionPieces(K, shared2);
37967
- installDestructionBreach(K, shared2);
37968
- installDestructionWorld(K, shared2);
37969
- installBuildBuild(K, shared2);
37970
- return buildApi(K, shared2);
38061
+ installKernelGeometry(K, shared3);
38062
+ installKernelNoise(K, shared3);
38063
+ installMaterialsTextures(K, shared3);
38064
+ installMaterialsMaterials(K, shared3);
38065
+ installKernelCloseScene(K, shared3);
38066
+ installHouseHelpers(K, shared3);
38067
+ installHouseWalls(K, shared3);
38068
+ installHouseDoors(K, shared3);
38069
+ installHouseWindows(K, shared3);
38070
+ installHouseFloors(K, shared3);
38071
+ installHouseStairs(K, shared3);
38072
+ installLightsFixtures(K, shared3);
38073
+ installLightsDecor(K, shared3);
38074
+ installLotTerrain(K, shared3);
38075
+ installLotPerimeter(K, shared3);
38076
+ installLotGates(K, shared3);
38077
+ installRoofRoofs(K, shared3);
38078
+ installRoofGutters(K, shared3);
38079
+ installRoofSlabs(K, shared3);
38080
+ installRoofTiles(K, shared3);
38081
+ installRoofRect(K, shared3);
38082
+ installMirrors(K, shared3);
38083
+ installCars(K, shared3);
38084
+ installHouseBuilding(K, shared3);
38085
+ installUtilitiesWater(K, shared3);
38086
+ installUtilitiesElectrical(K, shared3);
38087
+ installHouseBaseboard(K, shared3);
38088
+ installUtilitiesSolar(K, shared3);
38089
+ installHouseOutbuildings(K, shared3);
38090
+ installFurnitureApi(K, shared3);
38091
+ installFurnitureBuilders(K, shared3);
38092
+ installFurnitureTypeTable(K, shared3);
38093
+ installFurnitureTaps(K, shared3);
38094
+ installFurnitureFixtures(K, shared3);
38095
+ installFurniturePlants(K, shared3);
38096
+ installFurnitureYard(K, shared3);
38097
+ installFurnitureExtraTypes(K, shared3);
38098
+ installFurniturePlaceItems(K, shared3);
38099
+ installVegetationBridge(K, shared3);
38100
+ installInteractionState(K, shared3);
38101
+ installInteractionCollision(K, shared3);
38102
+ installInteractionItems(K, shared3);
38103
+ installInteractionFittings(K, shared3);
38104
+ installInteractionDoors(K, shared3);
38105
+ installInteractionTarget(K, shared3);
38106
+ installInteractablesBridge(K, shared3);
38107
+ installAnimationClotheslines(K, shared3);
38108
+ installBuildInstance(K, shared3);
38109
+ installInteractablesKit(K, shared3);
38110
+ installLightsRoomLight(K, shared3);
38111
+ installDestructionPieces(K, shared3);
38112
+ installDestructionBreach(K, shared3);
38113
+ installDestructionWorld(K, shared3);
38114
+ installBuildBuild(K, shared3);
38115
+ return buildApi(K, shared3);
37971
38116
  }
37972
38117
 
37973
38118
  // ../game-floorplan-residential/dist/index.js
@@ -39067,7 +39212,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
39067
39212
  if (strip.alongU) return strip.side === "front" ? [r22(u0 + a0), r22(v0 + b0), r22(u0 + a1), r22(v0 + b1)] : [r22(u0 + a0), r22(v1 - b1), r22(u0 + a1), r22(v1 - b0)];
39068
39213
  return strip.side === "left" ? [r22(u0 + b0), r22(v0 + a0), r22(u0 + b1), r22(v0 + a1)] : [r22(u1 - b1), r22(v0 + a0), r22(u1 - b0), r22(v0 + a1)];
39069
39214
  };
39070
- function apartment(strip, floor2, k, from, to, plate2, ceiling, win) {
39215
+ function apartment(strip, floor2, k, from, to, plate3, ceiling, win) {
39071
39216
  const wide2 = to - from, depth = strip.depth, facade = r22(depth * 0.56);
39072
39217
  const id = (name) => `apt_${floor2}_${strip.id}_${k}_${name}`;
39073
39218
  const at4 = (f0, f1, b0, b1) => boxOf2(strip, r22(from + wide2 * f0), r22(from + wide2 * f1), b0, b1);
@@ -39085,7 +39230,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
39085
39230
  { a: id("hall"), b: id("bedroom"), width: 0.85, opensTo: id("bedroom") },
39086
39231
  { a: id("hall"), b: id("bath"), width: 0.8, opensTo: id("bath") }
39087
39232
  ];
39088
- const windows = rooms.filter((r) => r.type === "living" || r.type === "bedroom").flatMap((r) => exteriorWindows(r.id, r.rect, plate2, ceiling, { ...win, width: 2.2, spacing: 4.5 }));
39233
+ const windows = rooms.filter((r) => r.type === "living" || r.type === "bedroom").flatMap((r) => exteriorWindows(r.id, r.rect, plate3, ceiling, { ...win, width: 2.2, spacing: 4.5 }));
39089
39234
  if (strip.side === "back") {
39090
39235
  const [u0, , u1, v1] = rooms[0].rect;
39091
39236
  rooms.push({ id: id("balcony"), type: "balcony", label: "balcony", library: "balcony", rect: [r22(u0 + 0.6), v1, r22(u1 - 0.6), r22(v1 + 1.6)] });
@@ -39095,19 +39240,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
39095
39240
  return { rooms, doors, windows };
39096
39241
  }
39097
39242
  var SHARED_ROOMS = { west: { type: "laundry", label: "laundry_room" }, east: { type: "storage", label: "storage_room" } };
39098
- var apartments = (plan) => (strip, { floor: floor2, plate: plate2, ceiling }) => {
39243
+ var apartments = (plan) => (strip, { floor: floor2, plate: plate3, ceiling }) => {
39099
39244
  if (strip.length < plan.apartmentMin) {
39100
- const shared2 = SHARED_ROOMS[strip.id] ?? SHARED_ROOMS.east;
39101
- const id = `${shared2.label}_${floor2}_${strip.id}`;
39102
- return { rooms: [{ id, type: shared2.type, label: shared2.label, rect: [...strip.rect] }], doors: [stripDoor(id, strip, floor2, 0.9)], windows: exteriorWindows(id, strip.rect, plate2, ceiling, { ...plan.window, width: 1.2 }) };
39245
+ const shared3 = SHARED_ROOMS[strip.id] ?? SHARED_ROOMS.east;
39246
+ const id = `${shared3.label}_${floor2}_${strip.id}`;
39247
+ return { rooms: [{ id, type: shared3.type, label: shared3.label, rect: [...strip.rect] }], doors: [stripDoor(id, strip, floor2, 0.9)], windows: exteriorWindows(id, strip.rect, plate3, ceiling, { ...plan.window, width: 1.2 }) };
39103
39248
  }
39104
39249
  const count = Math.max(1, Math.round(strip.length / plan.apartment)), wide2 = strip.length / count;
39105
- const parts = Array.from({ length: count }, (_, k) => apartment(strip, floor2, k, r22(k * wide2), r22((k + 1) * wide2), plate2, ceiling, plan.window));
39250
+ const parts = Array.from({ length: count }, (_, k) => apartment(strip, floor2, k, r22(k * wide2), r22((k + 1) * wide2), plate3, ceiling, plan.window));
39106
39251
  return { rooms: parts.flatMap((p) => p.rooms), doors: parts.flatMap((p) => p.doors), windows: parts.flatMap((p) => p.windows) };
39107
39252
  };
39108
39253
  var groundFiller = (plan) => (strip, context) => {
39109
39254
  if (strip.id !== "south") return apartments(plan)(strip, context);
39110
- const { floor: floor2, plate: plate2, ceiling } = context;
39255
+ const { floor: floor2, plate: plate3, ceiling } = context;
39111
39256
  const lobby = `lobby_${floor2}_entrance`, concierge = `concierge_${floor2}`, bikes = `bike_room_${floor2}`;
39112
39257
  const at4 = (f0, f1) => boxOf2(strip, r22(strip.length * f0), r22(strip.length * f1), 0, strip.depth);
39113
39258
  const [left, middle, right] = [at4(0, 0.3), at4(0.3, 0.7), at4(0.7, 1)];
@@ -39122,7 +39267,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
39122
39267
  { a: concierge, b: lobby, width: 1.2, opensTo: concierge },
39123
39268
  { a: bikes, b: lobby, width: 1.2, opensTo: bikes }
39124
39269
  ];
39125
- return { rooms, doors, windows: exteriorWindows(concierge, left, plate2, ceiling, plan.window) };
39270
+ return { rooms, doors, windows: exteriorWindows(concierge, left, plate3, ceiling, plan.window) };
39126
39271
  };
39127
39272
  var summary = (l) => ({ storeys: l.storeys, height: l.height, slab: l.slab, pitch: l.pitch, total: l.total, bay: l.bay, plate: l.plate, mechanical: l.mechanical, facade: l.facade, damper: l.damper });
39128
39273
  function residentialTowerTemplate(preset = RESIDENTIAL_TOWER_DEFAULTS, planOptions = {}) {
@@ -39373,21 +39518,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
39373
39518
  const seed = Math.round(opts.seed ?? 1);
39374
39519
  const plain2 = SHELVING.test(type) ? "paper" : "plastic";
39375
39520
  const root = { x: seed, z: 0, ry: 0, w, d, h, y: 0, base: 0, palette: o.palette, seed: `furniture_${type}_${seed}` };
39376
- const { K, shared: shared2 } = renderer.internals;
39521
+ const { K, shared: shared3 } = renderer.internals;
39377
39522
  const before = K.PARTS.length;
39378
39523
  const made = recordSpec(
39379
39524
  THREE,
39380
39525
  type,
39381
39526
  root,
39382
39527
  (A) => {
39383
- const saved = { api0: shared2.api0, ctx: shared2.ctx };
39384
- shared2.api0 = A;
39385
- shared2.ctx = shared2.ctx ?? {};
39528
+ const saved = { api0: shared3.api0, ctx: shared3.ctx };
39529
+ shared3.api0 = A;
39530
+ shared3.ctx = shared3.ctx ?? {};
39386
39531
  try {
39387
39532
  ent.f(root, A);
39388
39533
  } finally {
39389
- shared2.api0 = saved.api0;
39390
- shared2.ctx = saved.ctx;
39534
+ shared3.api0 = saved.api0;
39535
+ shared3.ctx = saved.ctx;
39391
39536
  }
39392
39537
  },
39393
39538
  { materials: { plain: plain2, ...o.materials }, chairs: o.chairs, carcass: SHELVING.test(type) }
@@ -41255,8 +41400,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41255
41400
  h: 0.04,
41256
41401
  gl: 0.125,
41257
41402
  deagle: 1,
41258
- steel: 1,
41259
- rel: 1.8
41403
+ rel: 1.8,
41404
+ chrome: 1
41260
41405
  }
41261
41406
  },
41262
41407
  taurus_82: {
@@ -41583,7 +41728,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41583
41728
  barrel: 415,
41584
41729
  options: {
41585
41730
  wood: 1,
41586
- stock: "wood",
41731
+ stock: "ak",
41587
41732
  mag: "curved",
41588
41733
  hg: "wood",
41589
41734
  hgFrac: 0.42,
@@ -41593,7 +41738,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41593
41738
  rod: 1,
41594
41739
  bayo: 1,
41595
41740
  rpm: 600,
41596
- rel: 0.4
41741
+ rel: 0.4,
41742
+ kalashnikov: 1
41597
41743
  }
41598
41744
  },
41599
41745
  akm: {
@@ -41603,7 +41749,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41603
41749
  barrel: 415,
41604
41750
  options: {
41605
41751
  wood: 1,
41606
- stock: "wood",
41752
+ stock: "ak",
41607
41753
  mag: "curved",
41608
41754
  hg: "wood",
41609
41755
  hgFrac: 0.42,
@@ -41613,7 +41759,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41613
41759
  rod: 1,
41614
41760
  rpm: 600,
41615
41761
  magMat: "bakelite",
41616
- rel: 0.45
41762
+ rel: 0.45,
41763
+ kalashnikov: 1
41617
41764
  }
41618
41765
  },
41619
41766
  ak_74: {
@@ -41622,7 +41769,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41622
41769
  length: 943,
41623
41770
  barrel: 415,
41624
41771
  options: {
41625
- stock: "fixed",
41772
+ stock: "ak",
41626
41773
  mag: "curved",
41627
41774
  hg: "poly",
41628
41775
  hgFrac: 0.42,
@@ -41632,7 +41779,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41632
41779
  ak: 1,
41633
41780
  rod: 1,
41634
41781
  rpm: 650,
41635
- magMat: "bakelite"
41782
+ magMat: "bakelite",
41783
+ kalashnikov: 1,
41784
+ wood: 1
41636
41785
  }
41637
41786
  },
41638
41787
  ak_12: {
@@ -41827,7 +41976,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41827
41976
  barrel: 620,
41828
41977
  options: {
41829
41978
  wood: 1,
41830
- stock: "skeleton",
41979
+ stock: "svd",
41831
41980
  stockLen: 0.32,
41832
41981
  mag: "box",
41833
41982
  curve: 0.09,
@@ -41837,7 +41986,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41837
41986
  scope: 4,
41838
41987
  brake: 1,
41839
41988
  ak: 1,
41840
- charge: 1
41989
+ charge: 1,
41990
+ svd: 1
41841
41991
  }
41842
41992
  },
41843
41993
  fn_scar_h: {
@@ -41902,7 +42052,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41902
42052
  barrel: 650,
41903
42053
  options: {
41904
42054
  olive: 1,
41905
- stock: "trad",
42055
+ stock: "sporter",
41906
42056
  mag: "internal",
41907
42057
  scope: 3,
41908
42058
  bolt: 1,
@@ -41958,7 +42108,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41958
42108
  barrel: 610,
41959
42109
  options: {
41960
42110
  wood: 1,
41961
- stock: "trad",
42111
+ stock: "sporter",
41962
42112
  mag: "internal",
41963
42113
  scope: 3,
41964
42114
  bolt: 1,
@@ -41972,7 +42122,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
41972
42122
  barrel: 610,
41973
42123
  options: {
41974
42124
  olive: 1,
41975
- stock: "trad",
42125
+ stock: "sporter",
41976
42126
  mag: "internal",
41977
42127
  scope: 3,
41978
42128
  bolt: 1,
@@ -42136,7 +42286,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
42136
42286
  barrel: 560,
42137
42287
  options: {
42138
42288
  wood: 1,
42139
- stock: "trad",
42289
+ stock: "sporter",
42140
42290
  mag: "internal",
42141
42291
  scope: 3,
42142
42292
  bolt: 1,
@@ -42265,13 +42415,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
42265
42415
  barrel: 610,
42266
42416
  options: {
42267
42417
  wood: 1,
42268
- stock: "trad",
42418
+ stock: "sporter",
42269
42419
  mag: "internal",
42270
42420
  scope: 3,
42271
42421
  bolt: 1,
42272
42422
  round: 1
42273
- },
42274
- variantOf: "remington_700"
42423
+ }
42275
42424
  },
42276
42425
  hk_mp5sd3: {
42277
42426
  builder: "rifle",
@@ -42568,7 +42717,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
42568
42717
  barrel: 590,
42569
42718
  options: {
42570
42719
  wood: 1,
42571
- stock: "wood",
42720
+ stock: "ak",
42572
42721
  mag: "curved",
42573
42722
  hg: "wood",
42574
42723
  hgFrac: 0.42,
@@ -42580,9 +42729,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
42580
42729
  rpm: 600,
42581
42730
  rel: 0.4,
42582
42731
  bipod: 1,
42583
- magLen: 1.4
42584
- },
42585
- variantOf: "ak_47"
42732
+ magLen: 1.4,
42733
+ kalashnikov: 1
42734
+ }
42586
42735
  },
42587
42736
  sig_mpx: {
42588
42737
  builder: "rifle",
@@ -42682,9 +42831,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
42682
42831
  rod: 1,
42683
42832
  rpm: 700,
42684
42833
  magMat: "bakelite",
42685
- stockLen: 0.22
42686
- },
42687
- variantOf: "ak_74"
42834
+ stockLen: 0.22,
42835
+ kalashnikov: 1
42836
+ }
42688
42837
  },
42689
42838
  fn_scar_l: {
42690
42839
  builder: "rifle",
@@ -43041,6 +43190,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43041
43190
  metal: standard(3422010, 0.42, 0.75),
43042
43191
  steel: standard(7106418, 0.32, 0.85),
43043
43192
  steelL: standard(9080208, 0.28, 0.9),
43193
+ // polished steel: bright and glossy under plain lights too (the rooms have no environment map for a fully metallic surface to mirror)
43194
+ chrome: standard(13949148, 0.16, 0.5),
43044
43195
  dark: standard(1711133, 0.55, 0.5),
43045
43196
  poly: standard(2369058, 0.8, 0.05),
43046
43197
  olive: standard(4936241, 0.8, 0.05),
@@ -43420,6 +43571,107 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43420
43571
  for (let i = 0; i < 9; i++) kit.cylinderX(parts.mag, 45e-4, 0.042, kit.M.brass, 2e-3 + i * 1e-3, -0.01 - i * 0.0115, i % 2 ? 4e-3 : -4e-3, 8);
43421
43572
  }
43422
43573
 
43574
+ // src/models/wood-profile.ts
43575
+ var SLICE_LENGTH = 0.02;
43576
+ var at2 = (points, x) => {
43577
+ const last = points[points.length - 1];
43578
+ if (x >= last[0]) return [last[1], last[2]];
43579
+ const nextIndex = points.findIndex((point) => point[0] >= x);
43580
+ const next = points[Math.max(nextIndex, 1)];
43581
+ const previous = points[Math.max(nextIndex, 1) - 1];
43582
+ const fraction = (x - previous[0]) / (next[0] - previous[0]);
43583
+ return [previous[1] + (next[1] - previous[1]) * fraction, previous[2] + (next[2] - previous[2]) * fraction];
43584
+ };
43585
+ function profileBlock(kit, parent, points, width, material) {
43586
+ const first = points[0];
43587
+ const last = points[points.length - 1];
43588
+ const count = Math.max(1, Math.ceil((last[0] - first[0]) / SLICE_LENGTH));
43589
+ const step = (last[0] - first[0]) / count;
43590
+ for (let index = 0; index < count; index++) {
43591
+ const [rearTop, rearBottom] = at2(points, first[0] + step * index);
43592
+ const [frontTop, frontBottom] = at2(points, first[0] + step * (index + 1));
43593
+ const rise = (frontTop + frontBottom - rearTop - rearBottom) / 2;
43594
+ const height = (frontTop - frontBottom + rearTop - rearBottom) / 2;
43595
+ const centre = (rearTop + rearBottom + frontTop + frontBottom) / 4;
43596
+ kit.box(parent, Math.hypot(step, rise) * 1.12, height, width, material, first[0] + step * (index + 0.5), centre, 0, Math.atan2(rise, step));
43597
+ }
43598
+ }
43599
+ var BEVEL2 = 25e-4;
43600
+ var solids = /* @__PURE__ */ new WeakMap();
43601
+ function profileSolid(kit, parent, points, width, material, hole) {
43602
+ const key2 = JSON.stringify([points, width, hole ?? null]);
43603
+ const cache = solids.get(kit) ?? /* @__PURE__ */ new Map();
43604
+ solids.set(kit, cache);
43605
+ let geometry = cache.get(key2);
43606
+ if (!geometry) {
43607
+ geometry = buildSolid(kit, points, width, hole);
43608
+ markShared(geometry);
43609
+ cache.set(key2, geometry);
43610
+ }
43611
+ const { THREE } = kit;
43612
+ const mesh3 = new THREE.Mesh(geometry, material);
43613
+ mesh3.castShadow = true;
43614
+ mesh3.receiveShadow = true;
43615
+ parent.add(mesh3);
43616
+ return mesh3;
43617
+ }
43618
+ function buildSolid(kit, points, width, hole) {
43619
+ const { THREE } = kit;
43620
+ const top = points.map(([x, y]) => new THREE.Vector2(x, y));
43621
+ const bottom = [...points].reverse().map(([x, , y]) => new THREE.Vector2(x, y));
43622
+ const first = top[0];
43623
+ const shape = new THREE.Shape();
43624
+ shape.moveTo(first.x, first.y);
43625
+ shape.splineThru(top.slice(1));
43626
+ shape.lineTo(bottom[0].x, bottom[0].y);
43627
+ shape.splineThru(bottom.slice(1));
43628
+ shape.closePath();
43629
+ if (hole) {
43630
+ const loop = hole.map(([x, y]) => new THREE.Vector2(x, y));
43631
+ const path = new THREE.Path();
43632
+ path.moveTo(loop[0].x, loop[0].y);
43633
+ path.splineThru([...loop.slice(1), loop[0]]);
43634
+ shape.holes.push(path);
43635
+ }
43636
+ const depth = Math.max(2e-3, width - BEVEL2 * 2);
43637
+ const geometry = new THREE.ExtrudeGeometry(shape, { depth, curveSegments: 16, bevelEnabled: true, bevelThickness: BEVEL2, bevelSize: BEVEL2, bevelSegments: 2 });
43638
+ geometry.translate(0, 0, -depth / 2);
43639
+ return geometry;
43640
+ }
43641
+
43642
+ // src/models/rifle-svd.ts
43643
+ function buildSvdStock(context) {
43644
+ const { kit, group, furniture: furn, stockLength: S } = context;
43645
+ const width = 0.034;
43646
+ profileSolid(
43647
+ kit,
43648
+ group,
43649
+ [
43650
+ [6e-3, 0.02, -0.142],
43651
+ [0.07, 0.022, -0.13],
43652
+ [0.16, 0.024, -0.122],
43653
+ [S - 0.03, 0.027, -0.124],
43654
+ [S + 6e-3, 0.028, -0.128],
43655
+ [S + 0.035, -0.02, -0.13]
43656
+ ],
43657
+ width,
43658
+ furn,
43659
+ [[0.125, -0.02], [0.2, -0.018], [S - 0.01, -0.022], [S + 0.012, -0.05], [S - 0.01, -0.094], [0.2, -0.095], [0.125, -0.09], [0.112, -0.055]]
43660
+ );
43661
+ profileSolid(kit, group, [[0.06, 0.044, 0.016], [0.11, 0.05, 0.016], [0.2, 0.046, 0.016]], width * 0.9, furn);
43662
+ buttpad(kit, group, 3e-3, -0.06, 0.16, width);
43663
+ }
43664
+ function buildSvdHandguard(context) {
43665
+ const { kit, group, furniture: furn, receiverEnd: x1, receiverWidth: wR, barrelRadius: r, barrelY: by } = context;
43666
+ const { M, box: box5, cylinderX } = kit;
43667
+ const length2 = 0.27;
43668
+ profileSolid(kit, group, [[x1, by + 0.024, by - 0.03], [x1 + 0.06, by + 0.026, by - 0.03], [x1 + length2, by + 0.02, by - 0.024]], wR * 1.12, furn);
43669
+ for (let i = 0; i < 3; i++) for (const side of [-1, 1]) box5(group, 0.028, 8e-3, 2e-3, M.hole, x1 + 0.07 + i * 0.06, by + 4e-3, side * wR * 0.57);
43670
+ cylinderX(group, wR * 0.5, 0.012, M.metal, x1 + length2 + 6e-3, by, 0, 16);
43671
+ cylinderX(group, r * 1.2, 0.05, M.metal, x1 + length2 + 0.035, by + r * 2.4, 0, 12);
43672
+ box5(group, 0.016, r * 3.4, wR * 0.5, M.metal, x1 + length2 + 0.05, by + r * 1.2, 0);
43673
+ }
43674
+
43423
43675
  // src/models/rifle-forend.ts
43424
43676
  var PI4 = Math.PI;
43425
43677
  function buildForend(context) {
@@ -43429,6 +43681,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43429
43681
  buildG36Handguard(context);
43430
43682
  return;
43431
43683
  }
43684
+ if (o.svd) {
43685
+ buildSvdHandguard(context);
43686
+ return;
43687
+ }
43432
43688
  const hasLongScope = (o.scope ?? 0) >= 3;
43433
43689
  if (!context.isTraditional && o.hg !== "none") {
43434
43690
  const handguardLength = (L - x1) * (o.hgFrac || 0.5);
@@ -43509,6 +43765,82 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43509
43765
  return x;
43510
43766
  }
43511
43767
 
43768
+ // src/models/geometry-cache.ts
43769
+ var shared2 = /* @__PURE__ */ new WeakMap();
43770
+ function sharedGeometry(kit, key2, build) {
43771
+ const cache = shared2.get(kit) ?? /* @__PURE__ */ new Map();
43772
+ shared2.set(kit, cache);
43773
+ let geometry = cache.get(key2);
43774
+ if (!geometry) {
43775
+ geometry = build();
43776
+ markShared(geometry);
43777
+ cache.set(key2, geometry);
43778
+ }
43779
+ return geometry;
43780
+ }
43781
+
43782
+ // src/models/rifle-kalashnikov.ts
43783
+ function buildKalashnikovReceiver(context) {
43784
+ const { kit, group, receiverStart: x0, receiverEnd: x1, receiverWidth: wR, receiverLength: RL, receiverHeight: hR, barrelY: by } = context;
43785
+ const { M, box: box5, cylinderZ } = kit;
43786
+ const bottom = -hR / 2;
43787
+ profileSolid(kit, group, [[x0, 0.015, bottom + 0.012], [x0 + 0.035, 0.015, bottom], [x1, 0.015, bottom]], wR * 0.9, M.metal);
43788
+ profileSolid(kit, group, [[x0 + 2e-3, 0.021, 0.012], [x0 + RL * 0.5, 0.027, 0.012], [x1 - 4e-3, 0.031, 0.012]], wR * 0.8, M.metal);
43789
+ for (let i = 0; i < 4; i++) box5(group, 4e-3, 3e-3, wR * 0.6, M.dark, x0 + 0.03 + i * 0.012, 0.024 + i * 6e-4, 0);
43790
+ box5(group, 8e-3, 8e-3, 0.01, M.metal, x0 + 4e-3, 0.02, 0);
43791
+ profileSolid(kit, group, [[x1 - 8e-3, 0.034, by - 0.012], [x1 + 0.02, 0.031, by - 0.012], [x1 + 0.046, 0.024, by - 8e-3]], wR * 0.7, M.metal);
43792
+ box5(group, 0.036, 4e-3, wR * 0.5, M.dark, x1 + 0.018, 0.037, 0, -0.04);
43793
+ box5(group, 6e-3, 8e-3, wR * 0.5, M.dark, x1 + 2e-3, 0.039, 0);
43794
+ box5(group, RL * 0.48, 0.011, 3e-3, M.metal, x0 + RL * 0.36, 4e-3, wR * 0.46 + 15e-4, -0.05);
43795
+ box5(group, 0.012, 0.016, 3e-3, M.metal, x0 + RL * 0.62, -6e-3, wR * 0.46 + 15e-4, -0.3);
43796
+ for (const [x, y] of [[x0 + 0.012, -0.012], [x0 + 0.026, -0.012], [x1 - 0.03, -0.014], [x1 - 0.016, -0.014], [x1 - 0.03, 2e-3]]) {
43797
+ cylinderZ(group, 2e-3, wR * 0.9 + 2e-3, M.dark, x, y, 0, 8);
43798
+ }
43799
+ }
43800
+ var arcBand = (kit, parent, centre, radii, angles, depth, material) => {
43801
+ const { THREE } = kit;
43802
+ const geometry = sharedGeometry(kit, `arc:${JSON.stringify([centre, radii, angles, depth])}`, () => {
43803
+ const [inner, outer] = radii;
43804
+ const [start, end3] = angles;
43805
+ const shape = new THREE.Shape();
43806
+ shape.absarc(centre[0], centre[1], outer, start, end3, false);
43807
+ shape.absarc(centre[0], centre[1], inner, end3, start, true);
43808
+ shape.closePath();
43809
+ const bevel = Math.min(12e-4, depth / 6);
43810
+ const extruded = new THREE.ExtrudeGeometry(shape, { depth: depth - bevel * 2, curveSegments: 24, bevelEnabled: true, bevelThickness: bevel, bevelSize: bevel, bevelSegments: 1 });
43811
+ extruded.translate(0, 0, -(depth - bevel * 2) / 2);
43812
+ return extruded;
43813
+ });
43814
+ const mesh3 = new THREE.Mesh(geometry, material);
43815
+ mesh3.castShadow = true;
43816
+ mesh3.receiveShadow = true;
43817
+ parent.add(mesh3);
43818
+ return mesh3;
43819
+ };
43820
+ var CURVE_RADIUS = 0.33;
43821
+ var MAGAZINE_DEPTH2 = 0.052;
43822
+ var MAGAZINE_WIDTH = 0.024;
43823
+ var LENGTH_PER_SCALE = 0.2;
43824
+ function buildBananaMagazine(kit, magazine, material, scale) {
43825
+ const { M, box: box5 } = kit;
43826
+ const length2 = LENGTH_PER_SCALE * scale;
43827
+ const span = length2 / CURVE_RADIUS;
43828
+ const centre = [CURVE_RADIUS, 0];
43829
+ const start = Math.PI;
43830
+ const end3 = Math.PI + span;
43831
+ const half = MAGAZINE_DEPTH2 / 2;
43832
+ arcBand(kit, magazine, centre, [CURVE_RADIUS - half, CURVE_RADIUS + half], [start, end3], MAGAZINE_WIDTH, material);
43833
+ for (const radius of [CURVE_RADIUS - half * 0.45, CURVE_RADIUS + half * 0.45]) {
43834
+ arcBand(kit, magazine, centre, [radius - 25e-4, radius + 25e-4], [start + span * 0.08, end3 - span * 0.06], MAGAZINE_WIDTH + 3e-3, material);
43835
+ }
43836
+ box5(magazine, 0.01, 8e-3, MAGAZINE_WIDTH * 0.7, M.metal, half - 2e-3, 2e-3, 0);
43837
+ const bottom = [centre[0] + CURVE_RADIUS * Math.cos(end3), centre[1] + CURVE_RADIUS * Math.sin(end3)];
43838
+ const plate3 = box5(magazine, MAGAZINE_DEPTH2 + 6e-3, 6e-3, MAGAZINE_WIDTH + 4e-3, material, bottom[0], bottom[1], 0, span);
43839
+ plate3.position.x += Math.sin(span) * 2e-3;
43840
+ plate3.position.y -= Math.cos(span) * 2e-3;
43841
+ return length2 + 0.04;
43842
+ }
43843
+
43512
43844
  // src/models/rifle-controls.ts
43513
43845
  function buildGrip(context) {
43514
43846
  const { kit, group, parts, options: o, furniture: furn, receiverStart: x0, receiverHeight: hR, receiverWidth: wR } = context;
@@ -43537,7 +43869,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43537
43869
  const magazine = kit.pivot(group, mx, -hR / 2, 0);
43538
43870
  parts.mag = magazine;
43539
43871
  const finish = o.magMat === "bakelite" ? M.bakelite : o.magMat === "poly" ? M.polyMag : o.magMat === "smoke" ? M.smoke : void 0;
43540
- if (o.mag === "curved") {
43872
+ if (o.mag === "curved" && o.kalashnikov) {
43873
+ parts.magDrop = buildBananaMagazine(kit, magazine, finish ?? M.metal, scale);
43874
+ } else if (o.mag === "curved") {
43541
43875
  let px = 0;
43542
43876
  let py = 0;
43543
43877
  const material = finish ?? M.metal;
@@ -43660,10 +43994,56 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43660
43994
  return { group, parts };
43661
43995
  }
43662
43996
 
43997
+ // src/models/rifle-sporter.ts
43998
+ function buildSporterStock(context, magazineX) {
43999
+ const { kit, group, furniture: furn, length: L, stockLength: S, receiverEnd: x1, receiverHeight: hR } = context;
44000
+ const { M, box: box5 } = kit;
44001
+ const forendTip = x1 + (L - x1) * (context.options.fore ?? 0.5);
44002
+ const bottom = -hR / 2;
44003
+ const bedTop = context.options.round ? context.barrelY - hR * 0.36 + 3e-3 : bottom + 0.012;
44004
+ profileSolid(
44005
+ kit,
44006
+ group,
44007
+ [
44008
+ [6e-3, -0.016, -0.15],
44009
+ [0.14, -0.012, -0.118],
44010
+ [S - 0.11, -0.016, -0.084],
44011
+ [S - 0.05, -0.018, -0.114],
44012
+ [S - 0.01, -0.016, -0.09],
44013
+ [S + 0.03, bedTop, bottom - 0.03],
44014
+ [x1, bedTop, bottom - 0.026],
44015
+ [x1 + 0.08, bedTop, bottom - 0.024],
44016
+ [forendTip, bottom + 0.02, bottom - 0.012]
44017
+ ],
44018
+ 0.04,
44019
+ furn
44020
+ );
44021
+ buttpad(kit, group, 0, -0.083, 0.136, 0.04);
44022
+ box5(group, 0.024, 6e-3, 0.03, M.dark, S - 0.05, -0.116, 0, -0.5);
44023
+ const guard = kit.torus(group, new kit.THREE.TorusGeometry(0.024, 25e-4, 6, 16, Math.PI), M.metal, S + 0.075, bottom - 0.022, 0);
44024
+ guard.rotation.z = Math.PI;
44025
+ box5(group, 0.07, 4e-3, 0.03, M.metal, magazineX, bottom - 0.03, 0);
44026
+ swivel(kit, group, 0.12, -0.12);
44027
+ swivel(kit, group, forendTip - 0.05, bottom - 0.02);
44028
+ }
44029
+ function buildKalashnikovStock(context) {
44030
+ const { kit, group, furniture: furn, stockLength: S, receiverHeight: hR } = context;
44031
+ const { M, box: box5 } = kit;
44032
+ profileSolid(kit, group, [[8e-3, -0.034, -0.15], [S * 0.5, -0.014, -0.1], [S + 4e-3, hR * 0.2, -hR / 2 - 2e-3]], 0.036, furn);
44033
+ box5(group, 8e-3, 0.118, 0.038, M.metal, 4e-3, -0.092, 0, -0.06);
44034
+ const loopX = 0.1;
44035
+ const belly = -0.15 + (loopX - 8e-3) / (S * 0.5 - 8e-3) * 0.05;
44036
+ box5(group, 0.03, 6e-3, 6e-3, M.metal, loopX, belly + 0.032, -0.019, 0.3);
44037
+ }
44038
+
43663
44039
  // src/models/rifle-stock.ts
43664
44040
  function buildStock(context, magazineX) {
43665
44041
  const { kit, group, options: o, furniture: furn, length: L, stockLength: S, receiverStart: x0, receiverEnd: x1, receiverHeight: hR } = context;
43666
44042
  const { M, box: box5, cylinderX } = kit;
44043
+ if (o.stock === "sporter") {
44044
+ buildSporterStock(context, magazineX);
44045
+ return;
44046
+ }
43667
44047
  if (context.isTraditional) {
43668
44048
  buttpad(kit, group, 6e-3, -0.04, 0.13, 0.038);
43669
44049
  box5(group, 0.03, 0.13, 0.038, furn, 0.024, -0.04, 0);
@@ -43695,6 +44075,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43695
44075
  buttpad(kit, group, 3e-3, -0.025, 0.11, 0.036);
43696
44076
  } else if (o.stock === "g36") {
43697
44077
  buildG36Stock(context);
44078
+ } else if (o.stock === "ak") {
44079
+ buildKalashnikovStock(context);
44080
+ } else if (o.stock === "svd") {
44081
+ buildSvdStock(context);
43698
44082
  } else if (o.stock === "fold") {
43699
44083
  box5(group, S, 6e-3, 6e-3, M.metal, S / 2, 0.01, 0.012);
43700
44084
  box5(group, S, 6e-3, 6e-3, M.metal, S / 2, -0.04, 0.012, -0.12);
@@ -43710,6 +44094,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43710
44094
  const receiverMaterial = o.tan ? M.tan : M.metal;
43711
44095
  const middle = (x0 + x1) / 2;
43712
44096
  if (o.g36) buildG36Receiver(context);
44097
+ else if (o.kalashnikov) buildKalashnikovReceiver(context);
43713
44098
  else if (o.round) {
43714
44099
  cylinderX(group, hR * 0.36, RL, M.steel, middle, by, 0, 20);
43715
44100
  cylinderX(group, hR * 0.32, 0.05, M.steel, x0 - 0.01, by, 0, 18);
@@ -43722,7 +44107,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43722
44107
  box5(group, 0.03, 8e-3, 0.012, M.dark, x0 + 0.02, hR / 2 + 4e-3, 0);
43723
44108
  box5(group, 0.012, 6e-3, 4e-3, M.dark, x0 + RL * 0.55, -hR * 0.15, -wR / 2 - 2e-3);
43724
44109
  } else box5(group, RL, hR, wR, receiverMaterial, middle, 0, 0);
43725
- if (o.ak) {
44110
+ if (o.ak && !o.kalashnikov) {
43726
44111
  box5(group, RL * 0.86, hR * 0.28, wR * 0.95, M.metal, middle - 8e-3, hR / 2 + 4e-3, 0);
43727
44112
  for (let i = 0; i < 3; i++) box5(group, 4e-3, hR * 0.3, wR * 0.97, M.dark, x0 + RL * 0.25 + i * 0.02, hR / 2 + 4e-3, 0);
43728
44113
  box5(group, RL * 0.5, 0.012, 3e-3, M.metal, x0 + RL * 0.55, -hR * 0.02, wR / 2 + 15e-4, -0.05);
@@ -43785,7 +44170,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
43785
44170
  const parts = { family: "rifle", glow: [] };
43786
44171
  const length2 = (options.L ?? 0) / 1e3;
43787
44172
  const barrelLength = (options.B ?? 0) / 1e3;
43788
- const isTraditional = options.stock === "trad" || options.stock === "straight";
44173
+ const isTraditional = options.stock === "trad" || options.stock === "straight" || options.stock === "sporter";
43789
44174
  const stockLength = options.stock === "none" ? 0 : options.stockLen || Math.min(0.36, Math.max(0.2, 0.3 * length2));
43790
44175
  const receiverStart = stockLength;
43791
44176
  const receiverEnd = Math.max(receiverStart + 0.12, length2 - barrelLength * 0.92);
@@ -44718,7 +45103,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
44718
45103
 
44719
45104
  // src/models/ps90.ts
44720
45105
  var WIDTH = 0.046;
44721
- var BEVEL2 = 5e-3;
45106
+ var BEVEL3 = 5e-3;
44722
45107
  var BODY_OUTLINE = [
44723
45108
  [0.017, -0.078],
44724
45109
  [0.03, -0.09],
@@ -44760,8 +45145,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
44760
45145
  const toVector = ([x, y]) => new THREE.Vector2(x, y);
44761
45146
  const shape = new THREE.Shape(outline.map(toVector));
44762
45147
  for (const hole of holes) shape.holes.push(new THREE.Path(hole.map(toVector)));
44763
- const geometry = new THREE.ExtrudeGeometry(shape, { depth: width - 2 * BEVEL2, bevelEnabled: true, bevelThickness: BEVEL2, bevelSize: BEVEL2, bevelSegments: 2 });
44764
- geometry.translate(0, 0, -(width - 2 * BEVEL2) / 2);
45148
+ const geometry = new THREE.ExtrudeGeometry(shape, { depth: width - 2 * BEVEL3, bevelEnabled: true, bevelThickness: BEVEL3, bevelSize: BEVEL3, bevelSegments: 2 });
45149
+ geometry.translate(0, 0, -(width - 2 * BEVEL3) / 2);
44765
45150
  const mesh3 = new THREE.Mesh(geometry, material);
44766
45151
  mesh3.castShadow = true;
44767
45152
  mesh3.receiveShadow = true;
@@ -45034,6 +45419,135 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45034
45419
  return { group, parts };
45035
45420
  }
45036
45421
 
45422
+ // src/models/pistol-deagle.ts
45423
+ var SLIDE_HEIGHT = 0.036;
45424
+ var WIDTH2 = 0.032;
45425
+ var FRAME_HEIGHT = 0.015;
45426
+ var FRAME_BOTTOM = -SLIDE_HEIGHT / 2 - FRAME_HEIGHT;
45427
+ var GRIP = { angle: -0.314, depth: 0.052, width: 0.034, length: 0.1, rearX: 0.014 };
45428
+ var GUARD = { drop: 0.038, front: 0.064, bar: 65e-4, depth: 0.011 };
45429
+ var SLIDE_SHARE = 0.55;
45430
+ var plate = (kit, parent, outline, hole, depth, material) => {
45431
+ const { THREE } = kit;
45432
+ const geometry = sharedGeometry(kit, `plate:${JSON.stringify([outline, hole, depth])}`, () => {
45433
+ const shape = new THREE.Shape(outline.map(([x, y]) => new THREE.Vector2(x, y)));
45434
+ if (hole) shape.holes.push(new THREE.Path(hole.map(([x, y]) => new THREE.Vector2(x, y))));
45435
+ const extruded = new THREE.ExtrudeGeometry(shape, { depth, bevelEnabled: true, bevelThickness: 8e-4, bevelSize: 8e-4, bevelSegments: 1 });
45436
+ extruded.translate(0, 0, -depth / 2);
45437
+ return extruded;
45438
+ });
45439
+ const mesh3 = new THREE.Mesh(geometry, material);
45440
+ mesh3.castShadow = true;
45441
+ mesh3.receiveShadow = true;
45442
+ parent.add(mesh3);
45443
+ return mesh3;
45444
+ };
45445
+ var buildUpper = (kit, group, slide2, parts, length2, metal2) => {
45446
+ const { M, box: box5, cylinderX } = kit;
45447
+ const slideLength = length2 * SLIDE_SHARE;
45448
+ const barrelLength = length2 - slideLength;
45449
+ kit.roundness = 0.06;
45450
+ box5(slide2, slideLength, SLIDE_HEIGHT, WIDTH2, metal2, slideLength / 2, 0, 0);
45451
+ const barrel = heatify(parts.glow ?? [], box5(group, barrelLength, SLIDE_HEIGHT, WIDTH2, metal2, slideLength + barrelLength / 2, 0, 0));
45452
+ barrel.name = "barrel";
45453
+ kit.roundness = null;
45454
+ box5(group, 12e-4, SLIDE_HEIGHT * 0.9, WIDTH2 + 4e-4, M.dark, slideLength, 0, 0);
45455
+ for (let i = 0; i < 9; i++) box5(slide2, 22e-4, SLIDE_HEIGHT * 0.66, WIDTH2 + 12e-4, M.dark, 8e-3 + i * 48e-4, -3e-3, 0);
45456
+ box5(slide2, length2 * 0.08, 3e-3, WIDTH2 * 0.5, M.hole, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.12);
45457
+ box5(slide2, 7e-3, 6e-3, 0.014, M.dark, 8e-3, SLIDE_HEIGHT / 2 + 3e-3, 0);
45458
+ box5(slide2, 3e-3, 2e-3, 4e-3, M.hole, 8e-3, SLIDE_HEIGHT / 2 + 5e-3, 0);
45459
+ box5(group, barrelLength * 0.9, 4e-3, WIDTH2 * 0.42, metal2, slideLength + barrelLength * 0.5, SLIDE_HEIGHT / 2 + 2e-3, 0);
45460
+ for (let i = 0; i < 7; i++) box5(group, 4e-3, 15e-4, WIDTH2 * 0.43, M.hole, slideLength + 0.01 + i * 0.013, SLIDE_HEIGHT / 2 + 4e-3, 0);
45461
+ box5(group, 4e-3, 6e-3, 4e-3, M.dark, length2 - 6e-3, SLIDE_HEIGHT / 2 + 6e-3, 0);
45462
+ const nose = plate(kit, group, [[-WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 / 2, -SLIDE_HEIGHT / 2 + 2e-3], [WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3], [-WIDTH2 * 0.16, SLIDE_HEIGHT / 2 - 2e-3]], null, 3e-3, metal2);
45463
+ nose.rotation.y = Math.PI / 2;
45464
+ nose.position.set(length2 + 15e-4, 0, 0);
45465
+ const boreY = -SLIDE_HEIGHT * 0.12;
45466
+ cylinderX(group, 64e-4, 4e-3, M.hole, length2 + 3e-3, boreY, 0, 14);
45467
+ return boreY;
45468
+ };
45469
+ var buildGrip2 = (kit, group, parts, metal2) => {
45470
+ const { M, box: box5 } = kit;
45471
+ const { angle, depth, width, length: length2 } = GRIP;
45472
+ const sin2 = Math.sin(angle);
45473
+ const cos2 = Math.cos(angle);
45474
+ const topY = FRAME_BOTTOM + 6e-3;
45475
+ const centerX = GRIP.rearX + depth / 2 * cos2 + length2 / 2 * sin2;
45476
+ const centerY = topY - length2 / 2 * cos2 + depth / 2 * sin2;
45477
+ const grip = kit.pivot(group, centerX, centerY, 0);
45478
+ grip.rotation.z = angle;
45479
+ parts.grip = grip;
45480
+ kit.roundness = 0.22;
45481
+ box5(grip, depth, length2, width * 0.86, metal2, 0, 0, 0);
45482
+ box5(grip, depth * 0.86, length2 * 0.84, width, M.rubber, -2e-3, 2e-3, 0);
45483
+ kit.roundness = null;
45484
+ for (let i = 0; i < 8; i++) box5(grip, depth * 0.66, 2e-3, width + 12e-4, M.dark, -3e-3, -length2 * 0.36 + i * 0.0105, 0);
45485
+ const magazine = kit.pivot(grip);
45486
+ parts.mag = magazine;
45487
+ parts.magDrop = length2 * 1.15;
45488
+ box5(magazine, depth * 0.62, length2 * 0.94, width * 0.66, M.dark, 2e-3, -4e-3, 0);
45489
+ box5(magazine, depth * 0.98, 6e-3, width * 0.9, metal2, 0, -length2 / 2 + 3e-3, 0);
45490
+ const frontTopX = centerX + depth / 2 * cos2 - length2 / 2 * sin2;
45491
+ const frontTopY = centerY + depth / 2 * sin2 + length2 / 2 * cos2;
45492
+ return (y) => frontTopX + (frontTopY - y) * Math.tan(angle);
45493
+ };
45494
+ var buildGuard = (kit, group, frontStrapAt, metal2) => {
45495
+ const top = FRAME_BOTTOM + 2e-3;
45496
+ const bottom = FRAME_BOTTOM - GUARD.drop;
45497
+ const backTop = frontStrapAt(top) - 4e-3;
45498
+ const backBottom = frontStrapAt(bottom) - 4e-3;
45499
+ const front = backTop + GUARD.front;
45500
+ const bar2 = GUARD.bar;
45501
+ const corner = 8e-3;
45502
+ const outline = [
45503
+ [backTop, top],
45504
+ [backBottom, bottom],
45505
+ [front - corner, bottom],
45506
+ [front, bottom + corner],
45507
+ [front + 2e-3, top]
45508
+ ];
45509
+ const hole = [
45510
+ [backTop + bar2 + 2e-3, top - 2e-3],
45511
+ [front - bar2 + 1e-3, top - 2e-3],
45512
+ [front - bar2, bottom + bar2 + corner * 0.6],
45513
+ [front - bar2 - corner * 0.6, bottom + bar2],
45514
+ [backBottom + bar2 + 4e-3, bottom + bar2]
45515
+ ];
45516
+ plate(kit, group, outline, hole, GUARD.depth, metal2);
45517
+ return bottom;
45518
+ };
45519
+ function buildDeagle(kit, options) {
45520
+ const { M, box: box5, torus: torus2, THREE } = kit;
45521
+ const length2 = (options.L ?? 0) / 1e3 * 0.97;
45522
+ const metal2 = options.chrome ? M.chrome : options.steel ? M.steel : options.stain ? M.steelL : M.metal;
45523
+ const group = kit.group();
45524
+ const parts = { family: "pistol", kick: 1.8, glow: [] };
45525
+ const slide2 = kit.pivot(group);
45526
+ parts.slide = slide2;
45527
+ parts.stroke = length2 * 0.12;
45528
+ const boreY = buildUpper(kit, group, slide2, parts, length2, metal2);
45529
+ kit.roundness = 0.1;
45530
+ box5(group, length2 * 0.95, FRAME_HEIGHT, WIDTH2 * 0.94, metal2, length2 * 0.5 - 2e-3, -SLIDE_HEIGHT / 2 - FRAME_HEIGHT / 2, 0);
45531
+ kit.roundness = null;
45532
+ box5(group, length2 * 0.3, 3e-3, WIDTH2 * 0.94 + 1e-3, M.dark, length2 * 0.72, -SLIDE_HEIGHT / 2 - FRAME_HEIGHT * 0.6, 0);
45533
+ box5(group, 0.026, 9e-3, WIDTH2 * 0.9, metal2, -2e-3, FRAME_BOTTOM + 4e-3, 0, 0.3);
45534
+ box5(group, 0.016, 5e-3, 4e-3, M.dark, length2 * 0.36, -SLIDE_HEIGHT / 2 - 5e-3, -WIDTH2 / 2 - 14e-4);
45535
+ const frontStrapAt = buildGrip2(kit, group, parts, metal2);
45536
+ buildGuard(kit, group, frontStrapAt, metal2);
45537
+ const triggerX = frontStrapAt(FRAME_BOTTOM) + 0.02;
45538
+ parts.trigger = box5(group, 6e-3, 0.026, 7e-3, M.steel, triggerX, FRAME_BOTTOM - 8e-3, 0, 0.28);
45539
+ const hammer2 = kit.pivot(group, 2e-3, SLIDE_HEIGHT * 0.05, 0);
45540
+ parts.hammer = hammer2;
45541
+ box5(hammer2, 0.012, 0.02, 0.01, M.dark, -4e-3, 4e-3, 0, 0.35);
45542
+ const ring3 = torus2(hammer2, new THREE.TorusGeometry(68e-4, 24e-4, 8, 16), M.dark, -0.01, 0.014, 0);
45543
+ ring3.scale.z = 2;
45544
+ parts.safety = box5(slide2, 0.014, 8e-3, 4e-3, M.dark, 0.02, SLIDE_HEIGHT * 0.1, -WIDTH2 / 2 - 2e-3, 0.2);
45545
+ box5(slide2, 0.014, 8e-3, 4e-3, M.dark, 0.02, SLIDE_HEIGHT * 0.1, WIDTH2 / 2 + 2e-3, 0.2);
45546
+ parts.muzzle = kit.mark(group, length2 + 6e-3, boreY, 0);
45547
+ parts.eject = kit.mark(group, length2 * 0.42, SLIDE_HEIGHT / 2, WIDTH2 * 0.25);
45548
+ return { group, parts };
45549
+ }
45550
+
45037
45551
  // src/models/pistol-slide.ts
45038
45552
  var PI9 = Math.PI;
45039
45553
  function buildSlide(kit, slide2, parts, options, style, size, metal2) {
@@ -45186,6 +45700,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45186
45700
  }
45187
45701
  function buildPistol(kit, options) {
45188
45702
  if (options.design && isDesignName(options.design)) return buildDesignedPistol(kit, options, options.design);
45703
+ if (options.st === "deagle") return buildDeagle(kit, options);
45189
45704
  const { M, box: box5 } = kit;
45190
45705
  const style = { ...STYLES[options.st ?? "glock"] };
45191
45706
  const group = kit.group();
@@ -45358,32 +45873,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45358
45873
  return { group, parts };
45359
45874
  }
45360
45875
 
45361
- // src/models/wood-profile.ts
45362
- var SLICE_LENGTH = 0.02;
45363
- var at2 = (points, x) => {
45364
- const last = points[points.length - 1];
45365
- if (x >= last[0]) return [last[1], last[2]];
45366
- const nextIndex = points.findIndex((point) => point[0] >= x);
45367
- const next = points[Math.max(nextIndex, 1)];
45368
- const previous = points[Math.max(nextIndex, 1) - 1];
45369
- const fraction = (x - previous[0]) / (next[0] - previous[0]);
45370
- return [previous[1] + (next[1] - previous[1]) * fraction, previous[2] + (next[2] - previous[2]) * fraction];
45371
- };
45372
- function profileBlock(kit, parent, points, width, material) {
45373
- const first = points[0];
45374
- const last = points[points.length - 1];
45375
- const count = Math.max(1, Math.ceil((last[0] - first[0]) / SLICE_LENGTH));
45376
- const step = (last[0] - first[0]) / count;
45377
- for (let index = 0; index < count; index++) {
45378
- const [rearTop, rearBottom] = at2(points, first[0] + step * index);
45379
- const [frontTop, frontBottom] = at2(points, first[0] + step * (index + 1));
45380
- const rise = (frontTop + frontBottom - rearTop - rearBottom) / 2;
45381
- const height = (frontTop - frontBottom + rearTop - rearBottom) / 2;
45382
- const centre = (rearTop + rearBottom + frontTop + frontBottom) / 4;
45383
- kit.box(parent, Math.hypot(step, rise) * 1.12, height, width, material, first[0] + step * (index + 0.5), centre, 0, Math.atan2(rise, step));
45384
- }
45385
- }
45386
-
45387
45876
  // src/models/rifle-kar98.ts
45388
45877
  var RECEIVER_START3 = 0.29;
45389
45878
  var RECEIVER_END3 = 0.5;
@@ -45926,14 +46415,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45926
46415
  movable: false
45927
46416
  };
45928
46417
  }
45929
- function showcaseSheet(arsenal, text, weapon) {
45930
- const name = arsenal.name(weapon);
46418
+ function showcasePhoto(arsenal, text, weapon) {
45931
46419
  const photo2 = PHOTOS[weapon];
45932
- if (!photo2) return { kicker: text.kicker, title: name, note: text.noPhoto };
45933
- return { kicker: text.kicker, title: name, image: { url: photo2.url, alt: fill(text.alt, { weapon: name }), credit: `${photo2.author} \xB7 ${photo2.license}`, page: photo2.page } };
46420
+ if (!photo2) return void 0;
46421
+ return { url: photo2.url, alt: fill(text.alt, { weapon: arsenal.name(weapon) }), credit: `${photo2.author} \xB7 ${photo2.license}`, page: photo2.page };
45934
46422
  }
45935
46423
  function createWeaponShowcase(options) {
45936
- const { arsenal, host, text } = options;
46424
+ const { arsenal, host, text, referencePhotos = false } = options;
45937
46425
  const THREE = host.THREE;
45938
46426
  const scene = host.scene;
45939
46427
  const centre = [SHOWCASE.at[0], SHOWCASE.height + SHOWCASE.lift, SHOWCASE.at[2]];
@@ -45943,7 +46431,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45943
46431
  if (!shown) return;
45944
46432
  discardObject3D(shown.root);
45945
46433
  shown = null;
45946
- host.bench?.sheet?.(null);
46434
+ if (referencePhotos) host.cornerImage?.(null);
45947
46435
  };
45948
46436
  const look = () => host.bench?.look([centre[0] + SHOWCASE.eye[0], centre[1] + SHOWCASE.eye[1], centre[2] + SHOWCASE.eye[2]], centre);
45949
46437
  const show = (weapon) => {
@@ -45957,7 +46445,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45957
46445
  holder.position.set(...centre);
45958
46446
  scene.add(holder);
45959
46447
  shown = { id: weapon, root: holder };
45960
- host.bench?.sheet?.(showcaseSheet(arsenal, text, weapon));
46448
+ if (referencePhotos) host.cornerImage?.(showcasePhoto(arsenal, text, weapon) ?? null);
45961
46449
  host.log(fill(text.shown, { weapon: arsenal.name(weapon) }), { weapon, photo: weapon in PHOTOS });
45962
46450
  look();
45963
46451
  };
@@ -45990,26 +46478,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
45990
46478
  en: {
45991
46479
  pedestal: "Weapon showcase",
45992
46480
  weapon: "Showcase",
45993
- weaponHint: "Puts the weapon on the pedestal, turning slowly, takes the camera to it and shows a photo of the real one to compare with",
46481
+ weaponHint: "Puts the weapon on the pedestal, turning slowly, and takes the camera to it",
45994
46482
  none: "None",
45995
46483
  spin: "Turn the weapon",
45996
46484
  look: "Look at the showcase",
45997
- kicker: "The real weapon",
45998
46485
  alt: "Photo of a real {weapon}",
45999
- shown: "{weapon} on the showcase",
46000
- noPhoto: "No free photo of this exact model was found: it is listed in missing of assets/weapon-references.json."
46486
+ shown: "{weapon} on the showcase"
46001
46487
  },
46002
46488
  "pt-BR": {
46003
46489
  pedestal: "Vitrine de armas",
46004
46490
  weapon: "Vitrine",
46005
- weaponHint: "P\xF5e a arma no pedestal, girando devagar, leva a c\xE2mera at\xE9 ela e mostra uma foto da arma real para comparar",
46491
+ weaponHint: "P\xF5e a arma no pedestal, girando devagar, e leva a c\xE2mera at\xE9 ela",
46006
46492
  none: "Nenhuma",
46007
46493
  spin: "Girar a arma",
46008
46494
  look: "Olhar a vitrine",
46009
- kicker: "A arma real",
46010
46495
  alt: "Foto de um(a) {weapon} real",
46011
- shown: "{weapon} na vitrine",
46012
- noPhoto: "N\xE3o h\xE1 foto livre deste modelo exato: ele est\xE1 em missing de assets/weapon-references.json."
46496
+ shown: "{weapon} na vitrine"
46013
46497
  }
46014
46498
  };
46015
46499
  var showcaseTextOf = (locale) => TEXT[locale] ?? TEXT.en;
@@ -47943,7 +48427,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
47943
48427
  const registry = createSoundRegistry(options.banks);
47944
48428
  const voices = createVoiceManager({ ...options.groups ? { groups: options.groups } : {}, ...options.maxVoices === void 0 ? {} : { maxVoices: options.maxVoices } });
47945
48429
  const engineRandom = createRng3(seed);
47946
- const shared2 = createNoiseStore(engineRandom);
48430
+ const shared3 = createNoiseStore(engineRandom);
47947
48431
  const busSettings = /* @__PURE__ */ new Map();
47948
48432
  const busNodes = /* @__PURE__ */ new Map();
47949
48433
  const meters = /* @__PURE__ */ new Map();
@@ -48019,7 +48503,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48019
48503
  if (!created) return null;
48020
48504
  context = created;
48021
48505
  chain = buildChain(created, mix3, engineRandom);
48022
- if (mix3.noise.create === "eager") noiseBuffer(shared2, created, mix3.noise.seconds);
48506
+ if (mix3.noise.create === "eager") noiseBuffer(shared3, created, mix3.noise.seconds);
48023
48507
  for (const [bus, setting] of Object.entries(mix3.buses ?? {})) {
48024
48508
  busSettings.set(bus, { ...setting, ...busSettings.get(bus) });
48025
48509
  }
@@ -48245,8 +48729,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48245
48729
  const loopHost = {
48246
48730
  ready,
48247
48731
  output: outputFor,
48248
- prepareNoise: () => context && prepareNoise(shared2, context, mix3.noise.seconds),
48249
- noise: () => noiseBuffer(shared2, context, mix3.noise.seconds),
48732
+ prepareNoise: () => context && prepareNoise(shared3, context, mix3.noise.seconds),
48733
+ noise: () => noiseBuffer(shared3, context, mix3.noise.seconds),
48250
48734
  register: (loop) => void loops.add(loop),
48251
48735
  unregister: (loop) => void loops.delete(loop),
48252
48736
  listener: () => listener,
@@ -48291,7 +48775,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48291
48775
  watchers.add(listener2);
48292
48776
  return () => void watchers.delete(listener2);
48293
48777
  },
48294
- play: (id, playOptions = {}) => playWith(id, playOptions, randomFor(playOptions), shared2),
48778
+ play: (id, playOptions = {}) => playWith(id, playOptions, randomFor(playOptions), shared3),
48295
48779
  playPlan(plan, playOptions = {}) {
48296
48780
  const audio = ready();
48297
48781
  if (!audio) return null;
@@ -48299,8 +48783,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48299
48783
  const recipe2 = { id: plan.id, bus: plan.bus, layers: [], sources: [], priority: plan.priority, ...plan.group ? { group: plan.group } : {} };
48300
48784
  const voiceId = plan.silent ? void 0 : admit(recipe2, plan.level, plan.distance);
48301
48785
  if (voiceId === null) return null;
48302
- if (planUsesNoise(plan)) prepareNoise(shared2, audio, mix3.noise.seconds);
48303
- return start(plan, shared2, voiceId, playOptions.delay);
48786
+ if (planUsesNoise(plan)) prepareNoise(shared3, audio, mix3.noise.seconds);
48787
+ return start(plan, shared3, voiceId, playOptions.delay);
48304
48788
  },
48305
48789
  loop(id, loopOptions = {}) {
48306
48790
  const sample = registry.sample(id);
@@ -48326,7 +48810,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48326
48810
  },
48327
48811
  channel(channelOptions) {
48328
48812
  const random = channelOptions.random ?? (channelOptions.seed === void 0 ? engineRandom : createRng3(channelOptions.seed));
48329
- const store = channelOptions.ownNoise ? createNoiseStore(random) : shared2;
48813
+ const store = channelOptions.ownNoise ? createNoiseStore(random) : shared3;
48330
48814
  return {
48331
48815
  random,
48332
48816
  play: (id, playOptions = {}) => playWith(id, playOptions, random, store),
@@ -48348,7 +48832,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48348
48832
  if (!context || !chain) return;
48349
48833
  const old = chain;
48350
48834
  chain = buildChain(context, mix3, engineRandom);
48351
- if (mix3.noise.seconds !== previous.noise.seconds) shared2.reset();
48835
+ if (mix3.noise.seconds !== previous.noise.seconds) shared3.reset();
48352
48836
  for (const node of busNodes.values()) {
48353
48837
  node.disconnect();
48354
48838
  node.connect(chain.master);
@@ -48367,7 +48851,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48367
48851
  warmUp() {
48368
48852
  const audio = ready();
48369
48853
  if (!audio) return false;
48370
- noiseBuffer(shared2, audio, mix3.noise.seconds);
48854
+ noiseBuffer(shared3, audio, mix3.noise.seconds);
48371
48855
  return true;
48372
48856
  },
48373
48857
  level(bus) {
@@ -48403,7 +48887,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
48403
48887
  chain = null;
48404
48888
  busNodes.clear();
48405
48889
  meters.clear();
48406
- shared2.reset();
48890
+ shared3.reset();
48407
48891
  sampleStore.clear();
48408
48892
  memory.clear();
48409
48893
  sampleLimiters.clear();
@@ -51649,15 +52133,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51649
52133
  const distanceCurve = { ...GAME_DISTANCE_CURVE, ...options.distance };
51650
52134
  const mechanicalTable = { ...MECHANICAL_SOUNDS, ...options.mechanical };
51651
52135
  const cueTable = { ...RELOAD_CUES, ...options.reloadCues };
51652
- const shared2 = options.engine;
51653
- if (!shared2) warnOnce("game-weapons-three.own-audio-engine", "game-weapons-three made an audio engine of its own because the host lent none (options.engine); pass the host engine so the sounds share one mix and one voice limit");
51654
- const engine = shared2 ?? createAudioEngine({
52136
+ const shared3 = options.engine;
52137
+ if (!shared3) warnOnce("game-weapons-three.own-audio-engine", "game-weapons-three made an audio engine of its own because the host lent none (options.engine); pass the host engine so the sounds share one mix and one voice limit");
52138
+ const engine = shared3 ?? createAudioEngine({
51655
52139
  seed,
51656
52140
  mix: { ...MIX_PROFILES.game, master: volume, noise: { seconds: NOISE_SECONDS, create: "eager" } },
51657
52141
  maxVoices: Number.POSITIVE_INFINITY,
51658
52142
  ...options.createContext ? { createContext: options.createContext } : {}
51659
52143
  });
51660
- const channel = shared2 && options.seed !== void 0 ? shared2.channel({ seed }) : engine.channel({});
52144
+ const channel = shared3 && options.seed !== void 0 ? shared3.channel({ seed }) : engine.channel({});
51661
52145
  engine.register({ id: `weapons_three@${classBurstId(distanceCurve)}`, sounds: weaponRecipes(distanceCurve) });
51662
52146
  const classBurst = classBurstId(distanceCurve);
51663
52147
  const sampleBank = options.samples ? weaponSampleBank(options.samples) : null;
@@ -51860,11 +52344,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
51860
52344
  },
51861
52345
  setVolume(next) {
51862
52346
  const level = Math.max(0, Math.min(1, next));
51863
- if (shared2) shared2.setBus("weapons", { gain: level });
52347
+ if (shared3) shared3.setBus("weapons", { gain: level });
51864
52348
  else engine.setMaster(level);
51865
52349
  },
51866
52350
  dispose() {
51867
- if (!shared2) engine.dispose();
52351
+ if (!shared3) engine.dispose();
51868
52352
  }
51869
52353
  };
51870
52354
  }
@@ -57567,7 +58051,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
57567
58051
  var ballisticVest = ({ mesh: mesh3, bx, G, cloth: cloth2, metal: metal2, plastic }) => {
57568
58052
  const shell = cloth2(4936761);
57569
58053
  const strap = cloth2(3817776);
57570
- const plate2 = plastic(2764074);
58054
+ const plate3 = plastic(2764074);
57571
58055
  const buckle = metal2(9080208);
57572
58056
  return G(
57573
58057
  mesh3(bx(0.34, 0.045, 0.34), shell, [0, 0.0225, 0.055]),
@@ -57575,7 +58059,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
57575
58059
  mesh3(bx(0.08, 0.022, 0.1), strap, [0.1, 0.011, -0.175]),
57576
58060
  mesh3(bx(0.03, 0.04, 0.22), strap, [-0.185, 0.02, 0.1]),
57577
58061
  mesh3(bx(0.03, 0.04, 0.22), strap, [0.185, 0.02, 0.1]),
57578
- mesh3(bx(0.24, 0.025, 0.24), plate2, [0, 0.0575, 0.03]),
58062
+ mesh3(bx(0.24, 0.025, 0.24), plate3, [0, 0.0575, 0.03]),
57579
58063
  mesh3(bx(0.07, 0.02, 0.05), strap, [-0.1, 0.055, 0.19]),
57580
58064
  mesh3(bx(0.07, 0.02, 0.05), strap, [0, 0.055, 0.19]),
57581
58065
  mesh3(bx(0.07, 0.02, 0.05), strap, [0.1, 0.055, 0.19]),
@@ -59468,7 +59952,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59468
59952
 
59469
59953
  // src/models/melee.ts
59470
59954
  var QUARTER = Math.PI / 2;
59471
- var plate = (kit, parent, profile, thickness, y, material) => {
59955
+ var plate2 = (kit, parent, profile, thickness, y, material) => {
59472
59956
  const shape = new kit.THREE.Shape();
59473
59957
  profile.forEach(([x, z], index) => index === 0 ? shape.moveTo(x, -z) : shape.lineTo(x, -z));
59474
59958
  const mesh3 = new kit.THREE.Mesh(new kit.THREE.ExtrudeGeometry(shape, { depth: thickness, bevelEnabled: false }), material);
@@ -59487,7 +59971,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59487
59971
  box5(group, 7e-3, 0.012, 0.052, M.metal, 0.1325, axis2, 0);
59488
59972
  box5(group, 0.012, 0.012, 4e-3, M.metal, 0.136, axis2, 0.026);
59489
59973
  box5(group, 0.012, 0.012, 4e-3, M.metal, 0.136, axis2, -0.026);
59490
- plate(kit, group, [[0.136, -0.0165], [0.248, -0.0165], [0.272, -0.0135], [0.2995, -6e-3], [0.3, -1e-3], [0.282, 8e-3], [0.255, 0.0165], [0.136, 0.0165]], 45e-4, axis2 - 225e-5, M.metal);
59974
+ plate2(kit, group, [[0.136, -0.0165], [0.248, -0.0165], [0.272, -0.0135], [0.2995, -6e-3], [0.3, -1e-3], [0.282, 8e-3], [0.255, 0.0165], [0.136, 0.0165]], 45e-4, axis2 - 225e-5, M.metal);
59491
59975
  box5(group, 0.095, 16e-4, 45e-4, M.dark, 0.19, axis2 + 23e-4, 6e-3);
59492
59976
  return { handle: [0.07, axis2, 0] };
59493
59977
  };
@@ -59522,7 +60006,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59522
60006
  spine.push([x, bow(t) + halfWidth(t)]);
59523
60007
  }
59524
60008
  const tip = [KATANA_TIP, bow(1) + 4e-3];
59525
- plate(kit, group, [...edge, tip, ...spine.reverse()], 55e-4, axis2 - 275e-5, M.steelL);
60009
+ plate2(kit, group, [...edge, tip, ...spine.reverse()], 55e-4, axis2 - 275e-5, M.steelL);
59526
60010
  return { handle: [0.2, axis2, 0], support: [0.07, axis2, 0] };
59527
60011
  };
59528
60012
  var RING_Z = [-0.0455, -0.0155, 0.0155, 0.0455];
@@ -65876,12 +66360,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65876
66360
  }
65877
66361
  function drawing(entry2, action) {
65878
66362
  const context = engine.context;
65879
- const shared2 = context.random;
66363
+ const shared3 = context.random;
65880
66364
  if (entry2.random) context.random = entry2.random;
65881
66365
  try {
65882
66366
  action();
65883
66367
  } finally {
65884
- context.random = shared2;
66368
+ context.random = shared3;
65885
66369
  }
65886
66370
  }
65887
66371
  return {
@@ -66088,7 +66572,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66088
66572
  const size = random.between(0.12, 0.26) * Math.min(1.6, 0.6 + radius * 0.4);
66089
66573
  const px = x + Math.cos(angle) * distance3;
66090
66574
  const pz = z + Math.sin(angle) * distance3;
66091
- const plate2 = random.next() < 0.6;
66575
+ const plate3 = random.next() < 0.6;
66092
66576
  const color2 = RIM_COLORS[random.next() < 0.5 ? 0 : 1];
66093
66577
  const tiltX = random.between(-0.5, 0.5);
66094
66578
  const tiltZ = random.between(-0.6, 0.2);
@@ -66099,7 +66583,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66099
66583
  z: pz,
66100
66584
  scale: [size * 2, size * 0.35, size * 1.4],
66101
66585
  rotation: [tiltX, angle, tiltZ],
66102
- plate: plate2,
66586
+ plate: plate3,
66103
66587
  color: color2
66104
66588
  });
66105
66589
  }
@@ -66406,8 +66890,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66406
66890
  if (direction) normalize2(addScaled(d, direction, 0.8));
66407
66891
  const speed = random.between(4, 11) * (chunks.speed ?? 1);
66408
66892
  const s = random.between(0.07, 0.2) * (chunks.size ?? 1);
66409
- const plate2 = chunks.plate ? random.next() < 0.6 : random.next() < 0.15;
66410
- const sy = plate2 ? s * 0.3 : s * random.between(0.6, 1);
66893
+ const plate3 = chunks.plate ? random.next() < 0.6 : random.next() < 0.15;
66894
+ const sy = plate3 ? s * 0.3 : s * random.between(0.6, 1);
66411
66895
  const color2 = hexToRgb2(chunks.colors.length > 0 ? pick22(random, chunks.colors) : DEFAULT_CHUNK_COLOR);
66412
66896
  const hot = random.next() < chunks.hot;
66413
66897
  addChunk(core, random, {
@@ -66417,11 +66901,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66417
66901
  vx: d.x * speed,
66418
66902
  vy: d.y * speed + 2,
66419
66903
  vz: d.z * speed,
66420
- sx: plate2 ? s * 1.6 : s,
66904
+ sx: plate3 ? s * 1.6 : s,
66421
66905
  sy,
66422
- sz: plate2 ? s * 1.1 : s,
66906
+ sz: plate3 ? s * 1.1 : s,
66423
66907
  color: color2,
66424
- plate: plate2,
66908
+ plate: plate3,
66425
66909
  hot
66426
66910
  });
66427
66911
  }
@@ -72994,7 +73478,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
72994
73478
  fx = created;
72995
73479
  const camera2 = lent.camera;
72996
73480
  const accessories = createAccessoryBench({ arsenal, host: lent, text: accessoryText });
72997
- const showcase = createWeaponShowcase({ arsenal, host: lent, text: showcaseText });
73481
+ const showcase = createWeaponShowcase({ arsenal, host: lent, text: showcaseText, referencePhotos: options.referencePhotos === true });
72998
73482
  const offBench = lent.bench?.onChange((change) => {
72999
73483
  if (accessories.handleChange(change) || showcase.handleChange(change)) return;
73000
73484
  if (change.kind === "layer") {