@adatechnology/game-weapons-three 0.29.4 → 0.29.5

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.
@@ -219,7 +219,7 @@ var GameWeaponsThree = (() => {
219
219
  var positive = (n) => finite(n) && n > 0;
220
220
  var vec3 = (v) => Array.isArray(v) && v.length === 3 && v.every(finite);
221
221
  var nonNegative = (n) => n === void 0 || finite(n) && n >= 0;
222
- var FACES = ["both", "+", "-"];
222
+ var FACES = ["both", "+", "-", "all"];
223
223
  var BONDS = ["running", "stack"];
224
224
  var checkStagedFields = (p, label, materials, problems) => {
225
225
  const known = (m, what) => {
@@ -654,9 +654,9 @@ var GameWeaponsThree = (() => {
654
654
  };
655
655
  var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
656
656
  var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
657
- var deepMerge = (base, patch) => {
658
- if (!patch) return base;
659
- const result2 = { ...base };
657
+ var deepMerge = (base2, patch) => {
658
+ if (!patch) return base2;
659
+ const result2 = { ...base2 };
660
660
  for (const [key2, value] of Object.entries(patch)) {
661
661
  if (value === void 0 || UNSAFE_KEYS.has(key2)) continue;
662
662
  const current = result2[key2];
@@ -15793,7 +15793,7 @@ var GameWeaponsThree = (() => {
15793
15793
  const energy = 0.5 * (caliber.bulletGrams / 1e3) * weaponSpeed(def.action, caliber) ** 2;
15794
15794
  return roundsToWarning({ def, caliber, energy, rpm: def.action.rpm, rules: arsenal.rules.heat });
15795
15795
  };
15796
- var burstNoise = (base, recentShots, rules) => base * (1 + Math.min(rules.cap, rules.step * recentShots));
15796
+ var burstNoise = (base2, recentShots, rules) => base2 * (1 + Math.min(rules.cap, rules.step * recentShots));
15797
15797
  var magazineOut = { stage: "magazine_out", at: 0 };
15798
15798
  var magazineIn = { stage: "magazine_in", at: 0.549 };
15799
15799
  var byMagazine = (chargeAt) => ({
@@ -15938,12 +15938,12 @@ var GameWeaponsThree = (() => {
15938
15938
  }
15939
15939
  return [added, taken];
15940
15940
  };
15941
- var stat = (name, base, sources, active) => {
15941
+ var stat = (name, base2, sources, active) => {
15942
15942
  const current = modifiersOf(name, sources.now, active);
15943
15943
  const lastSet = [...current].reverse().find((modifier) => modifier.set !== void 0)?.set;
15944
15944
  if (lastSet !== void 0) return (lastSet + sum(current)) * product(current);
15945
15945
  const [added, taken] = cancelShipped(current, modifiersOf(name, sources.shipped, sources.shippedActive ?? /* @__PURE__ */ new Set()));
15946
- return (base + (sum(added) - sum(taken))) * (product(added) / product(taken));
15946
+ return (base2 + (sum(added) - sum(taken))) * (product(added) / product(taken));
15947
15947
  };
15948
15948
  var baseSpeedOf = (action, caliber) => action.muzzleSpeed ?? (caliber?.muzzleSpeed ?? 0) * (action.barrel ?? 1);
15949
15949
  var scaleTimings = (timings, reload, empty) => ({
@@ -15982,7 +15982,7 @@ var GameWeaponsThree = (() => {
15982
15982
  const speed = firearm ? stat("muzzleSpeed", baseSpeedOf(firearm, context.caliber), sources, baseActive) : 0;
15983
15983
  const active = new Set(baseActive);
15984
15984
  if (firearm && speed < context.rules.attachments.speedOfSound) active.add("subsonic");
15985
- const read = (name, base) => stat(name, base, sources, active);
15985
+ const read = (name, base2) => stat(name, base2, sources, active);
15986
15986
  const mass = read("mass", def.mass + parts2.reduce((total, part) => total + part.mass, 0) - factory.reduce((total, part) => total + part.mass, 0));
15987
15987
  const hipFactor = context.aiming ? 1 : 1 + (context.rules.aim.hipSpread - 1) * read("hipSpreadExcess", 1);
15988
15988
  const dual = context.dualWield && context.rules.dualWield ? context.rules.dualWield : ONE_HAND;
@@ -16620,12 +16620,12 @@ var GameWeaponsThree = (() => {
16620
16620
  reload(request = "auto") {
16621
16621
  if (this.isWorking()) return false;
16622
16622
  if (this.underActive && this.under) return this.under.reload(request);
16623
- const base = this.action;
16623
+ const base2 = this.action;
16624
16624
  const factor = this.load.secondReloadFactor;
16625
- const isFast = factor !== 1 && this.reloadCount % 2 === 1 && base.kind === "firearm";
16626
- if (isFast && base.kind === "firearm") this.action = { ...base, reload: base.reload * factor, ...base.timings ? { timings: { ...base.timings, reload: base.timings.reload * factor, ...base.timings.reloadEmpty === void 0 ? {} : { reloadEmpty: base.timings.reloadEmpty * factor } } } : {} };
16625
+ const isFast = factor !== 1 && this.reloadCount % 2 === 1 && base2.kind === "firearm";
16626
+ if (isFast && base2.kind === "firearm") this.action = { ...base2, reload: base2.reload * factor, ...base2.timings ? { timings: { ...base2.timings, reload: base2.timings.reload * factor, ...base2.timings.reloadEmpty === void 0 ? {} : { reloadEmpty: base2.timings.reloadEmpty * factor } } } : {} };
16627
16627
  const started = super.reload(request);
16628
- this.action = base;
16628
+ this.action = base2;
16629
16629
  if (started) this.reloadCount += 1;
16630
16630
  return started;
16631
16631
  }
@@ -17611,18 +17611,18 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
17611
17611
  const indexCount = mesh22.geometry.index ? mesh22.geometry.index.count : vertices;
17612
17612
  return { mesh: mesh22, local: local2, vertices, indexCount };
17613
17613
  });
17614
- const totalVertices = pieces.reduce((sum2, piece2) => sum2 + piece2.vertices, 0);
17615
- const totalIndices = pieces.reduce((sum2, piece2) => sum2 + piece2.indexCount, 0);
17614
+ const totalVertices = pieces.reduce((sum2, piece3) => sum2 + piece3.vertices, 0);
17615
+ const totalIndices = pieces.reduce((sum2, piece3) => sum2 + piece3.indexCount, 0);
17616
17616
  const merged2 = new THREE.BufferGeometry();
17617
- const normalMatrices = names.includes("normal") ? pieces.map((piece2) => new THREE.Matrix3().getNormalMatrix(follow ? identity : piece2.local)) : [];
17617
+ const normalMatrices = names.includes("normal") ? pieces.map((piece3) => new THREE.Matrix3().getNormalMatrix(follow ? identity : piece3.local)) : [];
17618
17618
  for (const name of names) {
17619
17619
  const size = first.geometry.attributes[name].itemSize;
17620
17620
  const array = new Float32Array(totalVertices * size);
17621
17621
  let offset = 0;
17622
- for (const [at4, piece2] of pieces.entries()) {
17623
- const matrix = name === "normal" ? normalMatrices[at4] : follow ? identity : piece2.local;
17624
- copyAttribute(name, piece2.mesh.geometry.attributes[name], array, offset, matrix);
17625
- offset += piece2.vertices;
17622
+ for (const [at4, piece3] of pieces.entries()) {
17623
+ const matrix = name === "normal" ? normalMatrices[at4] : follow ? identity : piece3.local;
17624
+ copyAttribute(name, piece3.mesh.geometry.attributes[name], array, offset, matrix);
17625
+ offset += piece3.vertices;
17626
17626
  }
17627
17627
  merged2.setAttribute(name, new THREE.BufferAttribute(array, size));
17628
17628
  }
@@ -17644,30 +17644,30 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
17644
17644
  const sources = [];
17645
17645
  let vertexOffset = 0;
17646
17646
  let indexOffset = 0;
17647
- for (const piece2 of pieces) {
17648
- const index = piece2.mesh.geometry.index;
17647
+ for (const piece3 of pieces) {
17648
+ const index = piece3.mesh.geometry.index;
17649
17649
  if (index) {
17650
17650
  const indices = index.array;
17651
- for (let at4 = 0; at4 < piece2.indexCount; at4++) indexArray2[indexOffset + at4] = indices[at4] + vertexOffset;
17652
- } else for (let at4 = 0; at4 < piece2.indexCount; at4++) indexArray2[indexOffset + at4] = at4 + vertexOffset;
17651
+ for (let at4 = 0; at4 < piece3.indexCount; at4++) indexArray2[indexOffset + at4] = indices[at4] + vertexOffset;
17652
+ } else for (let at4 = 0; at4 < piece3.indexCount; at4++) indexArray2[indexOffset + at4] = at4 + vertexOffset;
17653
17653
  sources.push({
17654
- mesh: piece2.mesh,
17655
- geometry: piece2.mesh.geometry,
17656
- material: piece2.mesh.material,
17657
- version: piece2.mesh.geometry.attributes.position.version,
17658
- local: piece2.local,
17659
- world: piece2.mesh.matrixWorld.clone(),
17660
- mask: piece2.mesh.layers.mask,
17661
- castShadow: piece2.mesh.castShadow,
17654
+ mesh: piece3.mesh,
17655
+ geometry: piece3.mesh.geometry,
17656
+ material: piece3.mesh.material,
17657
+ version: piece3.mesh.geometry.attributes.position.version,
17658
+ local: piece3.local,
17659
+ world: piece3.mesh.matrixWorld.clone(),
17660
+ mask: piece3.mesh.layers.mask,
17661
+ castShadow: piece3.mesh.castShadow,
17662
17662
  batch,
17663
17663
  start: indexOffset,
17664
- count: piece2.indexCount,
17664
+ count: piece3.indexCount,
17665
17665
  released: false
17666
17666
  });
17667
- if (shadowOnly) piece2.mesh.castShadow = false;
17668
- else piece2.mesh.layers.set(BATCHED_LAYER);
17669
- vertexOffset += piece2.vertices;
17670
- indexOffset += piece2.indexCount;
17667
+ if (shadowOnly) piece3.mesh.castShadow = false;
17668
+ else piece3.mesh.layers.set(BATCHED_LAYER);
17669
+ vertexOffset += piece3.vertices;
17670
+ indexOffset += piece3.indexCount;
17671
17671
  }
17672
17672
  return sources;
17673
17673
  }
@@ -18128,11 +18128,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18128
18128
  }
18129
18129
  for (let i = 0; i < segments; i++) {
18130
18130
  for (let j = 0; j < points.length - 1; j++) {
18131
- const base = j + i * points.length;
18132
- const a = base;
18133
- const b = base + points.length;
18134
- const c = base + points.length + 1;
18135
- const d = base + 1;
18131
+ const base2 = j + i * points.length;
18132
+ const a = base2;
18133
+ const b = base2 + points.length;
18134
+ const c = base2 + points.length + 1;
18135
+ const d = base2 + 1;
18136
18136
  indices.push(a, b, d);
18137
18137
  indices.push(c, d, b);
18138
18138
  }
@@ -18197,13 +18197,13 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18197
18197
  const uvs = [];
18198
18198
  const indices = [];
18199
18199
  const quad = (corners, normal, uv) => {
18200
- const base = positions2.length / 3;
18200
+ const base2 = positions2.length / 3;
18201
18201
  for (let k = 0; k < 4; k++) {
18202
18202
  positions2.push(...corners[k]);
18203
18203
  normals.push(...normal);
18204
18204
  uvs.push(...uv[k]);
18205
18205
  }
18206
- indices.push(base, base + 1, base + 2, base, base + 2, base + 3);
18206
+ indices.push(base2, base2 + 1, base2 + 2, base2, base2 + 2, base2 + 3);
18207
18207
  };
18208
18208
  const fu = (x) => (x + hw) / w;
18209
18209
  const fv = (y) => (y + hh) / h;
@@ -19122,26 +19122,26 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19122
19122
  };
19123
19123
  function mergeTransformed(pieces) {
19124
19124
  let total = 0;
19125
- for (const piece2 of pieces) total += piece2.indices ? piece2.indices.length : piece2.positions.length / 3;
19125
+ for (const piece3 of pieces) total += piece3.indices ? piece3.indices.length : piece3.positions.length / 3;
19126
19126
  const positions2 = new Float32Array(total * 3);
19127
19127
  const normals = new Float32Array(total * 3);
19128
19128
  const uvs = new Float32Array(total * 2);
19129
19129
  let at4 = 0;
19130
- for (const piece2 of pieces) {
19131
- const e = piece2.matrix;
19130
+ for (const piece3 of pieces) {
19131
+ const e = piece3.matrix;
19132
19132
  const nm = normalMatrix(e);
19133
- const count = piece2.indices ? piece2.indices.length : piece2.positions.length / 3;
19133
+ const count = piece3.indices ? piece3.indices.length : piece3.positions.length / 3;
19134
19134
  const p = new Float32Array(count * 3);
19135
19135
  const n = new Float32Array(count * 3);
19136
19136
  for (let k = 0; k < count; k++) {
19137
- const i = piece2.indices ? piece2.indices[k] : k;
19137
+ const i = piece3.indices ? piece3.indices[k] : k;
19138
19138
  for (let c = 0; c < 3; c++) {
19139
- p[k * 3 + c] = piece2.positions[i * 3 + c];
19140
- if (piece2.normals) n[k * 3 + c] = piece2.normals[i * 3 + c];
19139
+ p[k * 3 + c] = piece3.positions[i * 3 + c];
19140
+ if (piece3.normals) n[k * 3 + c] = piece3.normals[i * 3 + c];
19141
19141
  }
19142
- if (piece2.uvs) {
19143
- uvs[(at4 + k) * 2] = piece2.uvs[i * 2];
19144
- uvs[(at4 + k) * 2 + 1] = piece2.uvs[i * 2 + 1];
19142
+ if (piece3.uvs) {
19143
+ uvs[(at4 + k) * 2] = piece3.uvs[i * 2];
19144
+ uvs[(at4 + k) * 2 + 1] = piece3.uvs[i * 2 + 1];
19145
19145
  }
19146
19146
  }
19147
19147
  for (let k = 0; k < count; k++) {
@@ -19982,7 +19982,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19982
19982
  T("open_door", true, 0.9, 0.15, 2.15, 0, false, "house_state")
19983
19983
  ];
19984
19984
  var DEFS = Object.fromEntries(TYPE_DEFS.map((t) => [t.id, t]));
19985
- var MATERIALS = ["plain", "metal", "wood", "glass", "fabric", "plant", "water", "emissive", "atlas_picture", "atlas_floor"];
19985
+ var MATERIALS = ["plain", "metal", "wood", "glass", "fabric", "foam", "plant", "water", "emissive", "atlas_picture", "atlas_floor"];
19986
19986
  function ceilingBuilders({ kit }) {
19987
19987
  const B = {};
19988
19988
  B.ceiling_light = (M, a) => {
@@ -21204,14 +21204,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21204
21204
  const uvs = [];
21205
21205
  const indices = [];
21206
21206
  for (const side of [1, -1]) {
21207
- const base = positions2.length / 3;
21207
+ const base2 = positions2.length / 3;
21208
21208
  for (let i = 0; i < 4; i++) {
21209
21209
  positions2.push(f[i * 3], f[i * 3 + 1], f[i * 3 + 2]);
21210
21210
  normals.push(0, 0, side);
21211
21211
  uvs.push(f[i * 3] + 0.5, f[i * 3 + 1]);
21212
21212
  }
21213
- if (side === 1) indices.push(base, base + 2, base + 1, base + 1, base + 2, base + 3);
21214
- else indices.push(base, base + 1, base + 2, base + 1, base + 3, base + 2);
21213
+ if (side === 1) indices.push(base2, base2 + 2, base2 + 1, base2 + 1, base2 + 2, base2 + 3);
21214
+ else indices.push(base2, base2 + 1, base2 + 2, base2 + 1, base2 + 3, base2 + 2);
21215
21215
  }
21216
21216
  return { positions: positions2, normals, uvs, indices };
21217
21217
  })();
@@ -22347,7 +22347,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22347
22347
  var MAX_SPALLS = 64;
22348
22348
  var thinAxisOf = (dims) => dims[0] <= dims[1] && dims[0] <= dims[2] ? 0 : dims[1] <= dims[2] ? 1 : 2;
22349
22349
  var resolveLayer = (def, index, mat) => ({ index, def, mat, energy: mat.penetration * def.thickness * 1e3 });
22350
- var onFace = (layer3, face) => layer3.def.faces === "both" || layer3.def.faces === (face > 0 ? "+" : "-");
22350
+ var faceCode = (thin, axis2, sign2) => {
22351
+ const [u] = planeAxes(thin);
22352
+ return (sign2 >= 0 ? 1 : -1) * (axis2 === thin ? 1 : axis2 === u ? 2 : 3);
22353
+ };
22354
+ var faceAxis = (thin, face) => {
22355
+ const k = Math.abs(face);
22356
+ return k === 1 ? thin : planeAxes(thin)[k - 2];
22357
+ };
22358
+ var faceOfNormal = (layers, thin, localNormal) => {
22359
+ if (!layers.some((l) => l.def.faces === "all")) return localNormal[thin] >= 0 ? 1 : -1;
22360
+ let axis2 = thin;
22361
+ for (let k = 0; k < 3; k++) if (Math.abs(localNormal[k]) > Math.abs(localNormal[axis2])) axis2 = k;
22362
+ return faceCode(thin, axis2, localNormal[axis2]);
22363
+ };
22364
+ var onFace = (layer3, face) => {
22365
+ const faces = layer3.def.faces;
22366
+ if (faces === "all") return true;
22367
+ if (Math.abs(face) !== 1) return false;
22368
+ return faces === "both" || faces === (face > 0 ? "+" : "-");
22369
+ };
22370
+ var thinSidesOf = (def) => def.faces === "both" || def.faces === "all" ? [1, -1] : [def.faces === "+" ? 1 : -1];
22351
22371
  var isSpalled = (spalls, layer3, face, point) => {
22352
22372
  for (const s of spalls ?? []) {
22353
22373
  if (s[0] !== layer3 || s[1] !== face) continue;
@@ -22367,6 +22387,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22367
22387
  for (const l of layers) if (onFace(l, face)) sum2 += l.def.thickness;
22368
22388
  return sum2;
22369
22389
  };
22390
+ var tornPatchAt = (layers, spalls, face, point, radius) => {
22391
+ for (const l of layers) {
22392
+ if (!onFace(l, face)) continue;
22393
+ if (l.mat.fracture === "tear") {
22394
+ let best = -1;
22395
+ (spalls ?? []).forEach((s, i) => {
22396
+ if (s[0] !== l.index || s[1] !== face) return;
22397
+ const dx = s[2] - point[0], dy = s[3] - point[1], dz = s[4] - point[2];
22398
+ const reach2 = s[5] + radius;
22399
+ if (dx * dx + dy * dy + dz * dz <= reach2 * reach2 && (best < 0 || s[5] > spalls[best][5])) best = i;
22400
+ });
22401
+ if (best >= 0) return { layer: l, spall: best };
22402
+ }
22403
+ if (!isSpalled(spalls, l.index, face, point)) return void 0;
22404
+ }
22405
+ return void 0;
22406
+ };
22370
22407
  var REBAR_COVER = 0.03;
22371
22408
  var COVER = REBAR_COVER;
22372
22409
  var MAX_BARS_PER_DIRECTION = 24;
@@ -23327,8 +23364,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
23327
23364
  beams += cos2 * cos2 * q.elasticPa * c.beamFactor * inertia / Math.max(long, 1e-6);
23328
23365
  }
23329
23366
  const k = beams / kc;
23330
- const base = p.min[1] - ground < 0.05;
23331
- const a = base ? (0.5 + k) / (2 + k) : k / (2 + k);
23367
+ const base2 = p.min[1] - ground < 0.05;
23368
+ const a = base2 ? (0.5 + k) / (2 + k) : k / (2 + k);
23332
23369
  const stiffness = a * 12 * (p.elasticPa * c.stiffnessFactor) * (g[i].du ** 3 * g[i].dv / 12) / (h * h);
23333
23370
  for (let j = 0; j < n; j++) ga[j] += stiffness * share(p, j) / bands[j];
23334
23371
  }
@@ -23513,7 +23550,49 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
23513
23550
  elasticGPa: 200,
23514
23551
  absorbed: 0.2
23515
23552
  },
23516
- failureMPa: 250
23553
+ failureMPa: 250,
23554
+ tension: {
23555
+ elasticGPa: 200,
23556
+ ultimateMPa: 400
23557
+ }
23558
+ },
23559
+ {
23560
+ id: "spring_steel",
23561
+ density: 7850,
23562
+ hpPerKg: 900,
23563
+ penetration: 110,
23564
+ penetrationClass: "steel",
23565
+ penetrationScale: 1.3,
23566
+ ductility: 0.95,
23567
+ fracture: "none",
23568
+ damageScale: {
23569
+ slash: 0.1,
23570
+ blunt: 0.8
23571
+ },
23572
+ hitDebris: "sparks",
23573
+ breakDebris: "sparks",
23574
+ ricochetDeg: 20,
23575
+ thermal: {
23576
+ meltC: 1450,
23577
+ meltRate: 0.05,
23578
+ conductivity: 0.5,
23579
+ heatCapacity: 3
23580
+ },
23581
+ visual: {
23582
+ glows: true
23583
+ },
23584
+ tags: [
23585
+ "metal",
23586
+ "conductive",
23587
+ "spring"
23588
+ ],
23589
+ compressive: 2e6,
23590
+ bending: {
23591
+ yieldMPa: 1200,
23592
+ elasticGPa: 200,
23593
+ absorbed: 0.2
23594
+ },
23595
+ failureMPa: 1400
23517
23596
  },
23518
23597
  {
23519
23598
  id: "cast_iron",
@@ -23580,7 +23659,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
23580
23659
  "conductive"
23581
23660
  ],
23582
23661
  compressive: 8e5,
23583
- failureMPa: 90
23662
+ failureMPa: 90,
23663
+ tension: {
23664
+ elasticGPa: 69,
23665
+ ultimateMPa: 170
23666
+ }
23584
23667
  },
23585
23668
  {
23586
23669
  id: "copper",
@@ -23611,7 +23694,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
23611
23694
  "conductive"
23612
23695
  ],
23613
23696
  compressive: 1e6,
23614
- failureMPa: 70
23697
+ failureMPa: 70,
23698
+ tension: {
23699
+ elasticGPa: 117,
23700
+ ultimateMPa: 250
23701
+ }
23615
23702
  },
23616
23703
  {
23617
23704
  id: "wood_soft",
@@ -24152,7 +24239,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24152
24239
  "flammable"
24153
24240
  ],
24154
24241
  compressive: 500,
24155
- failureMPa: 20
24242
+ failureMPa: 20,
24243
+ hits: {
24244
+ slash: {
24245
+ tear: "strips",
24246
+ tearJoules: 30
24247
+ },
24248
+ blunt: {
24249
+ tear: "strips",
24250
+ tearJoules: 150
24251
+ }
24252
+ }
24156
24253
  },
24157
24254
  {
24158
24255
  id: "foam",
@@ -24160,6 +24257,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24160
24257
  hpPerKg: 15,
24161
24258
  penetration: 0.5,
24162
24259
  ductility: 0.7,
24260
+ cellular: true,
24163
24261
  fracture: "tear",
24164
24262
  splitForm: "granules",
24165
24263
  fragmentSize: [
@@ -24179,16 +24277,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24179
24277
  burnRate: 0.09,
24180
24278
  conductivity: 0.02,
24181
24279
  heatCapacity: 0.5,
24182
- smoke: "black"
24280
+ smoke: "black",
24281
+ meltC: 200,
24282
+ meltRate: 0.08
24183
24283
  },
24184
24284
  visual: {
24185
- charColor: 855309
24285
+ charColor: 855309,
24286
+ innerColor: 15254346
24186
24287
  },
24187
24288
  tags: [
24188
24289
  "fabric",
24189
24290
  "flammable"
24190
24291
  ],
24191
- compressive: 100
24292
+ compressive: 100,
24293
+ hits: {
24294
+ ballistic: {
24295
+ tear: "lumps",
24296
+ tearJoules: 250
24297
+ },
24298
+ slash: {
24299
+ tear: "lumps",
24300
+ tearJoules: 60
24301
+ }
24302
+ }
24192
24303
  },
24193
24304
  {
24194
24305
  id: "leather",
@@ -24978,19 +25089,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24978
25089
  };
24979
25090
  var placedPieces = /* @__PURE__ */ new WeakMap();
24980
25091
  var isSamePose = ({ known, position, rotation: rotation2 }) => known.position[0] === position[0] && known.position[1] === position[1] && known.position[2] === position[2] && known.rotation[0] === rotation2[0] && known.rotation[1] === rotation2[1] && known.rotation[2] === rotation2[2] && known.rotation[3] === rotation2[3];
24981
- var hostedPieces = (pieces, pose2) => pieces.map((piece2, index) => {
24982
- const known = placedPieces.get(piece2);
25092
+ var hostedPieces = (pieces, pose2) => pieces.map((piece3, index) => {
25093
+ const known = placedPieces.get(piece3);
24983
25094
  const p = pose2.position, q = pose2.rotation;
24984
- const isSamePlace = known !== void 0 && (piece2.key !== void 0 || known.index === index) && isSamePose({ known, position: p, rotation: q });
25095
+ const isSamePlace = known !== void 0 && (piece3.key !== void 0 || known.index === index) && isSamePose({ known, position: p, rotation: q });
24985
25096
  if (known && isSamePlace) return known.solid;
24986
- const solid2 = placedPiece(piece2, index, pose2);
24987
- placedPieces.set(piece2, { position: [p[0], p[1], p[2]], rotation: [q[0], q[1], q[2], q[3]], index, solid: solid2 });
25097
+ const solid2 = placedPiece(piece3, index, pose2);
25098
+ placedPieces.set(piece3, { position: [p[0], p[1], p[2]], rotation: [q[0], q[1], q[2], q[3]], index, solid: solid2 });
24988
25099
  return solid2;
24989
25100
  });
24990
- var placedPiece = (piece2, index, pose2) => {
24991
- const base = { center: toWorld(pose2.position, pose2.rotation, piece2.center), half: piece2.half, rotation: quat.mul(pose2.rotation, piece2.rotation), key: piece2.key ?? `${piece2.id}:${index}` };
24992
- if (!piece2.mesh) return base;
24993
- const source = piece2.mesh.vertices;
25101
+ var placedPiece = (piece3, index, pose2) => {
25102
+ const base2 = { center: toWorld(pose2.position, pose2.rotation, piece3.center), half: piece3.half, rotation: quat.mul(pose2.rotation, piece3.rotation), key: piece3.key ?? `${piece3.id}:${index}` };
25103
+ if (!piece3.mesh) return base2;
25104
+ const source = piece3.mesh.vertices;
24994
25105
  const vertices = new Float32Array(source.length);
24995
25106
  for (let i = 0; i < source.length; i += 3) {
24996
25107
  const world = toWorld(pose2.position, pose2.rotation, [source[i], source[i + 1], source[i + 2]]);
@@ -24998,9 +25109,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24998
25109
  vertices[i + 1] = world[1];
24999
25110
  vertices[i + 2] = world[2];
25000
25111
  }
25001
- return { ...base, mesh: { vertices, indices: piece2.mesh.indices } };
25112
+ return { ...base2, mesh: { vertices, indices: piece3.mesh.indices } };
25002
25113
  };
25003
25114
  var THIN_SHEET_DISHING = 5e-3;
25115
+ var SHELL_YIELD_SHARE = 0.5;
25116
+ var STEEL_YIELD_MPA = 250;
25004
25117
  var SWEEP_BACK = 0.01;
25005
25118
  function sweepOrigins(box5, d, spacing) {
25006
25119
  const origins = [];
@@ -25059,13 +25172,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25059
25172
  var MEMBER_CRATER_CALIBRES = 3.4;
25060
25173
  var MEMBER_CUT_LOSS = 0.9;
25061
25174
  var MEMBER_UNIT_LOSS = 0.12;
25175
+ var CHIP_PROBE_DEPTH = 1e-4;
25062
25176
  var JOINT_OPEN_SHARE = 0.6;
25063
25177
  var BLAST_EDGE_WEAR = 0.6;
25064
25178
  var RESIDUAL_CAPACITY = 0.15;
25065
25179
  var SEVER_BAND = 0.1;
25180
+ var SURFACE_SLACK = 0.01;
25181
+ var SURFACE_SAME = 5e-4;
25066
25182
  var SEVER_ASPECT = 3;
25067
25183
  var SEVER_BALLISTIC = 2;
25068
25184
  var TEAR_JOULES = 150;
25185
+ var STRIP_THICKNESS = 15e-4;
25069
25186
  var tears = 0;
25070
25187
  var UNIT_FRAGMENT_FACTOR = 4;
25071
25188
  var BREACH_GRID_CAP = 4096;
@@ -25270,7 +25387,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25270
25387
  if (typed) for (const fn of typed) fn(e);
25271
25388
  };
25272
25389
  let blow3;
25273
- const base = (o, source) => ({
25390
+ const base2 = (o, source) => ({
25274
25391
  object: o.id,
25275
25392
  time,
25276
25393
  ...source === void 0 ? {} : { source },
@@ -26158,7 +26275,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26158
26275
  w.emitted = { t: time, peak: d.peak, status: st.status };
26159
26276
  const dir = windDirection(o, w.cfg);
26160
26277
  const world2 = rotateVec(o.base.rot, [dir[0], 0, dir[1]]);
26161
- emit2({ ...base(o), type: "sway", sway: d.x, peak: d.peak, drift: st.drift, overturn: st.overturn, frequency: st.frequency, direction: world2, status: st.status });
26278
+ emit2({ ...base2(o), type: "sway", sway: d.x, peak: d.peak, drift: st.drift, overturn: st.overturn, frequency: st.frequency, direction: world2, status: st.status });
26162
26279
  }
26163
26280
  };
26164
26281
  const isTerrain = (p) => !!p.spec.tags?.includes("terrain");
@@ -26366,7 +26483,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26366
26483
  const changed = st.status !== e.status || (time - e.t >= 0.5 || e.t === -Infinity) && (Math.abs(st.tilt - e.tilt) > 0.01 || Math.abs(st.settlement - e.s) > 2e-3);
26367
26484
  if (changed) {
26368
26485
  so.emitted = { t: time, s: st.settlement, tilt: st.tilt, status: st.status };
26369
- emit2({ ...base(o), type: "settle", settlement: st.settlement, tilt: st.tilt, direction: rotateVec(o.base.rot, st.direction), bearing: st.bearing, status: st.status });
26486
+ emit2({ ...base2(o), type: "settle", settlement: st.settlement, tilt: st.tilt, direction: rotateVec(o.base.rot, st.direction), bearing: st.bearing, status: st.status });
26370
26487
  }
26371
26488
  if (st.status === "toppled") topple(o);
26372
26489
  };
@@ -26415,7 +26532,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26415
26532
  p.st.status = "broken";
26416
26533
  p.st.hp = 0;
26417
26534
  p.st.mass = 0;
26418
- emit2({ ...base(o, src), type: "fracture", part: p.spec.id, style: "crumble", fragments, point: c });
26535
+ emit2({ ...base2(o, src), type: "fracture", part: p.spec.id, style: "crumble", fragments, point: c });
26419
26536
  debris2(o, p, p.mat.breakDebris, c, [0, 1, 0], clamp2(Math.round(Math.cbrt(partVolume(p.spec.shape)) * 30), 3, 20), 2, src);
26420
26537
  setStage(o, p, 3, {}, src);
26421
26538
  partLost(o, p, src);
@@ -26437,7 +26554,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26437
26554
  markHostedDirty(o, p.spec.id);
26438
26555
  setStage(o, p, 3, {}, src);
26439
26556
  }
26440
- if (whole2.length > 0) emit2({ ...base(o, src), type: "collapse", parts: whole2.map((p) => p.spec.id), mass: whole2.reduce((sum2, p) => sum2 + p.st.mass, 0) });
26557
+ if (whole2.length > 0) emit2({ ...base2(o, src), type: "collapse", parts: whole2.map((p) => p.spec.id), mass: whole2.reduce((sum2, p) => sum2 + p.st.mass, 0) });
26441
26558
  }
26442
26559
  for (const p of crumbling) crumbleMasonry(o, p, src);
26443
26560
  }
@@ -26758,7 +26875,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26758
26875
  r.st.subsidence = Math.max(r.st.subsidence ?? 0, drop.reduce((sum2, v) => sum2 + v, 0) / count);
26759
26876
  const middle = [from[0], from[1], from[2]];
26760
26877
  middle[axis2] = (stretch[0] + stretch[1]) / 2;
26761
- emit2({ ...base(o, src), type: "subside", part: r.spec.id, drop: r.st.subsidence, share: (stretch[1] - stretch[0]) / Math.max(1e-6, box5.max[axis2] - box5.min[axis2]), point: toWorld(o.st.position, o.st.rotation, middle), status: "opened" });
26878
+ emit2({ ...base2(o, src), type: "subside", part: r.spec.id, drop: r.st.subsidence, share: (stretch[1] - stretch[0]) / Math.max(1e-6, box5.max[axis2] - box5.min[axis2]), point: toWorld(o.st.position, o.st.rotation, middle), status: "opened" });
26762
26879
  let lost = false;
26763
26880
  for (const j of [...o.byPart.get(r.spec.id) ?? []]) {
26764
26881
  settleStructure(o);
@@ -26798,7 +26915,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26798
26915
  if (p.staged) {
26799
26916
  setStage(o, p, 1, {}, src);
26800
26917
  setStage(o, p, 2, { opening: { center: worldCenter, radius: hole.radius }, fragments }, src);
26801
- } else emit2({ ...base(o, src), type: "stage", part: p.spec.id, stage: 2, opening: { center: worldCenter, radius: hole.radius }, fragments });
26918
+ } else emit2({ ...base2(o, src), type: "stage", part: p.spec.id, stage: 2, opening: { center: worldCenter, radius: hole.radius }, fragments });
26802
26919
  debris2(o, p, p.mat.breakDebris, worldCenter, [0, 1, 0], 14, 2, src);
26803
26920
  if (p.spec.reinforcement) exposeRebar(o, p, src);
26804
26921
  };
@@ -26824,8 +26941,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26824
26941
  const width = clamp2(beta * SETTLEMENT_CRACK_OPENING, MIN_CRACK_WIDTH, MAX_CRACK_WIDTH);
26825
26942
  const through = q.dims[q.thin];
26826
26943
  for (let c = 0; c < count; c++) {
26827
- const back = c * SETTLEMENT_CRACK_SPACING;
26828
- const local2 = [clamp2(at4[0] - toward2[0] / reach2 * back, box5.min[0], box5.max[0]), box5.min[1] + height * (0.2 + 0.12 * c), clamp2(at4[2] - toward2[2] / reach2 * back, box5.min[2], box5.max[2])];
26944
+ const back2 = c * SETTLEMENT_CRACK_SPACING;
26945
+ const local2 = [clamp2(at4[0] - toward2[0] / reach2 * back2, box5.min[0], box5.max[0]), box5.min[1] + height * (0.2 + 0.12 * c), clamp2(at4[2] - toward2[2] / reach2 * back2, box5.min[2], box5.max[2])];
26829
26946
  const face = toLocal(q.pos, q.q, local2);
26830
26947
  face[q.thin] = through / 2;
26831
26948
  addCrack(o, q, toWorld(o.st.position, o.st.rotation, toWorld(q.pos, q.q, face)), normal, length2, src, { along: along2, step, width, through });
@@ -26947,7 +27064,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
26947
27064
  }
26948
27065
  if (bearing2.status === "settled" && drop - before < SUBSIDE_MIN && peak() - peakBefore < SUBSIDE_MIN) continue;
26949
27066
  b.p.st.subsidence = drop;
26950
- emit2({ ...base(o, src), type: "subside", part: b.p.spec.id, drop, share: fp.share, point: fp.deepest, status: bearing2.status });
27067
+ emit2({ ...base2(o, src), type: "subside", part: b.p.spec.id, drop, share: fp.share, point: fp.deepest, status: bearing2.status });
26951
27068
  }
26952
27069
  for (const { b, fp } of settled) {
26953
27070
  settleStructure(o);
@@ -27062,7 +27179,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27062
27179
  const known = implSolids.get(im);
27063
27180
  if (known && known.spec === spec && known.state === state && im.impl.collidersPending?.() !== true && sameImplPlace(known.key, im)) return known.solids;
27064
27181
  const pieces = im.impl.colliders?.();
27065
- if (pieces && known?.pieces && known.spec === spec && sameImplPlace(known.key, im) && pieces.length === known.pieces.length && pieces.every((piece2, i) => piece2 === known.pieces?.[i])) {
27182
+ if (pieces && known?.pieces && known.spec === spec && sameImplPlace(known.key, im) && pieces.length === known.pieces.length && pieces.every((piece3, i) => piece3 === known.pieces?.[i])) {
27066
27183
  implSolids.set(im, { ...known, state });
27067
27184
  return known.solids;
27068
27185
  }
@@ -27147,6 +27264,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27147
27264
  return fresh.map(([nid]) => nid);
27148
27265
  };
27149
27266
  let rayBroad = null;
27267
+ let surfaceTracer = null;
27150
27268
  let uncovered = [];
27151
27269
  let uncoveredFor = { hook: null, coverage: -1, objects: -1 };
27152
27270
  const metObjects = [];
@@ -27176,7 +27294,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27176
27294
  }
27177
27295
  return rayObjects;
27178
27296
  };
27179
- const raycastInternal = (origin, dir, maxDist, ignore, worldOnly = false, precise = false, skip = {}, scope2) => {
27297
+ const raycastInternal = (origin, dir, maxDist, ignore, worldOnly = false, precise = false, skip = {}, scope2, drawn = false, passed) => {
27180
27298
  const d = vec.normalize(dir);
27181
27299
  const asked = rayBroad && !scope2 && rayBroad.begin(origin, d, maxDist) ? rayBroad : null;
27182
27300
  const candidates = asked ? candidatesOf2(asked) : null;
@@ -27204,12 +27322,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27204
27322
  if (!r || r.t0 < 0 || r.t0 > maxDist) continue;
27205
27323
  if (p.st.opening && insideOpening(o, p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
27206
27324
  if (p.spec.apertures && throughAperture(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
27207
- if (p.st.chipped && insideChip(p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
27325
+ if (p.st.chipped && insideChip(p, objLocal(o, vec.madd(origin, d, Math.min(r.t0 + CHIP_PROBE_DEPTH, (r.t0 + r.t1) / 2))))) {
27326
+ passed?.push({ o, p, t: r.t0 });
27327
+ continue;
27328
+ }
27208
27329
  const gap = p.st.chipped?.length ? pastChips(o, p, origin, d, r.t0, r.t1) : null;
27209
27330
  if (gap === "through") continue;
27210
27331
  if (gap) {
27211
27332
  r.t0 = gap.t;
27212
27333
  r.n = gap.n;
27334
+ } else if (drawn && surfaceTracer) {
27335
+ const drawn2 = surfaceTracer({ object: o.id, part: p.spec.id, origin, direction: d, near: Math.max(0, r.t0 - SURFACE_SLACK), far: r.t1 + SURFACE_SLACK });
27336
+ if (drawn2 === null) continue;
27337
+ if (drawn2 && drawn2.distance <= maxDist && Math.abs(drawn2.distance - r.t0) > SURFACE_SAME) {
27338
+ r.t0 = drawn2.distance;
27339
+ r.n = [drawn2.normal[0], drawn2.normal[1], drawn2.normal[2]];
27340
+ }
27213
27341
  }
27214
27342
  if (!best || r.t0 < best.distance) {
27215
27343
  const point = vec.madd(origin, d, r.t0);
@@ -27350,14 +27478,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27350
27478
  arr[ni].radius = Math.max(arr[ni].radius, radius);
27351
27479
  } else arr.push(dent);
27352
27480
  markDamaged(p);
27353
- emit2({ ...base(o, src), type: "dent", part: p.spec.id, dent, worldPoint: wp });
27481
+ emit2({ ...base2(o, src), type: "dent", part: p.spec.id, dent, worldPoint: wp });
27354
27482
  };
27355
27483
  const addHole = (o, p, wp, wn, diameter, through, exit, src) => {
27356
27484
  const hole = { point: objLocal(o, wp), normal: objLocalDir(o, wn), diameter, through };
27357
27485
  p.st.holes.push(hole);
27358
27486
  if (p.st.holes.length > maxHoles) p.st.holes.shift();
27359
27487
  markDamaged(p);
27360
- emit2({ ...base(o, src), type: "hole", part: p.spec.id, hole, worldPoint: wp, ...exit ? { exitPoint: exit } : {}, ...p.spec.powder ? { powder: { ...p.spec.powder } } : {} });
27488
+ emit2({ ...base2(o, src), type: "hole", part: p.spec.id, hole, worldPoint: wp, ...exit ? { exitPoint: exit } : {}, ...p.spec.powder ? { powder: { ...p.spec.powder } } : {} });
27361
27489
  setStage(o, p, 1, {}, src);
27362
27490
  return hole;
27363
27491
  };
@@ -27366,13 +27494,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27366
27494
  p.st.cracks.push(crack);
27367
27495
  if (p.st.cracks.length > 16) p.st.cracks.shift();
27368
27496
  markDamaged(p);
27369
- emit2({ ...base(o, src), type: "crack", part: p.spec.id, crack, worldPoint: wp });
27497
+ emit2({ ...base2(o, src), type: "crack", part: p.spec.id, crack, worldPoint: wp });
27370
27498
  setStage(o, p, 1, {}, src);
27371
27499
  };
27372
- const debris2 = (o, p, kind, point, normal, count, speed, src, material) => emit2({ ...base(o, src), type: "debris", part: p.spec.id, kind, point, normal, count, speed, ...material && material !== p.spec.material ? { material } : {} });
27500
+ const debris2 = (o, p, kind, point, normal, count, speed, src, material) => emit2({ ...base2(o, src), type: "debris", part: p.spec.id, kind, point, normal, count, speed, ...material && material !== p.spec.material ? { material } : {} });
27373
27501
  const holeRate = (hole, pressurized) => (pressurized ? 0.5 : 0.1) * (hole.diameter / 9e-3);
27374
27502
  const detachEvents = (o, opened, by, src) => {
27375
- for (const j of opened) emit2({ ...base(o, src), type: "detach", joint: j.spec.id, parts: [j.spec.a, j.spec.b], by, groups: o.st.groups.map((g) => [...g]) });
27503
+ for (const j of opened) emit2({ ...base2(o, src), type: "detach", joint: j.spec.id, parts: [j.spec.a, j.spec.b], by, groups: o.st.groups.map((g) => [...g]) });
27376
27504
  };
27377
27505
  const loosened = (o, opened, by, src) => {
27378
27506
  if (runDepth === 0) {
@@ -27451,7 +27579,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27451
27579
  const checkDestroyed = (o, src) => {
27452
27580
  if (!o.st.destroyed && o.parts.length > 0 && o.parts.every(isLost)) {
27453
27581
  o.st.destroyed = true;
27454
- emit2({ ...base(o, src), type: "destroyed" });
27582
+ emit2({ ...base2(o, src), type: "destroyed" });
27455
27583
  }
27456
27584
  };
27457
27585
  const holeReaches = (host, box5) => {
@@ -27491,7 +27619,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27491
27619
  } else {
27492
27620
  o.hostedHosts = new Set(o.hosted.map((p) => p.spec.hostedIn));
27493
27621
  }
27494
- for (const p of shown) emit2({ ...base(o), type: "reveal", part: p.spec.id, host: p.spec.hostedIn });
27622
+ for (const p of shown) emit2({ ...base2(o), type: "reveal", part: p.spec.id, host: p.spec.hostedIn });
27495
27623
  if (opened.length > 0) {
27496
27624
  loosened(o, opened, "break");
27497
27625
  collapseCheck(o);
@@ -27617,26 +27745,48 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27617
27745
  const setStage = (o, p, stage2, extra = {}, src) => {
27618
27746
  if (!p.staged || (p.st.stage ?? 0) >= stage2) return;
27619
27747
  p.st.stage = stage2;
27620
- emit2({ ...base(o, src), type: "stage", part: p.spec.id, stage: stage2, ...extra });
27748
+ emit2({ ...base2(o, src), type: "stage", part: p.spec.id, stage: stage2, ...extra });
27749
+ };
27750
+ const faceOf = (o, p, worldNormal) => faceOfNormal(p.layers, p.thin, rotateVec(quat.conjugate(partXf(o, p).q), worldNormal));
27751
+ const spallNormal = (o, p, face) => {
27752
+ if (Math.abs(face) === 1) return {};
27753
+ const local2 = [0, 0, 0];
27754
+ local2[faceAxis(p.thin, face)] = face > 0 ? 1 : -1;
27755
+ return { normal: rotateVec(partXf(o, p).q, local2) };
27756
+ };
27757
+ const widenTear = (o, p, torn, lp, normal, radius, src) => {
27758
+ const spalls = p.rt.spalls;
27759
+ const s = spalls[torn.spall];
27760
+ const axis2 = faceAxis(p.thin, s[1]);
27761
+ const faceArea = p.dims.reduce((area3, size, k) => k === axis2 ? area3 : area3 * size, 1);
27762
+ const reach2 = Math.hypot(lp[0] - s[2], lp[1] - s[3], lp[2] - s[4]);
27763
+ const r = Math.min(Math.sqrt(faceArea / Math.PI), Math.max(Math.sqrt(s[5] * s[5] + radius * radius), reach2));
27764
+ if (r <= s[5]) return;
27765
+ spalls[torn.spall] = [s[0], s[1], s[2], s[3], s[4], r];
27766
+ markDamaged(p);
27767
+ const centre = toWorld(o.st.position, o.st.rotation, [s[2], s[3], s[4]]);
27768
+ emit2({ ...base2(o, src), type: "spall", part: p.spec.id, layer: torn.layer.index, point: centre, area: Math.PI * r * r, ...spallNormal(o, p, s[1]) });
27769
+ debris2(o, p, torn.layer.mat.hitDebris, toWorld(o.st.position, o.st.rotation, lp), normal, 5, 2, src, torn.layer.mat.id);
27621
27770
  };
27622
- const faceOf = (o, p, worldNormal) => rotateVec(quat.conjugate(partXf(o, p).q), worldNormal)[p.thin] >= 0 ? 1 : -1;
27623
27771
  const spallOuter = (o, p, wp, face, normal, radius, src) => {
27624
27772
  var _a;
27625
27773
  if (p.layers.length === 0) return;
27626
27774
  const lp = objLocal(o, wp);
27775
+ const torn = tornPatchAt(p.layers, p.rt.spalls, face, lp, radius);
27776
+ if (torn) return widenTear(o, p, torn, lp, normal, radius, src);
27627
27777
  const layer3 = outerLayer(p.layers, p.rt.spalls, face, lp);
27628
27778
  if (!layer3) return;
27629
27779
  const spalls = (_a = p.rt).spalls ?? (_a.spalls = []);
27630
27780
  spalls.push([layer3.index, face, lp[0], lp[1], lp[2], radius]);
27631
27781
  if (spalls.length > MAX_SPALLS) spalls.shift();
27632
27782
  markDamaged(p);
27633
- emit2({ ...base(o, src), type: "spall", part: p.spec.id, layer: layer3.index, point: wp, area: Math.PI * radius * radius });
27783
+ emit2({ ...base2(o, src), type: "spall", part: p.spec.id, layer: layer3.index, point: wp, area: Math.PI * radius * radius, ...spallNormal(o, p, face) });
27634
27784
  debris2(o, p, layer3.mat.hitDebris, wp, normal, 5, 2, src, layer3.mat.id);
27635
27785
  setStage(o, p, 1, {}, src);
27636
27786
  };
27637
27787
  const crater = (o, p, wp, normal, radius, src) => {
27638
27788
  markDamaged(p);
27639
- emit2({ ...base(o, src), type: "spall", part: p.spec.id, layer: -1, point: wp, area: Math.PI * radius * radius });
27789
+ emit2({ ...base2(o, src), type: "spall", part: p.spec.id, layer: -1, point: wp, area: Math.PI * radius * radius });
27640
27790
  debris2(o, p, p.mat.breakDebris, wp, normal, 6, 1.5, src);
27641
27791
  setStage(o, p, 1, {}, src);
27642
27792
  };
@@ -27705,7 +27855,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27705
27855
  if (!layer3 || cells.length === 0) return [];
27706
27856
  const { c, q } = partXf(o, p);
27707
27857
  const [u, v] = planeAxes(p.thin);
27708
- const faces = layer3.def.faces === "both" ? [1, -1] : [layer3.def.faces === "+" ? 1 : -1];
27858
+ const faces = thinSidesOf(layer3.def);
27709
27859
  const area3 = cells.reduce((sum2, cell) => sum2 + cell.size[u] * cell.size[v], 0) * faces.length;
27710
27860
  const count = Math.min(MAX_PLASTER_FLAKES, Math.ceil(area3 / PLASTER_FLAKE_AREA));
27711
27861
  const out = [];
@@ -27887,6 +28037,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27887
28037
  }
27888
28038
  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);
27889
28039
  };
28040
+ const alongAt = (along2, at4) => {
28041
+ const point = [0, 0, 0];
28042
+ point[along2] = at4;
28043
+ return point;
28044
+ };
27890
28045
  const wornLocally = (p) => !!p.spec.reinforcement && !!p.spec.units && p.spec.units.mortar === p.spec.material && isMember(p.dims, p.spec.structure?.role) && p.spec.shape.kind === "box";
27891
28046
  const wearMember = (o, p, entry2, d, E, caliber, penMm, src) => {
27892
28047
  var _a, _b, _c;
@@ -27921,7 +28076,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27921
28076
  const wear = (_c = p.rt).cellWear ?? (_c.cellWear = {});
27922
28077
  const cell = grid[hit];
27923
28078
  wear[hit] = (wear[hit] ?? 0) + volume;
27924
- if (wear[hit] >= MEMBER_UNIT_LOSS * cell.size[0] * cell.size[1] * cell.size[2]) knockOutUnits(o, p, entry2, E, [hit], src);
28079
+ if (wear[hit] >= MEMBER_UNIT_LOSS * cell.size[0] * cell.size[1] * cell.size[2]) knockOutUnits(o, p, entry2, E, [hit], src, d);
27925
28080
  return true;
27926
28081
  }
27927
28082
  const out = [];
@@ -27929,8 +28084,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27929
28084
  if (gone[i] === -1) continue;
27930
28085
  if (Math.abs(grid[i].center[along2] - bandCenter) <= height / 2 + 1e-6) out.push(i);
27931
28086
  }
27932
- if (out.length > 0) knockOutUnits(o, p, entry2, E, out, src);
27933
- giveAtCut(o, p, src);
28087
+ worn[band] = 1;
28088
+ if (out.length > 0) knockOutUnits(o, p, entry2, E, out, src, d);
28089
+ giveAtCut(o, p, src, { at: alongAt(along2, bandCenter), d });
27934
28090
  return true;
27935
28091
  };
27936
28092
  const chipUnits = (o, p, kind, wp, hitEnergy, dir, radius, src) => {
@@ -28002,7 +28158,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28002
28158
  p.rt.removed = (p.rt.removed ?? 0) + mass;
28003
28159
  markDamaged(p);
28004
28160
  setStage(o, p, 1, {}, src);
28005
- emit2({ ...base(o, src), type: "chip", part: p.spec.id, center, size: [cell.size[0], cell.size[1], cell.size[2]], rotation: q, fragments });
28161
+ emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [cell.size[0], cell.size[1], cell.size[2]], rotation: q, fragments });
28006
28162
  debris2(o, p, p.mat.breakDebris, center, vec.scale(dir ?? [0, 1, 0], -1), 6, 2, src);
28007
28163
  }
28008
28164
  markHostedDirty(o, p.spec.id);
@@ -28037,18 +28193,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28037
28193
  const n = clamp2(Math.round(cell.size[u] * cell.size[v] / (bit * bit * 3)), 4, 10) + Math.floor(rnd2() * 3);
28038
28194
  const out = [];
28039
28195
  for (let i = 0; i < n; i++) {
28040
- const back = i % 3 === 2;
28196
+ const back2 = i % 3 === 2;
28041
28197
  const lc = [cell.center[0], cell.center[1], cell.center[2]];
28042
28198
  lc[u] += (rnd2() - 0.5) * cell.size[u] * 0.7;
28043
28199
  lc[v] += (rnd2() - 0.5) * cell.size[v] * 0.7;
28044
- lc[p.thin] += (back ? -exitSign : exitSign) * (p.thickness / 2 + 0.01);
28200
+ lc[p.thin] += (back2 ? -exitSign : exitSign) * (p.thickness / 2 + 0.01);
28045
28201
  const size = [0, 0, 0];
28046
28202
  size[u] = bit * (0.6 + 0.8 * rnd2());
28047
28203
  size[v] = bit * (0.5 + 0.7 * rnd2());
28048
28204
  size[p.thin] = bit * (0.4 + 0.6 * rnd2());
28049
28205
  const spread3 = [(rnd2() - 0.5) * 0.9, (rnd2() - 0.3) * 0.9, (rnd2() - 0.5) * 0.9];
28050
- const k = speed * (back ? 0.4 + 0.4 * rnd2() : 0.7 + 0.8 * rnd2());
28051
- const vdir = vec.normalize(vec.add(back ? vec.scale(d, -1) : d, spread3));
28206
+ const k = speed * (back2 ? 0.4 + 0.4 * rnd2() : 0.7 + 0.8 * rnd2());
28207
+ const vdir = vec.normalize(vec.add(back2 ? vec.scale(d, -1) : d, spread3));
28052
28208
  out.push({
28053
28209
  id: `${p.spec.id}#${tag}${i}`,
28054
28210
  part: p.spec.id,
@@ -28065,8 +28221,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28065
28221
  }
28066
28222
  return out;
28067
28223
  };
28068
- const exposeRebar = (o, p, src) => {
28069
- settleStructure(o);
28224
+ const exposeRebar = (o, p, src, bowed = true) => {
28225
+ if (bowed) settleStructure(o);
28070
28226
  const r = p.spec.reinforcement;
28071
28227
  if (!r) return;
28072
28228
  const [u, v] = planeAxes(p.thin);
@@ -28083,14 +28239,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28083
28239
  bars.push(...clipBarsToDisc(all, u, v, [lc[u], lc[v]], op.radius + 0.05));
28084
28240
  }
28085
28241
  }
28086
- const bow2 = clamp2(((p.st.stress ?? 0) - 1) / 0.5, 0, 1);
28242
+ const bow2 = bowed ? clamp2(((p.st.stress ?? 0) - 1) / 0.5, 0, 1) : 0;
28087
28243
  if (bow2 > 0) bars = bars.flatMap((bar2, i) => bendBar(bar2, p.thin, bow2 * BAR_BOW, i));
28088
28244
  const stirrups = memberStirrups(p.dims, void 0, p.spec.structure?.role);
28089
28245
  if (stirrups.length > 0 && bars.length > 0) {
28090
28246
  if (p.st.stripped) bars = [...bars, ...stirrups];
28091
28247
  else for (const box5 of [...p.st.chipped ?? [], ...p.rt.bared ?? []]) bars.push(...clipBarsToVolume(stirrups, box5.center, box5.size));
28092
28248
  }
28093
- emit2({ ...base(o, src), type: "expose", part: p.spec.id, bars: worldBars(o, p, bars) });
28249
+ emit2({ ...base2(o, src), type: "expose", part: p.spec.id, bars: worldBars(o, p, bars) });
28094
28250
  };
28095
28251
  const openBreach = (o, p, center, total, energy, dir, src) => {
28096
28252
  const [u, v] = planeAxes(p.thin);
@@ -28251,7 +28407,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28251
28407
  for (const i of out) worn[i] = -1;
28252
28408
  return knockOutUnits(o, p, point, energy, out, src);
28253
28409
  };
28254
- const knockOutUnits = (o, p, wp, energy, out, src) => {
28410
+ const knockOutUnits = (o, p, wp, energy, out, src, d) => {
28255
28411
  var _a, _b;
28256
28412
  const [u, v] = planeAxes(p.thin);
28257
28413
  const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
@@ -28295,15 +28451,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28295
28451
  setStage(o, p, 1, {}, src);
28296
28452
  const center = toWorld(c, q, [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2]);
28297
28453
  const units = cells.map((cell) => ({ center: toWorld(c, q, cell.center), size: [cell.size[0], cell.size[1], cell.size[2]] }));
28298
- emit2({ ...base(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
28454
+ emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
28299
28455
  debris2(o, p, p.mat.breakDebris, center, vec.normalize(vec.sub(center, wp), [0, 1, 0]), 14, 3, src);
28300
- if (p.spec.reinforcement) exposeRebar(o, p, src);
28456
+ const cut = wornLocally(p) && cutBandsGone(o, p, cells, d ?? vec.normalize(vec.sub(partXf(o, p).c, wp), [1, 0, 0]), src);
28457
+ if (p.spec.reinforcement && !cut) exposeRebar(o, p, src);
28301
28458
  if (p.structural && !isLost(p)) {
28302
28459
  solveStructure(o);
28303
28460
  collapseCheck(o, src);
28304
28461
  }
28305
28462
  return true;
28306
28463
  };
28464
+ const cutBandsGone = (o, p, cells, d, src) => {
28465
+ var _a;
28466
+ const along2 = p.dims.indexOf(Math.max(...p.dims));
28467
+ const bands = Math.max(1, Math.round(p.dims[along2] / MEMBER_BAND));
28468
+ const height = p.dims[along2] / bands;
28469
+ const bandOf2 = (at4) => clamp2(Math.floor((at4 + p.dims[along2] / 2) / p.dims[along2] * bands), 0, bands - 1);
28470
+ const grid = gridOf(p);
28471
+ const gone = p.rt.chips ?? {};
28472
+ const worn = (_a = p.rt).bands ?? (_a.bands = {});
28473
+ for (const band of new Set(cells.map((cell) => bandOf2(cell.center[along2])))) {
28474
+ if ((worn[band] ?? 0) >= 1) continue;
28475
+ const center = -p.dims[along2] / 2 + (band + 0.5) * height;
28476
+ if (!grid.every((cell, i) => gone[i] === -1 || Math.abs(cell.center[along2] - center) > height / 2 + 1e-6)) continue;
28477
+ worn[band] = 1;
28478
+ return giveAtCut(o, p, src, { at: alongAt(along2, center), d });
28479
+ }
28480
+ return false;
28481
+ };
28307
28482
  const dropUnsupported = (o, p, src) => {
28308
28483
  var _a, _b;
28309
28484
  if (!p.spec.units || p.spec.units.mortar === p.spec.material || p.st.stripped || isLost(p)) return 0;
@@ -28337,17 +28512,90 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28337
28512
  p.rt.removed = (p.rt.removed ?? 0) + mass;
28338
28513
  markDamaged(p);
28339
28514
  const units = fallen.map((cell) => ({ center: toWorld(c, q, cell.center), size: [cell.size[0], cell.size[1], cell.size[2]] }));
28340
- emit2({ ...base(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
28515
+ emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center, size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]], rotation: q, fragments, units });
28341
28516
  debris2(o, p, p.mat.breakDebris, center, [0, -1, 0], 6, 1, src);
28342
28517
  return loose.length;
28343
28518
  };
28344
- const giveAtCut = (o, p, src) => {
28519
+ const barsMoment = (p) => {
28520
+ const r = p.spec.reinforcement;
28521
+ if (!r) return 0;
28522
+ const left = rebarBars(p.dims, p.thin, r.spacing, p.spec.structure?.role).length - (p.rt.severedBars?.length ?? 0);
28523
+ const along2 = p.dims.indexOf(Math.max(...p.dims));
28524
+ const side = Math.min(...p.dims.filter((_, a) => a !== along2));
28525
+ const fy = (materials.get(r.material)?.bending?.yieldMPa ?? STEEL_YIELD_MPA) * 1e6;
28526
+ return Math.max(0, left) / 2 * Math.PI * (r.diameter / 2) ** 2 * fy * Math.max(0, side - 2 * REBAR_COVER);
28527
+ };
28528
+ const memberSide = (p) => {
28529
+ const along2 = p.dims.indexOf(Math.max(...p.dims));
28530
+ return Math.min(...p.dims.filter((_, a) => a !== along2));
28531
+ };
28532
+ const tubeMoment = (p, share) => {
28533
+ const [a = 0, b = 0] = [...p.dims].sort((x, y) => x - y);
28534
+ const fy = (p.mat.bending?.yieldMPa ?? STEEL_YIELD_MPA) * 1e6;
28535
+ return fy * p.thickness * ((a + b) / 2) ** 2 * Math.max(0, 1 - share) ** 2;
28536
+ };
28537
+ const holdsAbove = (o, p, j) => {
28538
+ if (j.st.open) return false;
28539
+ const other = o.parts[j.ia === o.idx.get(p.spec.id) ? j.ib : j.ia];
28540
+ if (j.bears === "a_on_b") return j.spec.b === p.spec.id;
28541
+ if (j.bears === "b_on_a") return j.spec.a === p.spec.id;
28542
+ return partXf(o, other).c[1] > partXf(o, p).c[1] + 1e-6;
28543
+ };
28544
+ const hingeAcross = (o, p, opened, cut, src) => {
28545
+ var _a;
28546
+ const blow22 = cut.d ? objLocalDir(o, cut.d) : [1, 0, 0];
28547
+ const across2 = vec.normalize([blow22[0], 0, blow22[2]], [1, 0, 0]);
28548
+ const point = vec.madd(vec.add(p.pos, rotateVec(p.q, cut.at)), across2, cut.behind);
28549
+ const toward2 = vec.scale(across2, -1);
28550
+ const moment = cut.moment;
28551
+ const hinges = (_a = p.rt).hinges ?? (_a.hinges = []);
28552
+ for (const j of opened) {
28553
+ j.st.yields = { point, toward: toward2, moment };
28554
+ hinges.push({ joint: j.spec.id, point, toward: toward2, moment });
28555
+ }
28556
+ emitYields(o, p, src);
28557
+ };
28558
+ const reyield = (o, p, moment, src) => {
28559
+ for (const h of p.rt.hinges ?? []) h.moment = moment;
28560
+ for (const j of o.byPart.get(p.spec.id) ?? []) if (j.st.yields) j.st.yields.moment = moment;
28561
+ emitYields(o, p, src);
28562
+ };
28563
+ const emitYields = (o, p, src) => {
28564
+ for (const h of p.rt.hinges ?? []) {
28565
+ const point = toWorld(o.st.position, o.st.rotation, h.point);
28566
+ emit2({ ...base2(o, src), type: "yield", part: p.spec.id, joint: h.joint, point, toward: rotateVec(o.st.rotation, h.toward), moment: h.moment });
28567
+ }
28568
+ };
28569
+ const severBars = (o, p, origin, d, caliber, src) => {
28570
+ var _a;
28571
+ const r = p.spec.reinforcement;
28572
+ if (!r || isLost(p) || !isMember(p.dims, p.spec.structure?.role)) return;
28573
+ const along2 = p.dims.indexOf(Math.max(...p.dims));
28574
+ const [u, v] = [0, 1, 2].filter((k) => k !== along2);
28575
+ const lo = toLocal(p.pos, p.q, objLocal(o, origin));
28576
+ const ld = rotateVec(quat.conjugate(p.q), objLocalDir(o, d));
28577
+ const across2 = Math.hypot(ld[u], ld[v]);
28578
+ if (across2 < 1e-6) return;
28579
+ const cut = (_a = p.rt).severedBars ?? (_a.severedBars = []);
28580
+ let severed = 0;
28581
+ rebarBars(p.dims, p.thin, r.spacing, p.spec.structure?.role).forEach(([a], i) => {
28582
+ if (cut.includes(i)) return;
28583
+ const du = a[u] - lo[u];
28584
+ const dv = a[v] - lo[v];
28585
+ if (Math.abs(du * ld[v] - dv * ld[u]) / across2 > r.diameter / 2 + caliber / 2e3) return;
28586
+ cut.push(i);
28587
+ severed++;
28588
+ const s = (du * ld[u] + dv * ld[v]) / (across2 * across2);
28589
+ const at4 = vec.madd(origin, d, s * vec.length(d));
28590
+ debris2(o, p, "sparks", at4, vec.scale(d, -1), 6, 3, src);
28591
+ });
28592
+ if (severed > 0) reyield(o, p, barsMoment(p), src);
28593
+ };
28594
+ const giveAtCut = (o, p, src, cut) => {
28345
28595
  if (!p.spec.reinforcement || !p.spec.units || !p.st.chipped?.length || sectionLoss(p) <= 0) return false;
28346
28596
  const opened = [];
28347
28597
  for (const j of o.byPart.get(p.spec.id) ?? []) {
28348
- if (j.st.open) continue;
28349
- const onIt = j.bears === "a_on_b" && j.spec.b === p.spec.id || j.bears === "b_on_a" && j.spec.a === p.spec.id;
28350
- if (!onIt) continue;
28598
+ if (!j.bears || !holdsAbove(o, p, j)) continue;
28351
28599
  j.st.open = true;
28352
28600
  j.st.openedBy = "break";
28353
28601
  opened.push(j);
@@ -28355,8 +28603,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28355
28603
  if (opened.length === 0) return false;
28356
28604
  p.st.hp = Math.max(p.st.hp, p.st.maxHp * GIVE_AT_CUT_HP);
28357
28605
  markDamaged(p);
28606
+ if (cut) hingeAcross(o, p, opened, { at: cut.at, d: cut.d, behind: memberSide(p) / 2 - REBAR_COVER, moment: barsMoment(p) }, src);
28358
28607
  loosened(o, opened, "break", src);
28359
- exposeRebar(o, p, src);
28608
+ exposeRebar(o, p, src, !cut);
28360
28609
  collapseCheck(o, src);
28361
28610
  return true;
28362
28611
  };
@@ -28384,7 +28633,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28384
28633
  p.st.status = "broken";
28385
28634
  p.st.hp = 0;
28386
28635
  p.st.mass = 0;
28387
- emit2({ ...base(o, src), type: "expose", part: p.spec.id, bars: [] });
28636
+ emit2({ ...base2(o, src), type: "expose", part: p.spec.id, bars: [] });
28388
28637
  debris2(o, p, "sparks", partXf(o, p).c, [0, 1, 0], 6, 3, src);
28389
28638
  partLost(o, p, src);
28390
28639
  };
@@ -28483,7 +28732,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28483
28732
  p.st.burning = false;
28484
28733
  p.rt.jet = false;
28485
28734
  }
28486
- emit2({ ...base(o, src), type: "fracture", part: p.spec.id, style, fragments, point: hitW });
28735
+ emit2({ ...base2(o, src), type: "fracture", part: p.spec.id, style, fragments, point: hitW });
28487
28736
  debris2(o, p, p.mat.breakDebris, c, [0, 1, 0], clamp2(Math.round(Math.cbrt(partVolume(p.spec.shape)) * 30), 3, 20), 2, src);
28488
28737
  setStage(o, p, 3, {}, src);
28489
28738
  if (reinforcement) {
@@ -28491,7 +28740,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28491
28740
  return;
28492
28741
  }
28493
28742
  if (ex) {
28494
- emit2({ ...base(o, src), type: "explode", part: p.spec.id, point: c, energy: ex.energy, radius: ex.radius, ...ex.lethalRadius !== void 0 ? { lethalRadius: ex.lethalRadius } : {}, ...ex.tnt !== void 0 ? { tnt: ex.tnt } : {}, ...ex.effect !== void 0 ? { effect: ex.effect } : {} });
28743
+ emit2({ ...base2(o, src), type: "explode", part: p.spec.id, point: c, energy: ex.energy, radius: ex.radius, ...ex.lethalRadius !== void 0 ? { lethalRadius: ex.lethalRadius } : {}, ...ex.tnt !== void 0 ? { tnt: ex.tnt } : {}, ...ex.effect !== void 0 ? { effect: ex.effect } : {} });
28495
28744
  const fuel = burstFuel(p);
28496
28745
  blasts.push({ point: c, energy: ex.energy, radius: ex.radius, ...ex.lethalRadius !== void 0 ? { lethalRadius: ex.lethalRadius } : {}, ...fuel > 0 ? { fuel } : {}, source: src });
28497
28746
  }
@@ -28504,7 +28753,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28504
28753
  p.rt.chainDue = time + delay;
28505
28754
  primed.set(p, o);
28506
28755
  o.active = true;
28507
- emit2({ ...base(o, src), type: "primed", part: p.spec.id, point: partXf(o, p).c, trigger, delay });
28756
+ emit2({ ...base2(o, src), type: "primed", part: p.spec.id, point: partXf(o, p).c, trigger, delay });
28508
28757
  };
28509
28758
  const CHAIN_TRIGGER_OF = { ballistic: "shot", explosive: "explosion" };
28510
28759
  const severAxis = (p) => {
@@ -28541,7 +28790,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28541
28790
  if (p.st.hp <= 0 && p.mat.fracture === "none" && !p.spec.explodes) p.st.hp = Math.min(prev, 1);
28542
28791
  if (p.st.hp <= 0 && type === "ballistic" && wornLocally(p)) p.st.hp = Math.min(prev, 1);
28543
28792
  const done = prev - p.st.hp;
28544
- if (done > 0) emit2({ ...base(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
28793
+ if (done > 0) emit2({ ...base2(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
28545
28794
  if (p.st.hp <= 0) failPart(o, p, origin, dir, fragEnergy * weight, cap, src);
28546
28795
  else if (chained && (trigger === "explosion" || 1 - p.st.hp / p.st.maxHp >= shotDamageFractionOf(p.spec))) prime(o, p, trigger, src);
28547
28796
  return done;
@@ -28583,27 +28832,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28583
28832
  const n = shot ? exit ? clamp2(Math.round(E / joules), 1, 7) : 1 : clamp2(Math.floor(E / joules), 0, 5);
28584
28833
  if (n === 0) return;
28585
28834
  const fibre = tear === "lumps";
28835
+ const strips = tear === "strips";
28586
28836
  const { q } = partXf(o, p);
28587
28837
  const along2 = (p.spec.grain ? AXIS[p.spec.grain] : void 0) ?? [0, 1, 2].sort((a, b) => p.dims[b] - p.dims[a])[0];
28588
28838
  const fragments = [];
28589
28839
  for (let i = 0; i < n; i++) {
28590
- const back = !exit || i % 3 === 2;
28840
+ const back2 = !exit || i % 3 === 2;
28591
28841
  const plies = p.mat.splitForm === "plies";
28592
- const len = scale * (fibre ? 1.2 + 1.2 * rnd2() : 3 + 4 * rnd2()), w = scale * (0.8 + 0.8 * rnd2()), t = scale * (fibre ? 0.7 + 0.6 * rnd2() : plies ? 0.15 + 0.15 * rnd2() : 0.4 + 0.4 * rnd2());
28842
+ const len = scale * (fibre ? 1.2 + 1.2 * rnd2() : strips ? 6 + 6 * rnd2() : 3 + 4 * rnd2()), w = scale * (strips ? 1 + rnd2() : 0.8 + 0.8 * rnd2());
28843
+ const t = strips ? Math.min(p.thickness, STRIP_THICKNESS) : scale * (fibre ? 0.7 + 0.6 * rnd2() : plies ? 0.15 + 0.15 * rnd2() : 0.4 + 0.4 * rnd2());
28593
28844
  const size = [w, w, w];
28594
28845
  size[along2] = len;
28595
28846
  size[(along2 + 1) % 3] = w;
28596
28847
  size[(along2 + 2) % 3] = t;
28597
28848
  const spread3 = [(rnd2() - 0.5) * 0.8, (rnd2() - 0.2) * 0.8, (rnd2() - 0.5) * 0.8];
28598
- const speed = shot ? back ? 1.5 + 2 * rnd2() : 2 + 4 * rnd2() : 0.8 + 1.2 * rnd2();
28599
- const v = vec.scale(vec.normalize(vec.add(back ? vec.scale(d, -1) : d, spread3)), speed);
28849
+ const speed = shot ? back2 ? 1.5 + 2 * rnd2() : 2 + 4 * rnd2() : 0.8 + 1.2 * rnd2();
28850
+ const v = vec.scale(vec.normalize(vec.add(back2 ? vec.scale(d, -1) : d, spread3)), speed);
28600
28851
  const mass = size[0] * size[1] * size[2] * p.mat.density;
28601
28852
  fragments.push({
28602
28853
  id: `${p.spec.id}#t${tears++}-${i}`,
28603
28854
  part: p.spec.id,
28604
28855
  material: p.spec.material,
28605
- shape: fibre ? "chunk" : "splinter",
28606
- center: back || !exit ? vec.madd(entry2, d, -0.01) : vec.madd(exit, d, 0.01),
28856
+ shape: fibre ? "chunk" : strips ? "scrap" : "splinter",
28857
+ center: back2 || !exit ? vec.madd(entry2, d, -0.01) : vec.madd(exit, d, 0.01),
28607
28858
  size,
28608
28859
  rotation: q,
28609
28860
  velocity: v,
@@ -28613,14 +28864,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28613
28864
  });
28614
28865
  }
28615
28866
  const patch = [scale * 4, scale * 4, scale * 4];
28616
- emit2({ ...base(o, src), type: "chip", part: p.spec.id, center: exit ?? entry2, size: patch, rotation: q, fragments, torn: true });
28867
+ emit2({ ...base2(o, src), type: "chip", part: p.spec.id, center: exit ?? entry2, size: patch, rotation: q, fragments, torn: true });
28617
28868
  };
28618
28869
  const ballistic = (o, p, entry2, n, d, E, caliber, pathLen, src, round5 = {}) => {
28619
28870
  const mat = p.mat;
28620
- const piece2 = round5.piece;
28621
- const weight = piece2?.weight ?? 1;
28871
+ const piece3 = round5.piece;
28872
+ const weight = piece3?.weight ?? 1;
28622
28873
  const piercing = round5.piercing ?? 1;
28623
- if (p.st.stripped || p.st.opening && insideOpening(o, p, objLocal(o, entry2)) || insideChip(p, objLocal(o, entry2))) {
28874
+ if (p.st.stripped || p.st.opening && insideOpening(o, p, objLocal(o, entry2)) || insideChip(p, objLocal(o, vec.madd(entry2, d, Math.min(CHIP_PROBE_DEPTH, pathLen / 2))))) {
28624
28875
  return { penetrated: true, exitEnergy: E, exitPoint: vec.madd(entry2, d, Math.min(pathLen, p.thickness)), damage: 0 };
28625
28876
  }
28626
28877
  const sin2 = Math.min(1, Math.abs(vec.dot(d, n)));
@@ -28634,14 +28885,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28634
28885
  const hard = mat.tags?.includes("metal") || mat.tags?.includes("masonry");
28635
28886
  const penMm = penetrationOf(mat, round5.penetration);
28636
28887
  const Ep = penMm !== void 0 ? penMm * mat.penetration : piercing === 1 || !hard ? E : E * piercing;
28637
- const strength = piece2 && mat.strength?.ndrc ? mat.strength.compressiveMPa : void 0;
28888
+ const strength = piece3 && mat.strength?.ndrc ? mat.strength.compressiveMPa : void 0;
28638
28889
  const path = strength === void 0 ? 0 : (p.thickness + layersThickness(p.layers, face) + layersThickness(p.layers, -face)) / slant;
28639
- const penetrated = Ep > thr && (strength === void 0 || !piece2 || concretePerforation({ mass: piece2.mass, caliber: caliber / 1e3, speed: Math.sqrt(2 * E / piece2.mass), compressiveMPa: strength, nose: piece2.nose }).perforation > path);
28890
+ const penetrated = Ep > thr && (strength === void 0 || !piece3 || concretePerforation({ mass: piece3.mass, caliber: caliber / 1e3, speed: Math.sqrt(2 * E / piece3.mass), compressiveMPa: strength, nose: piece3.nose }).perforation > path);
28640
28891
  const scale = (mat.damageScale?.ballistic ?? 1) * (mat.fracture === "shatter" ? fragility(mat.ductility, p.thickness) : 1);
28641
28892
  const id = p.spec.id;
28642
28893
  if (!penetrated && mat.ricochetDeg && angle < mat.ricochetDeg) {
28643
28894
  const r = vec.sub(d, vec.scale(n, 2 * vec.dot(d, n)));
28644
- emit2({ ...base(o, src), type: "ricochet", part: id, point: entry2, direction: vec.normalize(r), energy: E * 0.4 });
28895
+ emit2({ ...base2(o, src), type: "ricochet", part: id, point: entry2, direction: vec.normalize(r), energy: E * 0.4 });
28645
28896
  debris2(o, p, mat.hitDebris, entry2, n, 3, 3, src);
28646
28897
  const dmg2 = applyDamage(o, p, E * DMG_PER_J * scale * 0.2, "ballistic", entry2, d, E * 0.1, 12, src, weight);
28647
28898
  return { penetrated: false, exitEnergy: 0, damage: dmg2 };
@@ -28652,10 +28903,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28652
28903
  const ratio = Ep / Math.max(thr, 1e-6);
28653
28904
  const crackLen = clamp2(0.03 + ratio * 0.2, 0.03, 0.8);
28654
28905
  let exitPoint;
28906
+ let shellShare = 0;
28655
28907
  if (penetrated) {
28656
28908
  const exitDist = p.spec.contains || p.spec.fill !== void 0 && p.spec.fill < 0.5 || p.thickness < pathLen * 0.5 ? pathLen : Math.min(pathLen, effM + layersThickness(p.layers, face) / slant + layersThickness(p.layers, -face) / slant);
28657
28909
  exitPoint = vec.madd(entry2, d, exitDist);
28658
28910
  const hole = addHole(o, p, entry2, n, caliber / 1e3 * (mat.ductility >= 0.3 ? 1 : 1.5), true, exitPoint, src);
28911
+ shellShare = wearsShell(p, hole.diameter * 2);
28659
28912
  if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src);
28660
28913
  addBreach(o, p, entry2, Math.PI * (hole.diameter / 2) * (hole.diameter / 2), E, d, src);
28661
28914
  if (mat.ductility >= 0.5 && p.thickness <= THIN_SHEET_DISHING) addDent(o, p, entry2, n, Math.max(caliber * 3 / 1e3, 0.012), clamp2(E * 2e-5, 1e-3, 0.03), src);
@@ -28663,7 +28916,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28663
28916
  if (p.spec.contains && (p.st.liters ?? 0) > 1e-4) {
28664
28917
  o.active = true;
28665
28918
  emit2({
28666
- ...base(o, src),
28919
+ ...base2(o, src),
28667
28920
  type: "leak",
28668
28921
  part: id,
28669
28922
  fluid: p.spec.contains.fluid,
@@ -28683,8 +28936,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28683
28936
  debris2(o, p, mat.hitDebris, entry2, n, clamp2(Math.round(E / 60) + 2, 2, 14), clamp2(Math.sqrt(E) / 6, 1, 8), src);
28684
28937
  wearJoints(o, p, (penetrated ? thr : E) * 0.02 * weight, void 0, 0, src, true, BULLET_JOINT_SPAN);
28685
28938
  const hollowTear = mat.fracture === "tear" && p.spec.fill !== void 0 && p.spec.fill < 0.5;
28686
- const absorbed = penetrated && (mat.ductility >= 0.5 && mat.fracture !== "tear" || hollowTear) ? Math.min(E, thr) : E;
28939
+ const absorbed = penetrated && (mat.ductility >= 0.5 && mat.fracture !== "tear" || hollowTear || mat.cellular === true) ? Math.min(E, thr) : E;
28687
28940
  const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src, weight);
28941
+ if (shellShare > 0 && !isLost(p)) yieldShell(o, p, shellShare, entry2, d, src);
28688
28942
  if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
28689
28943
  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);
28690
28944
  return { penetrated, exitEnergy: penetrated ? penMm !== void 0 ? E * (1 - thr / Ep) : E - thr / (hard ? piercing : 1) : 0, exitPoint, damage: dmg };
@@ -28702,13 +28956,37 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28702
28956
  const hinge = plateHinge(p.dims, toLocal(c, q, point), local2);
28703
28957
  const toObject = (v) => rotateVec(p.q, v);
28704
28958
  p.st.bendHinge = { point: vec.add(p.pos, toObject(hinge.point)), axis: toObject(hinge.axis), side: toObject(hinge.side) };
28705
- emit2({ ...base(o), type: "bend", part: p.spec.id, hinge: p.st.bendHinge, angle: p.st.bend - before, worldPoint: point });
28959
+ emit2({ ...base2(o), type: "bend", part: p.spec.id, hinge: p.st.bendHinge, angle: p.st.bend - before, worldPoint: point });
28706
28960
  }
28707
28961
  const axis2 = severAxis(p);
28708
28962
  if (axis2 < 0 || snapRatio(p.dims, p.mat.bending, E, local2, SEVER_ASPECT) < 1) return 0;
28709
28963
  p.rt.cutAt = clamp2(toLocal(c, q, point)[axis2], -p.dims[axis2] / 2, p.dims[axis2] / 2);
28710
28964
  return Math.max(0, p.st.hp);
28711
28965
  };
28966
+ const wearsShell = (p, width) => {
28967
+ if (p.mat.ductility < 0.5 || p.thickness > THIN_SHEET_DISHING || p.spec.shape.kind !== "box") return 0;
28968
+ const [a = 0, b = 0, c = 0] = [...p.dims].sort((x, y) => x - y);
28969
+ if (c < 2 * b || b > 3 * a) return 0;
28970
+ p.rt.shellCut = (p.rt.shellCut ?? 0) + width;
28971
+ return Math.min(1, p.rt.shellCut / (2 * (a + b)));
28972
+ };
28973
+ const yieldShell = (o, p, share, entry2, d, src) => {
28974
+ if (share < SHELL_YIELD_SHARE) return;
28975
+ if (p.rt.hinges?.length) {
28976
+ reyield(o, p, tubeMoment(p, share), src);
28977
+ return;
28978
+ }
28979
+ const opened = (o.byPart.get(p.spec.id) ?? []).filter((j) => holdsAbove(o, p, j));
28980
+ if (opened.length === 0) return;
28981
+ for (const j of opened) {
28982
+ j.st.open = true;
28983
+ j.st.openedBy = "break";
28984
+ }
28985
+ const along2 = p.dims.indexOf(Math.max(...p.dims));
28986
+ hingeAcross(o, p, opened, { at: alongAt(along2, toLocal(p.pos, p.q, objLocal(o, entry2))[along2]), d, behind: memberSide(p) / 2, moment: tubeMoment(p, share) }, src);
28987
+ loosened(o, opened, "break", src);
28988
+ collapseCheck(o, src);
28989
+ };
28712
28990
  const melee = (o, p, kind, E, point, n, d, contactR, src) => {
28713
28991
  const mat = p.mat;
28714
28992
  const thrMm = mat.penetration * p.thickness * 1e3;
@@ -28799,7 +29077,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28799
29077
  frontQueue.push({ o, p, due: time + dist2 / blastFrontSpeed, amount, fragEnergy: Ein * 0.3, point, ...src !== void 0 ? { src } : {} });
28800
29078
  return reach2;
28801
29079
  }
28802
- if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, o.st.rotation === objectRotation && p.q === partQuat ? rotateVec(quat.conjugate(q), wn)[p.thin] >= 0 ? 1 : -1 : faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
29080
+ if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, o.st.rotation === objectRotation && p.q === partQuat ? faceOfNormal(p.layers, p.thin, rotateVec(quat.conjugate(q), wn)) : faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
28803
29081
  const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
28804
29082
  const caged2 = Boolean(p.spec.reinforcement && p.spec.units);
28805
29083
  const member = caged2 && (isMember(p.dims, p.spec.structure?.role) || dist2 > MEMBER_CUT_REACH * breachReach);
@@ -29158,7 +29436,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29158
29436
  for (let i = 0; i < 4 && E > 0; i++) {
29159
29437
  const reach2 = flight ? E > flight.minEnergy ? Math.log(E / flight.minEnergy) / (2 * flight.drag) : 0 : Infinity;
29160
29438
  if (!(reach2 > 0)) break;
29161
- const rh = raycastInternal(org, d, reach2, ignore, false, true);
29439
+ const crossed = [];
29440
+ const rh = raycastInternal(org, d, reach2, ignore, false, true, {}, void 0, true, crossed);
29441
+ for (const c of crossed) if (!rh || c.t < rh.distance) severBars(c.o, c.p, org, d, caliber, source);
29162
29442
  if (!rh) break;
29163
29443
  if (flight) E *= Math.exp(-2 * flight.drag * vec.distance(org, rh.point));
29164
29444
  const im = impls.get(rh.object);
@@ -29355,14 +29635,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29355
29635
  }
29356
29636
  return out;
29357
29637
  }
29358
- const mergeResults = (base2, extra) => {
29359
- const byObject = new Map(base2.map((r) => [r.object, r]));
29638
+ const mergeResults = (base22, extra) => {
29639
+ const byObject = new Map(base22.map((r) => [r.object, r]));
29360
29640
  for (const r of extra) {
29361
29641
  const have = byObject.get(r.object);
29362
29642
  if (!have) {
29363
29643
  const copy2 = { ...r, events: [...r.events] };
29364
29644
  byObject.set(r.object, copy2);
29365
- base2.push(copy2);
29645
+ base22.push(copy2);
29366
29646
  continue;
29367
29647
  }
29368
29648
  have.damage += r.damage;
@@ -29370,7 +29650,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29370
29650
  have.events.push(...r.events);
29371
29651
  if (!have.part && r.part) have.part = r.part;
29372
29652
  }
29373
- return base2;
29653
+ return base22;
29374
29654
  };
29375
29655
  function* blastSteps(point, energy, radius, src, call3, only, lethal) {
29376
29656
  const cfg = blastCfg(call3);
@@ -29622,7 +29902,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29622
29902
  p.st.temperature = Math.max(p.st.temperature, th.flameC ?? 800);
29623
29903
  o.active = true;
29624
29904
  markDamaged(p);
29625
- emit2({ ...base(o, src), type: "ignite", part: p.spec.id, point: partXf(o, p).c });
29905
+ emit2({ ...base2(o, src), type: "ignite", part: p.spec.id, point: partXf(o, p).c });
29626
29906
  };
29627
29907
  const syncMass = (p) => {
29628
29908
  p.st.mass = Math.max(0, p.mass0 * (1 - p.st.melt) - (p.fuel0 - p.st.fuel));
@@ -29648,11 +29928,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29648
29928
  p.st.status = "ashes";
29649
29929
  p.st.hp = 0;
29650
29930
  p.st.mass = p.mass0 * (1 - (th.fuelFraction ?? 0));
29651
- emit2({ ...base(o), type: "burnout", part: p.spec.id, point: c });
29931
+ emit2({ ...base2(o), type: "burnout", part: p.spec.id, point: c });
29652
29932
  debris2(o, p, "ash", c, [0, 1, 0], clamp2(Math.round(Math.cbrt(partVolume(p.spec.shape)) * 30), 3, 20), 1);
29653
29933
  partLost(o, p);
29654
29934
  } else {
29655
- emit2({ ...base(o), type: "burnout", part: p.spec.id, point: c });
29935
+ emit2({ ...base2(o), type: "burnout", part: p.spec.id, point: c });
29656
29936
  }
29657
29937
  }
29658
29938
  };
@@ -29669,11 +29949,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29669
29949
  p.rt.dripT -= 0.25;
29670
29950
  const b = partWorldAabb(o, p);
29671
29951
  const pt = [b.min[0] + (b.max[0] - b.min[0]) * (0.2 + 0.6 * rnd2()), b.min[1], b.min[2] + (b.max[2] - b.min[2]) * (0.2 + 0.6 * rnd2())];
29672
- emit2({ ...base(o), type: "drip", part: p.spec.id, point: pt, material: p.mat.id });
29952
+ emit2({ ...base2(o), type: "drip", part: p.spec.id, point: pt, material: p.mat.id });
29673
29953
  }
29674
29954
  if (p.st.melt - p.rt.meltEmitted >= 0.05 || p.st.melt >= 1) {
29675
29955
  p.rt.meltEmitted = p.st.melt;
29676
- emit2({ ...base(o), type: "melt", part: p.spec.id, melt: p.st.melt });
29956
+ emit2({ ...base2(o), type: "melt", part: p.spec.id, melt: p.st.melt });
29677
29957
  }
29678
29958
  if (p.st.melt >= 1) {
29679
29959
  p.st.status = "melted";
@@ -29746,7 +30026,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29746
30026
  }
29747
30027
  p.rt.jet = true;
29748
30028
  s.burning = true;
29749
- emit2({ ...base(o), type: "ignite", part: p.spec.id, point: partXf(o, p).c });
30029
+ emit2({ ...base2(o), type: "ignite", part: p.spec.id, point: partXf(o, p).c });
29750
30030
  }
29751
30031
  }
29752
30032
  }
@@ -29754,7 +30034,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29754
30034
  if (p.rt.jet && (s.liters ?? 0) <= 0) {
29755
30035
  p.rt.jet = false;
29756
30036
  s.burning = false;
29757
- emit2({ ...base(o), type: "extinguish", part: p.spec.id });
30037
+ emit2({ ...base2(o), type: "extinguish", part: p.spec.id });
29758
30038
  }
29759
30039
  const sc = th.thermalShockC;
29760
30040
  if (sc !== void 0) {
@@ -29788,7 +30068,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
29788
30068
  if (stress > 1) {
29789
30069
  if (p.rt.stressT <= 0) {
29790
30070
  p.rt.stressT = 0.5;
29791
- emit2({ ...base(o), type: "stress", part: p.spec.id, stress, load: p.st.load ?? 0 });
30071
+ emit2({ ...base2(o), type: "stress", part: p.spec.id, stress, load: p.st.load ?? 0 });
29792
30072
  if (p.spec.reinforcement && (p.st.stripped || p.st.chipped?.length || p.st.opening)) exposeRebar(o, p);
29793
30073
  }
29794
30074
  applyDamage(o, p, overloadRate(stress) * p.st.maxHp * dt, "blunt", null, null, 5, 3);
@@ -30102,6 +30382,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30102
30382
  setRayBroadPhase(broadPhase2) {
30103
30383
  rayBroad = broadPhase2;
30104
30384
  },
30385
+ setSurfaceTracer(tracer) {
30386
+ surfaceTracer = tracer;
30387
+ },
30105
30388
  groundLoss(loss) {
30106
30389
  if (!(loss.radius > 0) || !(loss.depth > 0) || !Number.isFinite(loss.x) || !Number.isFinite(loss.z)) return;
30107
30390
  pendingLosses.push({ ...loss });
@@ -30166,7 +30449,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30166
30449
  const step = Math.floor(j.st.progress * 10 + 1e-9);
30167
30450
  if (step > j.step || j.st.progress >= 1) {
30168
30451
  j.step = step;
30169
- emit2({ ...base(o), type: "disassemble_progress", joint: j.spec.id, tool: tool2, progress: j.st.progress });
30452
+ emit2({ ...base2(o), type: "disassemble_progress", joint: j.spec.id, tool: tool2, progress: j.st.progress });
30170
30453
  }
30171
30454
  if (j.st.progress >= 1) {
30172
30455
  j.st.open = true;
@@ -30252,7 +30535,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30252
30535
  if (p.st.burning) {
30253
30536
  p.st.burning = false;
30254
30537
  p.rt.jet = false;
30255
- emit2({ ...base(o), type: "extinguish", part: p.spec.id });
30538
+ emit2({ ...base2(o), type: "extinguish", part: p.spec.id });
30256
30539
  }
30257
30540
  p.st.temperature = Math.max(ambient, p.st.temperature - coolC);
30258
30541
  }
@@ -30284,7 +30567,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30284
30567
  if (p.st.holes.length > maxHoles) p.st.holes.shift();
30285
30568
  o.active = true;
30286
30569
  emit2({
30287
- ...base(o),
30570
+ ...base2(o),
30288
30571
  type: "leak",
30289
30572
  part: partId,
30290
30573
  fluid: c.fluid,
@@ -30494,7 +30777,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30494
30777
  var defaultSet;
30495
30778
  var defaultAssemblies = () => defaultSet ?? (defaultSet = assembliesOver(ASSEMBLIES));
30496
30779
  var getAssembly = (id) => defaultAssemblies().get(id);
30497
- var faceCount = (layer3) => layer3.faces === "both" ? 2 : 1;
30780
+ var faceCount = (layer3) => layer3.faces === "both" || layer3.faces === "all" ? 2 : 1;
30498
30781
  var assemblyDepth = (def) => def.depth ?? def.core.thickness + (def.layers ?? []).reduce((sum2, l) => sum2 + l.thickness * faceCount(l), 0);
30499
30782
  var buildAssemblyPart = (def, assemblyId, options) => {
30500
30783
  if (!def) throw new Error(`unknown assembly "${assemblyId}"`);
@@ -30668,8 +30951,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30668
30951
  const id = w.add(onRock(s));
30669
30952
  return new Map(w.state(id).parts.map((p) => [p.id, p.flexure ?? 0]));
30670
30953
  };
30671
- const base = bending(out);
30672
- const factor = new Map(targets.map((p) => [p.id, (base.get(p.id) ?? 0) / safetyOf(p.structure.role)]));
30954
+ const base2 = bending(out);
30955
+ const factor = new Map(targets.map((p) => [p.id, (base2.get(p.id) ?? 0) / safetyOf(p.structure.role)]));
30673
30956
  if (options.redundancy !== void 0) {
30674
30957
  const roles = options.redundancyRoles ?? ["column"];
30675
30958
  for (const lost of out.parts) {
@@ -30713,11 +30996,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30713
30996
  return new Map(w.state(id).parts.map((p) => [p.id, { load: p.load ?? 0, stress: p.stress ?? 0, wind: p.wind ?? 0 }]));
30714
30997
  };
30715
30998
  const out = structuredClone(spec);
30716
- const base = loads(out, options.wind);
30999
+ const base2 = loads(out, options.wind);
30717
31000
  const gamma = options.wind ? resolveWind(options.wind).loadFactor : 0;
30718
31001
  const structural = out.parts.filter((p) => p.structure && p.structure.role !== "none");
30719
31002
  const loadAt = (p) => {
30720
- const b = base.get(p.id);
31003
+ const b = base2.get(p.id);
30721
31004
  return b && b.stress > 0 ? b.load + (b.wind > 0 ? gamma * b.wind / GRAVITY : 0) : void 0;
30722
31005
  };
30723
31006
  const lossesOf = function* () {
@@ -30746,7 +31029,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
30746
31029
  if (options.wind) {
30747
31030
  const yieldMPa = resolveFlexure(options.flexure).rebarYieldMPa;
30748
31031
  for (const p of out.parts) {
30749
- const b = base.get(p.id);
31032
+ const b = base2.get(p.id);
30750
31033
  if (!b || b.wind >= 0 || !p.reinforcement || p.shape.kind !== "box") continue;
30751
31034
  const pull = -(b.load + gamma * b.wind / GRAVITY) * GRAVITY;
30752
31035
  if (pull <= 0) continue;
@@ -31799,8 +32082,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31799
32082
  return { parts: context.parts, supports: context.supports };
31800
32083
  }
31801
32084
  function anchorBalconies(context) {
31802
- const base = context.panelsOf.get("slab_base");
31803
- if (!base) return;
32085
+ const base2 = context.panelsOf.get("slab_base");
32086
+ if (!base2) return;
31804
32087
  const decks = context.parts.filter((p) => p.role === "slab" && /^slab_\d+_/.test(p.id) && context.supports.some((s) => s.part === p.id && /^balcony_column_/.test(s.on)));
31805
32088
  for (const deck of decks) {
31806
32089
  const pillars = new Set(context.supports.filter((s) => s.part === deck.id && /^balcony_column_/.test(s.on)).map((s) => s.on));
@@ -31819,7 +32102,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31819
32102
  if (!splits.size) return input;
31820
32103
  const boxes = new Map(input.parts.map((part) => [part.id, part.aabb]));
31821
32104
  const pieceBox = /* @__PURE__ */ new Map();
31822
- for (const split of splits.values()) for (const piece2 of split.pieces) pieceBox.set(piece2.id, piece2.aabb);
32105
+ for (const split of splits.values()) for (const piece3 of split.pieces) pieceBox.set(piece3.id, piece3.aabb);
31823
32106
  const parts2 = input.parts.flatMap((part) => splits.get(part.id)?.pieces ?? [part]);
31824
32107
  const supports = [];
31825
32108
  for (const support of input.supports) {
@@ -31961,9 +32244,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
31961
32244
  const spandrel = spandrels[k];
31962
32245
  if (spandrel) internal.push({ part: spandrel.id, on: lintel.id, joint: style.wallJoint });
31963
32246
  });
31964
- const base = [...piers, ...drafts.filter((d) => d.id.includes("_sill_"))].map((d) => d.id);
32247
+ const base2 = [...piers, ...drafts.filter((d) => d.id.includes("_sill_"))].map((d) => d.id);
31965
32248
  const top = [...piers.map((p) => p.id), ...lintels.map((l, k) => spandrels[k]?.id ?? l.id)];
31966
- return { pieces, internal, base, top };
32249
+ return { pieces, internal, base: base2, top };
31967
32250
  }
31968
32251
  var LOG_DIAMETER = 0.26;
31969
32252
  var isWall = (part) => part.id.startsWith("wall_") && part.assembly !== void 0 && (part.role === "wall" || part.role === "partition");
@@ -32025,7 +32308,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32025
32308
  if (capacity === void 0) continue;
32026
32309
  const along2 = (box22) => Math.max(box22[2] - box22[0], box22[3] - box22[1]);
32027
32310
  const length2 = along2(input.parts.find((part) => part.id === id).aabb);
32028
- for (const piece2 of split.pieces) capacities.set(piece2.id, Math.max(1, capacity * along2(piece2.aabb) / length2));
32311
+ for (const piece3 of split.pieces) capacities.set(piece3.id, Math.max(1, capacity * along2(piece3.aabb) / length2));
32029
32312
  }
32030
32313
  return { ...next, capacities };
32031
32314
  }
@@ -32249,10 +32532,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32249
32532
  const joints = [...spec.joints ?? []];
32250
32533
  const reinforcement = { material: "steel", spacing: c.rebar.spacing, diameter: c.rebar.diameter };
32251
32534
  const raft2 = parts2.find((p) => p.id === "raft");
32252
- let base = raft2?.id;
32253
- if (!base) {
32254
- base = "core_mat";
32255
- parts2.push({ id: base, material: c.material, shape: box2([W + 1, c.matThickness, L + 1]), position: [cx, -c.matThickness / 2, cz], structure: { role: "foundation" }, anchored: true });
32535
+ let base2 = raft2?.id;
32536
+ if (!base2) {
32537
+ base2 = "core_mat";
32538
+ parts2.push({ id: base2, material: c.material, shape: box2([W + 1, c.matThickness, L + 1]), position: [cx, -c.matThickness / 2, cz], structure: { role: "foundation" }, anchored: true });
32256
32539
  }
32257
32540
  const innerX = x0 + t + c.stairWidth + ti / 2;
32258
32541
  for (let f = 0; f < g.floors; f++) {
@@ -32260,7 +32543,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32260
32543
  const wall = (name, size, pos) => {
32261
32544
  const id = `core_${f}_${name}`;
32262
32545
  parts2.push({ id, material: c.material, shape: box2(size), position: [pos[0], yb + H / 2, pos[1]], structure: { role: "wall" }, reinforcement, tags: ["core"] });
32263
- rests(joints, id, f === 0 ? base : `core_${f - 1}_${name}`, "rebar");
32546
+ rests(joints, id, f === 0 ? base2 : `core_${f - 1}_${name}`, "rebar");
32264
32547
  return id;
32265
32548
  };
32266
32549
  const tube2 = [
@@ -32313,7 +32596,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32313
32596
  mass: 1500,
32314
32597
  tags: ["elevator_car"]
32315
32598
  });
32316
- rests(joints, id, base, "resting", false);
32599
+ rests(joints, id, base2, "resting", false);
32317
32600
  }
32318
32601
  return { ...spec, parts: parts2, joints };
32319
32602
  }
@@ -32994,12 +33277,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
32994
33277
  var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES2) => {
32995
33278
  const def = findEffect(item, effects);
32996
33279
  if (!def) return void 0;
32997
- const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
32998
- if (def.effect !== "consume_nutrition") return base;
33280
+ const base2 = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
33281
+ if (def.effect !== "consume_nutrition") return base2;
32999
33282
  const nutrition = nutritionOf(item, context, rules);
33000
33283
  const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
33001
- if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
33002
- return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
33284
+ if (blocked) return { ...base2, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
33285
+ return { ...base2, consumes: def.consumes && nutrition.isEdible, nutrition };
33003
33286
  };
33004
33287
  var MM = 1e-3;
33005
33288
  var BOX_WALL = 6 * MM;
@@ -52302,9 +52585,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52302
52585
  var goodsItemUse = createGoodsItemUse();
52303
52586
 
52304
52587
  // ../game-interactables-household/dist/index.js
52305
- var door = (material, joint2 = "hinge", piece2 = "door") => ({ material, joint: joint2, piece: piece2 });
52588
+ var door = (material, joint2 = "hinge", piece22 = "door") => ({ material, joint: joint2, piece: piece22 });
52306
52589
  var drawer = { material: "mdf", joint: "slide", piece: "drawer" };
52307
52590
  var knob = { material: "plastic", joint: "clip", piece: "knob" };
52591
+ var mainLever = { material: "plastic", joint: "clip", piece: "breaker" };
52308
52592
  var tap = { material: "steel", joint: "screw", piece: "handle" };
52309
52593
  var mdfBody = { material: "mdf", joint: "screw" };
52310
52594
  var cabinet = { body: mdfBody, parts: [[/^drawer/, drawer], [/^door/, door("mdf")]] };
@@ -52339,19 +52623,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52339
52623
  wall_socket: { body: { material: "plastic", joint: "screw" }, parts: [] },
52340
52624
  wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
52341
52625
  // a cast concrete pole (NBR 8451: CA-50 bars in the concrete), its segments held by the bars; the meter box, the cross arm and the bracket are bolted to it
52342
- service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")]] },
52626
+ service_entrance: { body: { material: "concrete", joint: "rebar", reinforcement: POLE_CAGE }, parts: [["meter_door", door("steel")], ["main_breaker", mainLever]] },
52343
52627
  conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
52344
- service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
52628
+ // one galvanised pipe bent over the top: its stretches are the same steel (welded, not clipped: the clamps hold it to the wall, not to itself)
52629
+ service_mast: { body: { material: "steel", joint: "weld" }, parts: [] },
52345
52630
  electrical_panel: {
52346
52631
  body: { material: "steel", joint: "screw" },
52347
52632
  parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
52348
52633
  },
52349
- power_meter: { body: { material: "plastic", joint: "screw" }, parts: [["door", door("plastic")]] },
52634
+ power_meter: { body: { material: "plastic", joint: "screw" }, parts: [["door", door("plastic")], ["main_breaker", mainLever]] },
52350
52635
  tv: { body: { material: "plastic", joint: "screw" }, parts: [["power", { material: "plastic", joint: "clip", piece: "button" }]] },
52351
52636
  microwave: { body: { material: "steel", joint: "screw" }, parts: [["door", door("steel")], ["dial", knob]] },
52352
52637
  washing_machine: { body: { material: "steel", joint: "screw" }, parts: [["dial", knob], ["door", door("tempered_glass")]] },
52353
52638
  sofa: { body: upholstery, parts: [] },
52354
52639
  armchair: { body: upholstery, parts: [] },
52640
+ pouf: { body: upholstery, parts: [] },
52641
+ box_bed: { body: upholstery, parts: [] },
52642
+ upholstered_chair: { body: upholstery, parts: [] },
52355
52643
  dining_chair: { body: { material: "wood_hard", joint: "screw" }, parts: [] },
52356
52644
  bed_double: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
52357
52645
  bed_single: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
@@ -52423,9 +52711,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52423
52711
  "type.washing_machine": "Washing machine",
52424
52712
  "type.sofa": "Sofa",
52425
52713
  "type.armchair": "Armchair",
52714
+ "type.pouf": "Pouf",
52426
52715
  "type.dining_chair": "Dining chair",
52716
+ "type.upholstered_chair": "Upholstered chair",
52427
52717
  "type.bed_double": "Double bed",
52428
52718
  "type.bed_single": "Single bed",
52719
+ "type.box_bed": "Box bed",
52429
52720
  "type.bench": "Bench",
52430
52721
  "type.blinds": "Blinds",
52431
52722
  "type.curtain": "Curtain",
@@ -52578,6 +52869,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52578
52869
  "prompt.breaker.off": "Switch on {circuit}",
52579
52870
  "prompt.breaker.off.verb": "Switch on",
52580
52871
  "prompt.breaker.off.object": "{circuit}",
52872
+ "prompt.main_breaker": "Main breaker",
52873
+ "prompt.main_breaker.on": "Switch off the main breaker",
52874
+ "prompt.main_breaker.on.verb": "Switch off",
52875
+ "prompt.main_breaker.on.object": "the main breaker",
52876
+ "prompt.main_breaker.off": "Switch on the main breaker",
52877
+ "prompt.main_breaker.off.verb": "Switch on",
52878
+ "prompt.main_breaker.off.object": "the main breaker",
52581
52879
  "type.bunk_bed": "Bunk bed",
52582
52880
  "type.wood_stove": "Wood stove",
52583
52881
  "type.fireplace": "Fireplace",
@@ -52671,9 +52969,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52671
52969
  "type.washing_machine": "M\xE1quina de lavar",
52672
52970
  "type.sofa": "Sof\xE1",
52673
52971
  "type.armchair": "Poltrona",
52972
+ "type.pouf": "Pufe",
52674
52973
  "type.dining_chair": "Cadeira",
52974
+ "type.upholstered_chair": "Cadeira estofada",
52675
52975
  "type.bed_double": "Cama de casal",
52676
52976
  "type.bed_single": "Cama de solteiro",
52977
+ "type.box_bed": "Cama box",
52677
52978
  "type.bench": "Banco",
52678
52979
  "type.blinds": "Persiana",
52679
52980
  "type.curtain": "Cortina",
@@ -52826,6 +53127,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52826
53127
  "prompt.breaker.off": "Ligar {circuit}",
52827
53128
  "prompt.breaker.off.verb": "Ligar",
52828
53129
  "prompt.breaker.off.object": "{circuit}",
53130
+ "prompt.main_breaker": "Disjuntor geral",
53131
+ "prompt.main_breaker.on": "Desligar o disjuntor geral",
53132
+ "prompt.main_breaker.on.verb": "Desligar",
53133
+ "prompt.main_breaker.on.object": "o disjuntor geral",
53134
+ "prompt.main_breaker.off": "Ligar o disjuntor geral",
53135
+ "prompt.main_breaker.off.verb": "Ligar",
53136
+ "prompt.main_breaker.off.object": "o disjuntor geral",
52829
53137
  "type.bunk_bed": "Beliche",
52830
53138
  "type.wood_stove": "Fog\xE3o a lenha",
52831
53139
  "type.fireplace": "Lareira",
@@ -53276,6 +53584,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53276
53584
  pushable: true,
53277
53585
  massKg: 25
53278
53586
  },
53587
+ {
53588
+ id: "pouf",
53589
+ group: "seating",
53590
+ w: 0.45,
53591
+ d: 0.45,
53592
+ h: 0.42,
53593
+ y: 0,
53594
+ solid: true,
53595
+ pushable: true,
53596
+ massKg: 4
53597
+ },
53279
53598
  {
53280
53599
  id: "dining_chair",
53281
53600
  group: "seating",
@@ -53286,6 +53605,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53286
53605
  solid: true,
53287
53606
  massKg: 5
53288
53607
  },
53608
+ {
53609
+ id: "upholstered_chair",
53610
+ group: "seating",
53611
+ w: 0.46,
53612
+ d: 0.52,
53613
+ h: 0.92,
53614
+ y: 0,
53615
+ solid: true,
53616
+ massKg: 6
53617
+ },
53289
53618
  {
53290
53619
  id: "bed_double",
53291
53620
  group: "seating",
@@ -53308,6 +53637,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53308
53637
  pushable: true,
53309
53638
  massKg: 30
53310
53639
  },
53640
+ {
53641
+ id: "box_bed",
53642
+ group: "seating",
53643
+ w: 1.38,
53644
+ d: 1.88,
53645
+ h: 0.72,
53646
+ y: 0,
53647
+ solid: true,
53648
+ pushable: true,
53649
+ massKg: 75
53650
+ },
53311
53651
  {
53312
53652
  id: "bench",
53313
53653
  group: "seating",
@@ -53554,8 +53894,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53554
53894
  "warn.buildEmpty": "construir devolveu vazio para {id}"
53555
53895
  };
53556
53896
  function createTranslator(locale, table) {
53557
- const base = locale && /^pt/i.test(locale) ? ptBR : en;
53558
- const messages = { ...base, ...table ?? {} };
53897
+ const base2 = locale && /^pt/i.test(locale) ? ptBR : en;
53898
+ const messages = { ...base2, ...table ?? {} };
53559
53899
  return (key2, params) => (messages[key2] ?? key2).replace(/\{(\w+)\}/g, (_m, name) => params && params[name] !== void 0 ? String(params[name]) : `{${name}}`);
53560
53900
  }
53561
53901
  var TYPE_MAP = Object.freeze({
@@ -54048,8 +54388,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
54048
54388
  var r3 = (n) => Math.round(n * 1e3) / 1e3;
54049
54389
  var CYLINDER_VALVE_Y = 0.47;
54050
54390
  var at = (it) => ({ x: it.x ?? 0, z: it.z ?? 0, ry: it.ry ?? 0 });
54051
- function mergeRegistry(base, extra) {
54052
- const out = { ...base };
54391
+ function mergeRegistry(base2, extra) {
54392
+ const out = { ...base2 };
54053
54393
  if (extra) {
54054
54394
  for (const [key2, value] of Object.entries(extra)) {
54055
54395
  if (value == null) delete out[key2];
@@ -55740,7 +56080,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55740
56080
  rooms: (w, d, op) => {
55741
56081
  const hu0 = r22(w * 0.3), hu1 = r22(w * 0.7), n = floorCount(op, 3), el = !!op.elevator && n > 1;
55742
56082
  const ex = hu0 + (el ? 4.2 : 2.4);
55743
- const base = [
56083
+ const base2 = [
55744
56084
  { id: "sitting_room", type: "living", label: "sitting_room", rect: [0, 0, hu0, 7] },
55745
56085
  { id: "kitchen", type: "kitchen", label: "kitchen", rect: [0, 7, hu0, d - 3.2] },
55746
56086
  { id: "laundry", type: "laundry", label: "laundry", rect: [0, d - 3.2, hu0, d] },
@@ -55751,10 +56091,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
55751
56091
  { id: "bedroom", type: "bedroom", label: "suite", rect: [hu1, 8.2, w, d - 3.3], overrides: { bed: { size: [2.2, 2.35], cats: { bed: 2, bed_king: 3 } }, wardrobe: { cats: { wardrobe: 2, wardrobe_large: 3 }, size: [2.5, 0.75] } } },
55752
56092
  { id: "bathroom", type: "bathroom", label: "bathroom_suite", library: "bathroom_wc", rect: [hu1, d - 3.3, w, d] }
55753
56093
  ];
55754
- if (n > 1) base.push({ id: "stairs", type: "stairs", label: "stairs", rect: [hu0, d - 5, hu0 + 2.4, d], link: [0, 1] });
55755
- if (el) base.push({ id: "elevator", type: "elevator", label: "elevator", rect: [hu0 + 2.4, d - 5, hu0 + 4.2, d] });
55756
- base.push({ id: "office", type: "office", label: "office", rect: [n > 1 ? ex : hu0, d - 5, hu1, d] });
55757
- return base;
56094
+ if (n > 1) base2.push({ id: "stairs", type: "stairs", label: "stairs", rect: [hu0, d - 5, hu0 + 2.4, d], link: [0, 1] });
56095
+ if (el) base2.push({ id: "elevator", type: "elevator", label: "elevator", rect: [hu0 + 2.4, d - 5, hu0 + 4.2, d] });
56096
+ base2.push({ id: "office", type: "office", label: "office", rect: [n > 1 ? ex : hu0, d - 5, hu1, d] });
56097
+ return base2;
55758
56098
  },
55759
56099
  doors: (w, d, op) => {
55760
56100
  const hu0 = r22(w * 0.3), hu1 = r22(w * 0.7), n = floorCount(op, 3), el = !!op.elevator && n > 1;
@@ -56128,7 +56468,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56128
56468
  }
56129
56469
  var residentialTower = residentialTowerTemplate();
56130
56470
 
56131
- // ../game-floorplan-three/dist/chunk-OGYLJ4F7.js
56471
+ // ../game-floorplan-three/dist/chunk-XI3CKQAV.js
56132
56472
  var __defProp4 = Object.defineProperty;
56133
56473
  var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
56134
56474
  var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
@@ -56141,6 +56481,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56141
56481
  "what.door": "the door",
56142
56482
  "what.curtain": "the curtain",
56143
56483
  "what.mailbox": "the mailbox",
56484
+ "what.stallDoor": "the shower door",
56144
56485
  "what.pedestrianGate": "the small gate",
56145
56486
  "what.garageGate": "the garage gate",
56146
56487
  "what.drawer": "drawer",
@@ -56166,6 +56507,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56166
56507
  "what.door": "a porta",
56167
56508
  "what.curtain": "a cortina",
56168
56509
  "what.mailbox": "a caixa de correio",
56510
+ "what.stallDoor": "a porta do box",
56169
56511
  "what.pedestrianGate": "o port\xE3ozinho",
56170
56512
  "what.garageGate": "o port\xE3o da garagem",
56171
56513
  "what.drawer": "gaveta",
@@ -56201,15 +56543,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56201
56543
  for (let axis2 = 0; axis2 < 3; axis2++) {
56202
56544
  const lo = axis2, hi = axis2 + 3;
56203
56545
  if (b[lo] > box5[lo] + EPS6) {
56204
- const piece2 = [...box5];
56205
- piece2[hi] = b[lo];
56206
- out.push(piece2);
56546
+ const piece22 = [...box5];
56547
+ piece22[hi] = b[lo];
56548
+ out.push(piece22);
56207
56549
  box5[lo] = b[lo];
56208
56550
  }
56209
56551
  if (b[hi] < box5[hi] - EPS6) {
56210
- const piece2 = [...box5];
56211
- piece2[lo] = b[hi];
56212
- out.push(piece2);
56552
+ const piece22 = [...box5];
56553
+ piece22[lo] = b[hi];
56554
+ out.push(piece22);
56213
56555
  box5[hi] = b[hi];
56214
56556
  }
56215
56557
  }
@@ -56219,14 +56561,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56219
56561
  const laid = [];
56220
56562
  for (const solid2 of solids2) {
56221
56563
  let pieces = [solid2.box];
56222
- for (const before of laid) pieces = pieces.flatMap((piece2) => subtractBox(piece2, before.box));
56564
+ for (const before of laid) pieces = pieces.flatMap((piece22) => subtractBox(piece22, before.box));
56223
56565
  for (const box5 of pieces) laid.push({ ...solid2, box: box5 });
56224
56566
  }
56225
56567
  return laid;
56226
56568
  }
56227
56569
  function outsideBoxes(box5, taken) {
56228
56570
  let pieces = [box5];
56229
- for (const t of taken) pieces = pieces.flatMap((piece2) => subtractBox(piece2, t));
56571
+ for (const t of taken) pieces = pieces.flatMap((piece22) => subtractBox(piece22, t));
56230
56572
  return pieces;
56231
56573
  }
56232
56574
  function installKernelGeometry(K, shared3) {
@@ -56554,7 +56896,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56554
56896
  nz = -nz;
56555
56897
  [a, b] = [pts[0], pts[1]];
56556
56898
  }
56557
- const [cr, cg, cb] = rgbOf(color2), scale = UV_SCALE[mat] || 1, base = A.nv;
56899
+ const [cr, cg, cb] = rgbOf(color2), scale = UV_SCALE[mat] || 1, base2 = A.nv;
56558
56900
  let e1x = b[0] - a[0], e1y = b[1] - a[1], e1z = b[2] - a[2];
56559
56901
  const l1 = Math.hypot(e1x, e1y, e1z) || 1;
56560
56902
  e1x /= l1;
@@ -56562,7 +56904,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56562
56904
  e1z /= l1;
56563
56905
  const e2x = ny * e1z - nz * e1y, e2y = nz * e1x - nx * e1z, e2z = nx * e1y - ny * e1x;
56564
56906
  pts.forEach((p, k) => {
56565
- const o = base + k;
56907
+ const o = base2 + k;
56566
56908
  A.p[o * 3] = p[0] - O[0];
56567
56909
  A.p[o * 3 + 1] = p[1] - O[1];
56568
56910
  A.p[o * 3 + 2] = p[2] - O[2];
@@ -56577,9 +56919,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56577
56919
  A.u[o * 2 + 1] = (dx * e2x + dy * e2y + dz * e2z) / scale;
56578
56920
  });
56579
56921
  for (let k = 1; k < n - 1; k++) {
56580
- A.i[A.ni++] = base;
56581
- A.i[A.ni++] = base + k;
56582
- A.i[A.ni++] = base + k + 1;
56922
+ A.i[A.ni++] = base2;
56923
+ A.i[A.ni++] = base2 + k;
56924
+ A.i[A.ni++] = base2 + k + 1;
56583
56925
  }
56584
56926
  A.nv += n;
56585
56927
  }
@@ -57938,8 +58280,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
57938
58280
  const puts = (f, type, m0, extra) => {
57939
58281
  const ent = T2[type];
57940
58282
  if (!ent) return;
57941
- const com = shared3.ctx.roomById[m0.room], g = "f" + f, base = Y0(f);
57942
- 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 || {});
58283
+ const com = shared3.ctx.roomById[m0.room], g = "f" + f, base2 = Y0(f);
58284
+ 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: base2, 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 || {});
57943
58285
  cursor.group = g;
57944
58286
  lightItem({ id: m0.id, room: m0.room }, M, ent, api, g);
57945
58287
  };
@@ -58760,7 +59102,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
58760
59102
  }
58761
59103
  const AC = accFor(mat), m = L.length, [cr, cg, cb] = rgbOf(color2), O = cursor.org;
58762
59104
  AC.ensure(m * 2, (m - 1) * 6);
58763
- const base = AC.nv, w2 = 2 * Math.PI / P;
59105
+ const base2 = AC.nv, w2 = 2 * Math.PI / P;
58764
59106
  const profile = (sv) => {
58765
59107
  const ph = sv * w2, hh = A + A * Math.sin(ph), dh = A * w2 * Math.cos(ph), ql = Math.hypot(dh, 1);
58766
59108
  const per = Math.floor(sv / P), rr = _h2(per * 7 + 3, 11), fil = colonial ? 0.9 + 0.2 * (0.5 + 0.5 * Math.sin(ph + 1.5708)) : 0.95 + 0.1 * (0.5 + 0.5 * Math.sin(ph + 1.5708)), v = 1.5 * fil * (0.94 + 0.1 * rr);
@@ -58776,7 +59118,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
58776
59118
  const sv = L[j], [hh, qx, qy, qz, v] = at4(sv);
58777
59119
  const cj = col[j] || col[j - 1] || col[j + 1] || [0, 0];
58778
59120
  for (let k = 0; k < 2; k++) {
58779
- const t = cj[k], oo = base + j * 2 + k, px = o[0] + sv * ex + t * dx + nx * hh, py = o[1] + sv * ey + t * dy + ny * hh, pz = o[2] + sv * ez + t * dz + nz * hh;
59121
+ const t = cj[k], oo = base2 + j * 2 + k, px = o[0] + sv * ex + t * dx + nx * hh, py = o[1] + sv * ey + t * dy + ny * hh, pz = o[2] + sv * ez + t * dz + nz * hh;
58780
59122
  AC.p[oo * 3] = px - O[0];
58781
59123
  AC.p[oo * 3 + 1] = py - O[1];
58782
59124
  AC.p[oo * 3 + 2] = pz - O[2];
@@ -58792,7 +59134,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
58792
59134
  }
58793
59135
  for (let j = 0; j + 1 < m; j++) {
58794
59136
  if (!col[j] && !col[j + 1]) continue;
58795
- const a0 = base + j * 2, a1 = a0 + 1, b0 = a0 + 2, b1 = a0 + 3;
59137
+ const a0 = base2 + j * 2, a1 = a0 + 1, b0 = a0 + 2, b1 = a0 + 3;
58796
59138
  AC.i[AC.ni++] = a0;
58797
59139
  AC.i[AC.ni++] = b0;
58798
59140
  AC.i[AC.ni++] = a1;
@@ -59492,12 +59834,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59492
59834
  if (x1 - x0 < 1e-4 || y1 - y0 < 1e-4 || z1 - z0 < 1e-4) return;
59493
59835
  for (const [normal, corners] of FACES2) {
59494
59836
  if (openBottom && normal[1] < 0) continue;
59495
- const base = this.positions.length / 3;
59837
+ const base2 = this.positions.length / 3;
59496
59838
  for (const [cx, cy, cz] of corners) {
59497
59839
  this.positions.push(cx ? x1 : x0, cy ? y1 : y0, cz ? z1 : z0);
59498
59840
  this.normals.push(normal[0], normal[1], normal[2]);
59499
59841
  }
59500
- this.indices.push(base, base + 1, base + 2, base, base + 2, base + 3);
59842
+ this.indices.push(base2, base2 + 1, base2 + 2, base2, base2 + 2, base2 + 3);
59501
59843
  }
59502
59844
  }
59503
59845
  /**
@@ -59518,12 +59860,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59518
59860
  const out = [0, 1, 2].reduce((sum2, k) => sum2 + n[k] * ((a[k] + b[k] + c[k] + d[k]) / 4 - centre[k]), 0);
59519
59861
  const ring3 = out >= 0 ? [a, b, c, d] : [a, d, c, b];
59520
59862
  if (out < 0) n = n.map((x) => -x);
59521
- const base = this.positions.length / 3;
59863
+ const base2 = this.positions.length / 3;
59522
59864
  for (const p of ring3) {
59523
59865
  this.positions.push(p[0], p[1], p[2]);
59524
59866
  this.normals.push(n[0], n[1], n[2]);
59525
59867
  }
59526
- this.indices.push(base, base + 1, base + 2, base, base + 2, base + 3);
59868
+ this.indices.push(base2, base2 + 1, base2 + 2, base2, base2 + 2, base2 + 3);
59527
59869
  }
59528
59870
  }
59529
59871
  /** A flat four-cornered face that looks along `normal` (it is wound so). */
@@ -59533,12 +59875,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59533
59875
  const e1 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]], e2 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
59534
59876
  const facing = (e1[1] * e2[2] - e1[2] * e2[1]) * normal[0] + (e1[2] * e2[0] - e1[0] * e2[2]) * normal[1] + (e1[0] * e2[1] - e1[1] * e2[0]) * normal[2];
59535
59877
  const ring3 = facing >= 0 ? corners : [corners[0], corners[3], corners[2], corners[1]];
59536
- const base = this.positions.length / 3;
59878
+ const base2 = this.positions.length / 3;
59537
59879
  for (const p of ring3) {
59538
59880
  this.positions.push(p[0], p[1], p[2]);
59539
59881
  this.normals.push(normal[0], normal[1], normal[2]);
59540
59882
  }
59541
- this.indices.push(base, base + 1, base + 2, base, base + 2, base + 3);
59883
+ this.indices.push(base2, base2 + 1, base2 + 2, base2, base2 + 2, base2 + 3);
59542
59884
  }
59543
59885
  /** The mesh of everything added, or null when nothing was. */
59544
59886
  mesh(THREE, material, name) {
@@ -59708,8 +60050,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59708
60050
  var DOOR_HEAD = 2.1;
59709
60051
  function crossesOpening(plan, a, b, y) {
59710
60052
  return plan.openings.some((o) => {
59711
- const base = plan.floors[o.floor]?.y0 ?? 0;
59712
- if (y <= base + (o.y0 ?? 0) || y >= base + (o.y1 ?? DOOR_HEAD)) return false;
60053
+ const base2 = plan.floors[o.floor]?.y0 ?? 0;
60054
+ if (y <= base2 + (o.y0 ?? 0) || y >= base2 + (o.y1 ?? DOOR_HEAD)) return false;
59713
60055
  const [p0, p1, q0, q1] = o.axis === "u" ? [a[1], b[1], a[0], b[0]] : [a[0], b[0], a[1], b[1]];
59714
60056
  const across2 = Math.min(p0, p1) <= o.pos + 0.1 && Math.max(p0, p1) >= o.pos - 0.1;
59715
60057
  return across2 && Math.max(Math.min(q0, q1), o.at - o.width / 2) < Math.min(Math.max(q0, q1), o.at + o.width / 2);
@@ -59929,10 +60271,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
59929
60271
  const w = TRENCH.berm.width;
59930
60272
  const heapAt = ox ? [ox > 0 ? x1 + SPOIL_CLEAR : x0 - SPOIL_CLEAR - w, z0, ox > 0 ? x1 + SPOIL_CLEAR + w : x0 - SPOIL_CLEAR, z1] : [x0, oz > 0 ? z1 + SPOIL_CLEAR : z0 - SPOIL_CLEAR - w, x1, oz > 0 ? z1 + SPOIL_CLEAR + w : z0 - SPOIL_CLEAR];
59931
60273
  const onBuilding = [site.footprint, ...site.buildings].some(([bx0, bz0, bx1, bz1]) => heapAt[2] > bx0 - 0.4 && heapAt[0] < bx1 + 0.4 && heapAt[3] > bz0 - 0.4 && heapAt[1] < bz1 + 0.4);
59932
- if (!onBuilding) for (const piece2 of rectMinus(heapAt, [...rects.map((t) => [t[0] - SPOIL_CLEAR, t[1] - SPOIL_CLEAR, t[2] + SPOIL_CLEAR, t[3] + SPOIL_CLEAR]), ...laid])) {
59933
- if (Math.min(piece2[2] - piece2[0], piece2[3] - piece2[1]) < TRENCH.berm.crest * 2) continue;
59934
- addHumps(heap, piece2);
59935
- laid.push(piece2);
60274
+ if (!onBuilding) for (const piece22 of rectMinus(heapAt, [...rects.map((t) => [t[0] - SPOIL_CLEAR, t[1] - SPOIL_CLEAR, t[2] + SPOIL_CLEAR, t[3] + SPOIL_CLEAR]), ...laid])) {
60275
+ if (Math.min(piece22[2] - piece22[0], piece22[3] - piece22[1]) < TRENCH.berm.crest * 2) continue;
60276
+ addHumps(heap, piece22);
60277
+ laid.push(piece22);
59936
60278
  }
59937
60279
  }
59938
60280
  });
@@ -60077,7 +60419,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60077
60419
  function buriedSewerOf(plan) {
60078
60420
  const drains = drainsOf(plan);
60079
60421
  if (!drains.length) return [];
60080
- return sewerLayout(plan, drains).pieces.flatMap((piece2) => piece2.points.slice(1).map((b, i) => ({ a: piece2.points[i], b })));
60422
+ return sewerLayout(plan, drains).pieces.flatMap((piece22) => piece22.points.slice(1).map((b, i) => ({ a: piece22.points[i], b })));
60081
60423
  }
60082
60424
  var FEED = { width: 0.3, bed: 0.05, tape: { over: 0.3, width: 0.1, thickness: 2e-3 }, box: { side: 0.3, floor: 0.1 } };
60083
60425
  function feedLayout(plan) {
@@ -60137,10 +60479,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60137
60479
  const dug = [...layout.trenches, ...rainwater.trenches, ...feeds.trenches, ...boxes.map(pitOf)];
60138
60480
  addSpoil(THREE, group, dug, mats.heap, { solids: solids2, footprint: houseFootprint(routingPlanOf(plan)), buildings: (plan.outbuildings ?? []).map((o) => o.aabb) });
60139
60481
  group.userData.excavations = dug.map(excavationOf);
60140
- for (const piece2 of layout.pieces) addPipe(THREE, group, piece2.points, piece2.bore / 2, mats.pipe);
60482
+ for (const piece22 of layout.pieces) addPipe(THREE, group, piece22.points, piece22.bore / 2, mats.pipe);
60141
60483
  const rainGroup = new THREE.Group();
60142
60484
  rainGroup.name = "rain_drains";
60143
- for (const piece2 of rainwater.pieces) addPipe(THREE, rainGroup, piece2.points, piece2.bore / 2, mats.rain);
60485
+ for (const piece22 of rainwater.pieces) addPipe(THREE, rainGroup, piece22.points, piece22.bore / 2, mats.rain);
60144
60486
  group.add(rainGroup);
60145
60487
  addWarningTape(THREE, group, feeds.runs);
60146
60488
  const yard = new THREE.Group();
@@ -60433,11 +60775,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60433
60775
  });
60434
60776
  }
60435
60777
  function stagedWallRuns(H) {
60436
- const r = shared3.ctx.r, nA = r.floors.length, plan = routingPlanOf(r), tank2 = r.waterTank, base = shared3.ctx.waterTankPos ? shared3.ctx.waterTankPos.y : tank2 ? tank2.y : atticFloor(plan);
60778
+ const r = shared3.ctx.r, nA = r.floors.length, plan = routingPlanOf(r), tank2 = r.waterTank, base2 = shared3.ctx.waterTankPos ? shared3.ctx.waterTankPos.y : tank2 ? tank2.y : atticFloor(plan);
60437
60779
  if (!tank2) return;
60438
60780
  const xyz = (p) => [p[0], p[1], p[2]];
60439
60781
  const out = [tank2.u, tank2.v - (tank2.d || 1.1) / 2 - 0.2], attic = atticFloor(plan) + ATTIC_LIFT.water;
60440
- const outlet = [[tank2.u, base + 0.08, tank2.v - (tank2.d || 1.1) / 2], [out[0], base + 0.08, out[1]], [out[0], attic, out[1]]];
60782
+ const outlet = [[tank2.u, base2 + 0.08, tank2.v - (tank2.d || 1.1) / 2], [out[0], base2 + 0.08, out[1]], [out[0], attic, out[1]]];
60441
60783
  cursor.group = shared3.ctx.waterTankPos && shared3.ctx.waterTankPos.group || "f0";
60442
60784
  cursor.pc = pieceRecord("pipe:run_outlet", "plastic", null, { tags: ["pipe"] });
60443
60785
  for (let i = 0; i + 1 < outlet.length; i++) pipe(outlet[i], outlet[i + 1], 0.032, PIPE_COLOR);
@@ -60592,8 +60934,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60592
60934
  Object.assign(K, defined);
60593
60935
  }
60594
60936
  var EPS23 = 1e-4;
60595
- function subtractRects(base, holes) {
60596
- let pieces = [base];
60937
+ function subtractRects(base2, holes) {
60938
+ let pieces = [base2];
60597
60939
  for (const h of holes) {
60598
60940
  const next = [];
60599
60941
  for (const r of pieces) {
@@ -60734,8 +61076,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60734
61076
  const depthOn = (side) => {
60735
61077
  const on = over.filter((c) => c.side === side);
60736
61078
  if (!on.length) return 0;
60737
- const least = Math.min(...on.map((c) => c.back)), back = Math.abs(least - mortar) < CHASE_CLEAR_OF_MORTAR ? mortar - CHASE_CLEAR_OF_MORTAR : least;
60738
- return t / 2 - (back - inset);
61079
+ const least = Math.min(...on.map((c) => c.back)), back2 = Math.abs(least - mortar) < CHASE_CLEAR_OF_MORTAR ? mortar - CHASE_CLEAR_OF_MORTAR : least;
61080
+ return t / 2 - (back2 - inset);
60739
61081
  };
60740
61082
  const low = depthOn(-1), high = depthOn(1);
60741
61083
  box5(batch, p0, q0, p1, q1, t - low - high, (low - high) / 2);
@@ -60875,8 +61217,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
60875
61217
  const along2 = wall.alongU ? r.u : r.v, across2 = (wall.alongU ? r.v : r.u) - core.line;
60876
61218
  if (along2 + r.radius + CHASE_CLEAR2 < wall.a0 || along2 - r.radius - CHASE_CLEAR2 > wall.a1 || r.y1 <= core.y0 || r.y0 >= core.y1) continue;
60877
61219
  if (Math.abs(across2) > wall.thickness / 2 + 1e-6) continue;
60878
- const back = Math.abs(across2) - (r.depth ?? r.radius) - CHASE_CLEAR2;
60879
- out.push({ a0: along2 - r.radius - CHASE_CLEAR2, a1: along2 + r.radius + CHASE_CLEAR2, y0: Math.max(core.y0, r.y0), y1: Math.min(core.y1, r.y1), side: across2 >= 0 ? 1 : -1, back, ...r.box ? { box: true } : {} });
61220
+ const back2 = Math.abs(across2) - (r.depth ?? r.radius) - CHASE_CLEAR2;
61221
+ out.push({ a0: along2 - r.radius - CHASE_CLEAR2, a1: along2 + r.radius + CHASE_CLEAR2, y0: Math.max(core.y0, r.y0), y1: Math.min(core.y1, r.y1), side: across2 >= 0 ? 1 : -1, back: back2, ...r.box ? { box: true } : {} });
60880
61222
  }
60881
61223
  return out;
60882
61224
  }
@@ -61232,8 +61574,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61232
61574
  const alongU = Math.abs(point.frontV) >= Math.abs(point.frontU);
61233
61575
  const intoRoom = Math.sign(alongU ? point.frontV : point.frontU);
61234
61576
  const face = wall.line + intoRoom * (wall.halfThickness - PLASTER_PER_FACE + WALL_BOX_PROUD);
61235
- const back = face - intoRoom * WALL_BOX.deep;
61236
- const [low, high] = face < back ? [face, back] : [back, face];
61577
+ const back2 = face - intoRoom * WALL_BOX.deep;
61578
+ const [low, high] = face < back2 ? [face, back2] : [back2, face];
61237
61579
  const half = WALL_BOX.along / 2;
61238
61580
  return {
61239
61581
  u0: alongU ? point.u - half : low,
@@ -61382,8 +61724,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61382
61724
  const M = en22.meter;
61383
61725
  if (M) {
61384
61726
  const hw = (M.w || 0.35) / 2, hd = (M.d || 0.2) / 2, hh = (M.h || 0.5) / 2, fr = M.side === "front" ? -1 : 1;
61385
- const back = shared3.ctx.visorScene ? 0 : 3e-3;
61386
- if (!(KV && KV.meter)) bx("plain", M.u - hw, M.y - hh, M.v - hd + (fr > 0 ? back : 0), M.u + hw, M.y + hh, M.v + hd - (fr < 0 ? back : 0), 14277597);
61727
+ const back2 = shared3.ctx.visorScene ? 0 : 3e-3;
61728
+ if (!(KV && KV.meter)) bx("plain", M.u - hw, M.y - hh, M.v - hd + (fr > 0 ? back2 : 0), M.u + hw, M.y + hh, M.v + hd - (fr < 0 ? back2 : 0), 14277597);
61387
61729
  const fz = fr < 0 ? [M.v - hd - 0.012, M.v - hd] : [M.v + hd, M.v + hd + 0.012];
61388
61730
  if (!(KV && KV.meter)) {
61389
61731
  bx("glass", M.u - hw * 0.6, M.y - hh * 0.2, fz[0], M.u + hw * 0.6, M.y + hh * 0.6, fz[1], 16777215);
@@ -61562,7 +61904,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61562
61904
  };
61563
61905
  for (const A of ws) for (const [side, sd] of [[A.w.sides[0], -1], [A.w.sides[1], 1]]) {
61564
61906
  if (!sideOf(side, false).exterior) continue;
61565
- const strip = (k, y1, y2, o0, o1, mat, c, piece2, laid = BASEBOARD_TILES) => {
61907
+ const strip = (k, y1, y2, o0, o1, mat, c, piece22, laid = BASEBOARD_TILES) => {
61566
61908
  const ea = junction(A, A.a, sd) > 0 ? A.th / 2 + k : junction(A, A.a, sd) < 0 ? -A.th / 2 : 0, eb = junction(A, A.b, sd) > 0 ? A.th / 2 + k : junction(A, A.b, sd) < 0 ? -A.th / 2 : 0;
61567
61909
  const s0 = A.a - ea, s1 = A.b + eb, f0 = A.L + sd * (A.th / 2 + o0), f1 = A.L + sd * (A.th / 2 + o1), lo = Math.min(f0, f1), hi = Math.max(f0, f1);
61568
61910
  if (s1 - s0 < 1e-3) return;
@@ -61586,7 +61928,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61586
61928
  runs.push([from, s1]);
61587
61929
  runs.forEach(([r0, r1], k2) => {
61588
61930
  if (r1 - r0 < 1e-3) return;
61589
- const id = piece2 && runs.length > 1 ? `${piece2}:${k2}` : piece2;
61931
+ const id = piece22 && runs.length > 1 ? `${piece22}:${k2}` : piece22;
61590
61932
  if (!id) box5(r0, r1);
61591
61933
  else if (shared3.ctx.baseboardBand) tile(id, r0, r1);
61592
61934
  else {
@@ -61674,12 +62016,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61674
62016
  const yA = roofHeightAt(p.u, p.v - hd), yB = roofHeightAt(p.u, p.v + hd), yC = roofHeightAt(p.u, p.v);
61675
62017
  let yc, tilt;
61676
62018
  if (onRack) {
61677
- const base = yC != null ? yC : Y0(fa) + 0.02, angle = (S.tilt || 15) * Math.PI / 180, high = Math.sin(angle) * p.length;
62019
+ const base2 = yC != null ? yC : Y0(fa) + 0.02, angle = (S.tilt || 15) * Math.PI / 180, high = Math.sin(angle) * p.length;
61678
62020
  tilt = sv * Math.atan2(high, d);
61679
- yc = base + 0.25 + high / 2;
61680
- const yLow = base + 0.25, yHigh = yLow + high;
61681
- for (const ex of [-0.8, 0.8]) for (const [vv, yTop] of [[p.v - sv * hd, yLow], [p.v + sv * hd, yHigh]]) bx("metal", p.u + ex * hw - 0.025, base, vv - 0.025, p.u + ex * hw + 0.025, yTop - 0.02, vv + 0.025, 8027780);
61682
- bx("metal", p.u - hw * 0.9, base + 0.01, p.v - sv * hd - 0.02, p.u + hw * 0.9, base + 0.05, p.v - sv * hd + 0.02, 8027780);
62021
+ yc = base2 + 0.25 + high / 2;
62022
+ const yLow = base2 + 0.25, yHigh = yLow + high;
62023
+ for (const ex of [-0.8, 0.8]) for (const [vv, yTop] of [[p.v - sv * hd, yLow], [p.v + sv * hd, yHigh]]) bx("metal", p.u + ex * hw - 0.025, base2, vv - 0.025, p.u + ex * hw + 0.025, yTop - 0.02, vv + 0.025, 8027780);
62024
+ bx("metal", p.u - hw * 0.9, base2 + 0.01, p.v - sv * hd - 0.02, p.u + hw * 0.9, base2 + 0.05, p.v - sv * hd + 0.02, 8027780);
61683
62025
  } else {
61684
62026
  if (yA == null || yB == null || yC == null) continue;
61685
62027
  tilt = Math.atan2(yA - yB, d);
@@ -61781,7 +62123,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
61781
62123
  }
61782
62124
  function installFurnitureApi(K, shared3) {
61783
62125
  const { _e, _h2, _q, boxC, cursor, macroGround, polyFace, put } = K;
61784
- const MATERIAL_MAP2 = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", plant: "plant", water: "water", emissive: "emissive", "atlas_picture": "picture", "atlas_floor": "floor", plaster: "plain", matte: "glass", glass_light: "emissive", light: "emissive", ceramic_tile: "plain", parquet: "plain", ceramic: "plain" };
62126
+ const MATERIAL_MAP2 = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", foam: "fabric", plant: "plant", water: "water", emissive: "emissive", "atlas_picture": "picture", "atlas_floor": "floor", plaster: "plain", matte: "glass", glass_light: "emissive", light: "emissive", ceramic_tile: "plain", parquet: "plain", ceramic: "plain" };
61785
62127
  const mm = (k) => MATERIAL_MAP2[k] || "plain";
61786
62128
  const LIGHTS = [];
61787
62129
  function makeApi() {
@@ -62532,7 +62874,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62532
62874
  }
62533
62875
  function installFurnitureTaps(K, shared3) {
62534
62876
  shared3.tapCount = 0;
62535
- function counterTap(K2, x, y, z, reach2, back, meta = {}) {
62877
+ function counterTap(K2, x, y, z, reach2, back2, meta = {}) {
62536
62878
  const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++;
62537
62879
  K2.c("metal", x, y, z, 0.028, 0.012, cr);
62538
62880
  K2.c("metal", x, y + 0.012, z, 0.014, 0.12, cr);
@@ -62559,11 +62901,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62559
62901
  );
62560
62902
  const ya = tip[1] - 0.05;
62561
62903
  K2.part("water_tap", tip[0], ya, tip[2], () => {
62562
- K2.t("water", [tip[0], ya, tip[2]], [tip[0], y - back, tip[2]], 6e-3, 13625588);
62904
+ K2.t("water", [tip[0], ya, tip[2]], [tip[0], y - back2, tip[2]], 6e-3, 13625588);
62563
62905
  }, { id: id + "_a", target: id, hidden: true, fluid: "water" });
62564
62906
  return id;
62565
62907
  }
62566
- function wallTap(K2, x, y, zw, direction, back, meta = {}) {
62908
+ function wallTap(K2, x, y, zw, direction, back2, meta = {}) {
62567
62909
  const cr = 12896460, id = "tap_" + (K2.M.seed || "") + "_" + shared3.tapCount++, s = direction || 1;
62568
62910
  K2.t("metal", [x, y, zw], [x, y, zw + s * 0.025], 0.03, cr);
62569
62911
  K2.t("metal", [x, y, zw + s * 0.02], [x, y, zw + s * 0.1], 0.016, cr);
@@ -62586,19 +62928,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62586
62928
  );
62587
62929
  const ya = y - 0.08;
62588
62930
  K2.part("water_tap", x, ya, zw + s * 0.105, () => {
62589
- K2.t("water", [x, ya, zw + s * 0.105], [x, back, zw + s * 0.105], 65e-4, 13625588);
62931
+ K2.t("water", [x, ya, zw + s * 0.105], [x, back2, zw + s * 0.105], 65e-4, 13625588);
62590
62932
  }, { id: id + "_a", target: id, hidden: true, fluid: "water" });
62591
62933
  return id;
62592
62934
  }
62593
62935
  const defined = { counterTap, wallTap };
62594
62936
  Object.assign(K, defined);
62595
62937
  }
62938
+ var SHOWER_DOOR = 0.72;
62939
+ var PANEL_THICKNESS = 0.02;
62940
+ var MIN_PANEL = 0.1;
62596
62941
  function installFurnitureFixtures(K, shared3) {
62942
+ const kernel = K;
62597
62943
  const seedKey = (id) => K.seedKey(id);
62598
62944
  const { FURNITURE, MIRRORS, SEED, arcPoints, cursor, kit2, rngString, sh } = K;
62599
62945
  FURNITURE.box = function(M, A) {
62600
62946
  const K2 = kit2(M, A, 0), w = M.w, d = M.d, cr = 13159632, id = "shower_" + (M.seed || ""), zw = -d / 2, X = w / 2 - 0;
62601
- const R = Math.min(0.32, w * 0.34, d * 0.34), gh = 1.95, gt2 = 8e-3;
62947
+ const walkIn = !shared3.ctx.visorScene;
62948
+ const R = walkIn ? Math.max(0.1, Math.min(0.32, w * 0.34, d * 0.34, w - 0.042 - SHOWER_DOOR)) : Math.min(0.32, w * 0.34, d * 0.34), gh = 1.95, gt2 = 8e-3;
62602
62949
  K2.b("plain", 0, 0, 0, w - 0.02, 0.05, d - 0.02, 15132902);
62603
62950
  K2.c("metal", 0, 0.05, 0, 0.045, 6e-3, 11580600);
62604
62951
  if (shared3.ctx.visorScene) K2.c("plain", 0, 0.05, 0, 0.032, 8e-3, 4212812);
@@ -62611,17 +62958,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62611
62958
  gl(px0, -d / 2 + 0.05, px0, pzF - R);
62612
62959
  const arc = arcPoints(px0 - R, pzF - R, R, 0, Math.PI / 2, 6);
62613
62960
  for (let i = 0; i < arc.length - 1; i++) gl(arc[i][0], arc[i][1], arc[i + 1][0], arc[i + 1][1]);
62614
- const fx1 = Math.max(-w / 2 + 0.36, px0 - R - 0.5);
62615
- gl(px0 - R, pzF, fx1, pzF);
62961
+ const front = walkIn ? Math.min(px0 - R, -w / 2 + 0.03 + SHOWER_DOOR) : Math.max(-w / 2 + 0.36, px0 - R - 0.5);
62962
+ const fx1 = walkIn && px0 - R - front < MIN_PANEL ? px0 - R : front, panel = px0 - R - fx1 > 0.01;
62963
+ if (panel) gl(px0 - R, pzF, fx1, pzF);
62616
62964
  const rail2 = (y, r) => {
62617
62965
  tube2([px0, y, -d / 2 + 0.05], [px0, y, pzF - R], r);
62618
62966
  for (let i = 0; i < arc.length - 1; i++) tube2([arc[i][0], y, arc[i][1]], [arc[i + 1][0], y, arc[i + 1][1]], r);
62619
- tube2([px0 - R, y, pzF], [fx1, y, pzF], r);
62967
+ if (panel) tube2([px0 - R, y, pzF], [fx1, y, pzF], r);
62620
62968
  };
62621
62969
  rail2(gh, 0.011);
62622
62970
  rail2(0.055, 9e-3);
62623
62971
  for (const [x, z] of [[px0, -d / 2 + 0.05], [fx1, pzF]]) tube2([x, 0.05, z], [x, gh + 5e-3, z], 0.011);
62624
- for (const [x, y, z] of [[px0, gh, -d / 2 + 0.05], [fx1, gh, pzF], [px0 - R, gh, pzF]]) K2.e("metal", x, y, z, 0.013, 0.026, cr);
62972
+ for (const [x, y, z] of [[px0, gh, -d / 2 + 0.05], [fx1, gh, pzF], ...panel ? [[px0 - R, gh, pzF]] : []]) K2.e("metal", x, y, z, 0.013, 0.026, cr);
62625
62973
  const hx = fx1, dw = hx - (-w / 2 + 0.03);
62626
62974
  if (dw > 0.2) K2.part(
62627
62975
  "shower_door",
@@ -62636,6 +62984,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62636
62984
  },
62637
62985
  { id: id + "_door", opens: { type: "swing", axis: [0, 1, 0], angle: -1.7 } }
62638
62986
  );
62987
+ if (walkIn) {
62988
+ const panels = [[px0, -d / 2 + 0.05, px0, pzF - R]];
62989
+ for (let i = 0; i < arc.length - 1; i++) panels.push([arc[i][0], arc[i][1], arc[i + 1][0], arc[i + 1][1]]);
62990
+ if (panel) panels.push([px0 - R, pzF, fx1, pzF]);
62991
+ kernel.walkInSolids(M, { panels, thickness: PANEL_THICKNESS, height: gh, door: dw > 0.2 ? { part: id + "_door", from: [hx, pzF], to: [hx - dw, pzF] } : null });
62992
+ }
62639
62993
  const ax = 0.1, ya = 2.08, z0 = zw + 0.012, Ra = 0.22, n = 6, pa = [];
62640
62994
  for (let i = 0; i <= n; i++) {
62641
62995
  const f = i / n * Math.PI / 2;
@@ -62846,12 +63200,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
62846
63200
  var DOOR = { recess: 0.012, thick: 0.02, side: 4e-3, bottom: 0.03 };
62847
63201
  var LOUVRE = { proud: 3e-3, slat: 0.012, pitch: 0.025, count: 4 };
62848
63202
  function gasShelterBoxes({ side, height }) {
62849
- const half = side / 2, back = -half + SHELTER_OFF_WALL;
63203
+ const half = side / 2, back2 = -half + SHELTER_OFF_WALL;
62850
63204
  const boxes = [
62851
- { part: "wall", front: [back, back + WALL], across: [-half, half], y: [0, height] },
62852
- { part: "wall", front: [back + WALL, half], across: [-half, -half + WALL], y: [0, height] },
62853
- { part: "wall", front: [back + WALL, half], across: [half - WALL, half], y: [0, height] },
62854
- { part: "roof", front: [back, half + EAVE2], across: [-half - EAVE2, half + EAVE2], y: [height, height + ROOF] }
63205
+ { part: "wall", front: [back2, back2 + WALL], across: [-half, half], y: [0, height] },
63206
+ { part: "wall", front: [back2 + WALL, half], across: [-half, -half + WALL], y: [0, height] },
63207
+ { part: "wall", front: [back2 + WALL, half], across: [half - WALL, half], y: [0, height] },
63208
+ { part: "roof", front: [back2, half + EAVE2], across: [-half - EAVE2, half + EAVE2], y: [height, height + ROOF] }
62855
63209
  ];
62856
63210
  const doorFace = half - DOOR.recess, doorAcross = [-half + WALL + DOOR.side, half - WALL - DOOR.side];
62857
63211
  boxes.push({ part: "door", front: [doorFace - DOOR.thick, doorFace], across: doorAcross, y: [DOOR.bottom, height - DOOR.bottom] });
@@ -63002,10 +63356,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63002
63356
  if (shelterOf(M)) {
63003
63357
  } else if (M.hose && M.hose.length > 1) {
63004
63358
  const q = M.hose[M.hose.length - 1], dx = q[0] - M.x, dz = q[1] - M.z, lx = dx * c - dz * s, lz = dx * s + dz * c, y1 = Math.max(0.1, q[2] != null ? q[2] : 0.5) - (M.y || 0);
63005
- const P0 = [0.1, H * 0.9 + 0.045, 0], P2 = [lx, y1, lz], len = Math.hypot(lx - P0[0], lz - P0[2]), back = Math.min(0.28, 0.08 + len * 0.06), n = 8, pts = [];
63359
+ const P0 = [0.1, H * 0.9 + 0.045, 0], P2 = [lx, y1, lz], len = Math.hypot(lx - P0[0], lz - P0[2]), back2 = Math.min(0.28, 0.08 + len * 0.06), n = 8, pts = [];
63006
63360
  for (let k = 0; k <= n; k++) {
63007
63361
  const t = k / n, u = 1 - t;
63008
- pts.push([u * P0[0] + t * P2[0], Math.max(0.02, u * P0[1] + t * P2[1] - 4 * t * u * back * (1 + len * 0.05)), u * P0[2] + t * P2[2]]);
63362
+ pts.push([u * P0[0] + t * P2[0], Math.max(0.02, u * P0[1] + t * P2[1] - 4 * t * u * back2 * (1 + len * 0.05)), u * P0[2] + t * P2[2]]);
63009
63363
  }
63010
63364
  for (let k = 0; k < n; k++) K2.t("plain", pts[k], pts[k + 1], 0.011, 12071454);
63011
63365
  K2.c("metal", P2[0], P2[1] - 0.025, P2[2], 0.016, 0.05, brass);
@@ -63196,6 +63550,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63196
63550
  const { THREE, Y0, _col, boxC, colorOf, cursor, decorLights, makeApi, structurePiece, OPEN_AREA, rectsOf: rectsOf2 } = K;
63197
63551
  const buildItem2 = (...a) => K.buildItem(...a);
63198
63552
  const registerCollision = (...a) => K.registerCollision(...a);
63553
+ const kitCollides = (...a) => K.kitCollides(...a);
63199
63554
  const vegItem = (...a) => K.vegItem(...a);
63200
63555
  const SLAB_UNDERSIDE = 0.24;
63201
63556
  function houseItems() {
@@ -63219,8 +63574,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63219
63574
  if (exterior && m.category === "ground_cover" && shared3.ctx.noGroundSurfaces) continue;
63220
63575
  const f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
63221
63576
  cursor.group = exterior && !(m.type === "cooking_gas_cylinder" && m.shelter && !shared3.ctx.visorScene) ? "lot" : "f" + Math.max(f, 0);
63222
- const com = m.room != null ? shared3.ctx.roomById[m.room] : void 0, lift = !exterior && f === 0 && shared3.ctx.constructionStages && !shared3.ctx.visorScene && !com?.outbuilding ? FLOOR_OVER_GROUND : 0, base = exterior ? 0 : Y0(f) + lift;
63223
- const M = { visorScene: shared3.ctx.visorScene, 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, shelter: m.shelter, pipe: m.pipe };
63577
+ const com = m.room != null ? shared3.ctx.roomById[m.room] : void 0, lift = !exterior && f === 0 && shared3.ctx.constructionStages && !shared3.ctx.visorScene && !com?.outbuilding ? FLOOR_OVER_GROUND : 0, base2 = exterior ? 0 : Y0(f) + lift;
63578
+ const M = { visorScene: shared3.ctx.visorScene, x: m.x, z: m.z, ry: m.ry || 0, w: m.w, d: m.d, h: m.h, y: m.y || 0, base: base2, 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, shelter: m.shelter, pipe: m.pipe };
63224
63579
  if (!exterior && !shared3.ctx.visorScene && f + 1 < R.floors.length && R.rooms.some((room) => room.floor === f + 1 && room.parts.some((r) => r[0] <= m.x && m.x <= r[2] && r[1] <= m.z && m.z <= r[3]))) M.ceiling = Math.min(M.ceiling ?? 2.9, Y0(f + 1) - SLAB_UNDERSIDE - Y0(f));
63225
63580
  if (lift) M.ceiling = (M.ceiling ?? 2.9) - lift;
63226
63581
  if (!exterior && !shared3.ctx.visorScene && f > 0) overRoof(m, M, f);
@@ -63263,13 +63618,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63263
63618
  }
63264
63619
  }
63265
63620
  if (shared3.ctx.iv && shared3.ctx.iv.replace.has(m.id)) {
63266
- registerCollision(m, M);
63621
+ if (!kitCollides(m)) registerCollision(m, M);
63267
63622
  continue;
63268
63623
  }
63269
63624
  const ent = T2[m.type];
63270
63625
  const st0 = cursor.stage;
63271
63626
  if (shared3.ctx.constructionStages && (m.type === "cooking_gas_cylinder" || m.type === "gas_cylinder" || m.type === "water_tank")) cursor.stage = "installations";
63272
- shared3.ctx.restOn = exterior || shared3.ctx.visorScene ? void 0 : base;
63627
+ shared3.ctx.restOn = exterior || shared3.ctx.visorScene ? void 0 : base2;
63273
63628
  if (!shared3.ctx.visorScene) {
63274
63629
  const quarter = Math.round(M.ry / (Math.PI / 2));
63275
63630
  if (Math.abs(M.ry - quarter * Math.PI / 2) < 0.01) M.ry = quarter * Math.PI / 2;
@@ -63386,7 +63741,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63386
63741
  return;
63387
63742
  }
63388
63743
  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));
63389
- 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));
63744
+ const base2 = 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));
63390
63745
  cursor.group = slab ? "f" + f : "attic_tank";
63391
63746
  const platformLift = !slab && !shared3.ctx.visorScene ? 0.12 : 0;
63392
63747
  if (lc) {
@@ -63405,12 +63760,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63405
63760
  }
63406
63761
  if (!slab) {
63407
63762
  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;
63408
- const top = base + platformLift;
63763
+ const top = base2 + platformLift;
63409
63764
  boxC("plain", cd.u, top - 0.06, cd.v, hw * 2, 0.12, hd * 2, color2);
63410
- 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);
63765
+ for (const sx of [-1, 1]) for (const sz of [-1, 1]) boxC("plain", cd.u + sx * (hw - 0.07), (yp + base2 - 0.12) / 2, cd.v + sz * (hd - 0.07), 0.1, base2 - 0.12 - yp, 0.1, color2);
63411
63766
  }
63412
- const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base: base + platformLift, floor: f, colors: shared3.ctx.colors, seed: "water_tank", room: cd.room, onSlab: true, ceiling: 2.9 };
63413
- shared3.ctx.waterTankPos = { x: cd.u, z: cd.v, y: base + platformLift, group: cursor.group };
63767
+ const M = { x: cd.u, z: cd.v, ry: 0, w: cd.w, d: cd.d, h: cd.h + 0.12, y: 0, base: base2 + platformLift, floor: f, colors: shared3.ctx.colors, seed: "water_tank", room: cd.room, onSlab: true, ceiling: 2.9 };
63768
+ shared3.ctx.waterTankPos = { x: cd.u, z: cd.v, y: base2 + platformLift, group: cursor.group };
63414
63769
  shared3.ctx.types.water_tank.f(M, api);
63415
63770
  }
63416
63771
  function trestleTank(api, cd) {
@@ -63811,8 +64166,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63811
64166
  const d1 = objectDistance(o, x, z);
63812
64167
  if (d1 < R && d1 < objectDistance(o, fx, fz) - 1e-6) return true;
63813
64168
  }
64169
+ return collideKit(x, z, fx, fz, floor2, R);
64170
+ }
64171
+ function collideKit(x, z, fx, fz, floor2, R) {
64172
+ const iv = shared3.ctx.iv, collided = iv && iv.collided;
64173
+ if (!iv || !collided || !collided.size) return false;
64174
+ for (const k of iv.world.colliders()) {
64175
+ const f = collided.get(k.object);
64176
+ if (f === void 0 || (f !== -1 ? f !== floor2 : floor2 !== 0)) continue;
64177
+ const o = { f, cx: k.cx, cz: k.cz, c: Math.cos(k.ry), s: Math.sin(k.ry), hw: k.hw, hd: k.hd, type: "kit" };
64178
+ const d1 = objectDistance(o, x, z);
64179
+ if (d1 < R && d1 < objectDistance(o, fx, fz) - 1e-6) return true;
64180
+ }
63814
64181
  return false;
63815
64182
  }
64183
+ function kitCollides(m) {
64184
+ const iv = shared3.ctx.iv;
64185
+ if (!iv) return false;
64186
+ const own = [...iv.entries.values()].filter((e) => e.origin === m.id && (e.spec.colliders?.length ?? 0) > 0);
64187
+ if (!own.length) return false;
64188
+ const collided = iv.collided || (iv.collided = /* @__PURE__ */ new Map());
64189
+ for (const e of own) collided.set(e.id, e.floor);
64190
+ return true;
64191
+ }
63816
64192
  function collideAt(x, z, floor2, opt) {
63817
64193
  opt = opt || {};
63818
64194
  const R = opt.radius != null ? opt.radius : 0.24;
@@ -63826,7 +64202,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
63826
64202
  const de = opt.from || [x + 1e4, z + 1e4];
63827
64203
  return collideObject(x, z, de[0], de[1], floor2);
63828
64204
  }
63829
- const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt };
64205
+ function walkInSolids(M, spec) {
64206
+ const objs = shared3.inter?.objs, colliders = shared3.ctx.colliders;
64207
+ if (!objs || !colliders) return;
64208
+ const at4 = objs.findIndex((o) => o.cx === M.x && o.cz === M.z && o.f === M.floor);
64209
+ const kept = at4 >= 0 ? objs.splice(at4, 1)[0] : void 0;
64210
+ const type = kept?.type ?? "walk_in";
64211
+ const half = spec.thickness / 2;
64212
+ for (const [x0, z0, x1, z1] of spec.panels) {
64213
+ const length2 = Math.hypot(x1 - x0, z1 - z0);
64214
+ if (length2 < 1e-3) continue;
64215
+ const [cx, cz] = K.localOf(M, (x0 + x1) / 2, (z0 + z1) / 2), turn2 = (M.ry || 0) + Math.atan2(-(z1 - z0), x1 - x0);
64216
+ objs.push({ f: M.floor, cx, cz, c: Math.cos(turn2), s: Math.sin(turn2), hw: length2 / 2, hd: half, h: spec.height, type });
64217
+ }
64218
+ if (!spec.door) return;
64219
+ const [ax, az] = K.localOf(M, spec.door.from[0], spec.door.from[1]), [bx, bz] = K.localOf(M, spec.door.to[0], spec.door.to[1]);
64220
+ colliders.push({ type: "walk_in_door", f: M.floor, x0: Math.min(ax, bx) - half, z0: Math.min(az, bz) - half, x1: Math.max(ax, bx) + half, z1: Math.max(az, bz) + half, piece: spec.door.part, anchor: [(ax + bx) / 2, (M.base || 0) + 1, (az + bz) / 2], off: false });
64221
+ }
64222
+ const defined = { NO_COLLIDE, registerCollision, objectDistance, collideObject, collideAt, walkInSolids, kitCollides };
63830
64223
  Object.assign(K, defined);
63831
64224
  }
63832
64225
  function installInteractionItems(K, shared3) {
@@ -64033,13 +64426,26 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64033
64426
  const g = r.g;
64034
64427
  if (!isFinite(r.x0)) return;
64035
64428
  const sd = (g.axis === "u" ? cz - g.v : cu - g.u) >= 0 ? 1 : -1, name = "ix:gate:" + g.id, ped = g.model === "pedestrian", tilt = g.model === "tilting";
64036
- const base = { parent: "lot", ry: 0, t0: g.open ? 1 : 0, col: cols[i], gate: g };
64037
- const p = ped ? definePiece(name, Object.assign(base, { kind: "gate_swing", pivot: [r.x0, 0, g.v], angle: -sd * 1.65 })) : tilt ? definePiece(name, Object.assign(base, { kind: "gate_tilting", pivot: [(r.x0 + r.x1) / 2, r.y1, g.v], angle: -sd * 1.45 })) : definePiece(name, Object.assign(base, { kind: "gate_sliding", pivot: [r.x0, 0, r.zm], travel: r.dx * g.width }));
64429
+ const base2 = { parent: "lot", ry: 0, t0: g.open ? 1 : 0, col: cols[i], gate: g };
64430
+ const p = ped ? definePiece(name, Object.assign(base2, { kind: "gate_swing", pivot: [r.x0, 0, g.v], angle: -sd * 1.65 })) : tilt ? definePiece(name, Object.assign(base2, { kind: "gate_tilting", pivot: [(r.x0 + r.x1) / 2, r.y1, g.v], angle: -sd * 1.45 })) : definePiece(name, Object.assign(base2, { kind: "gate_sliding", pivot: [r.x0, 0, r.zm], travel: r.dx * g.width }));
64038
64431
  if (p.col) p.col.off = p.target > 0.5;
64039
64432
  const text = () => t(p.target > 0.5 ? "prompt.close" : "prompt.open", { what: t(ped ? "what.pedestrianGate" : "what.garageGate") });
64040
64433
  I().items.push({ type: "gate", id: g.id, floor: -1, anchor: [g.u, 1, g.v + sd * 0.4], range: 2.8, angle: 0.9, pieces: [p], text, action: () => togglePiece(p), noWall: true });
64041
64434
  });
64042
64435
  }
64436
+ function walkInInteractive() {
64437
+ for (const c of shared3.ctx.colliders) {
64438
+ if (c.type !== "walk_in_door" || typeof c.piece !== "string") continue;
64439
+ const g = shared3.ctx.parts && shared3.ctx.parts[c.piece];
64440
+ if (!g) continue;
64441
+ const def = definePiece("ix:walkin:" + c.piece, { kind: "part", pivot: [0, 0, 0], ry: 0, parent: "lot" });
64442
+ def.inner = g;
64443
+ def.col = c;
64444
+ c.off = def.t > 0.5;
64445
+ I().items.push({ type: "walk_in_door", id: c.piece, floor: c.f, anchor: c.anchor, range: 1.6, angle: 1, pieces: [def], text: () => t(def.target > 0.5 ? "prompt.close" : "prompt.open", { what: t("what.stallDoor") }), action: () => togglePiece(def) });
64446
+ applyPiece(def);
64447
+ }
64448
+ }
64043
64449
  function mailboxInteractive() {
64044
64450
  for (const m of house().items) {
64045
64451
  if (m.type !== "mailbox") continue;
@@ -64097,15 +64503,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64097
64503
  else bx("plain", Math.min(f2, f3), yc - 0.032, u - 0.016, Math.max(f2, f3), yc + 0.032, u + 0.016, 16250092);
64098
64504
  cursor.group = g0;
64099
64505
  const pv = alongU ? [u, yc, f2] : [f2, yc, u];
64100
- const piece2 = definePiece("ix:int:" + roomId, { kind: "light_switch", pivot: pv, ry: 0, parent: "f" + f, axis: alongU ? "x" : "z", sgn: alongU ? sd : -sd, t0: lightOn(roomId) ? 1 : 0 });
64101
- piece2.t = piece2.target = lightOn(roomId) ? 1 : 0;
64506
+ const piece22 = definePiece("ix:int:" + roomId, { kind: "light_switch", pivot: pv, ry: 0, parent: "f" + f, axis: alongU ? "x" : "z", sgn: alongU ? sd : -sd, t0: lightOn(roomId) ? 1 : 0 });
64507
+ piece22.t = piece22.target = lightOn(roomId) ? 1 : 0;
64102
64508
  const an = alongU ? [u, yc, face + sd * 0.12] : [face + sd * 0.12, yc, u];
64103
- I().items.push({ type: "light_switch", id: roomId, floor: f, anchor: an, range: 1.5, angle: 0.45, pieces: [piece2], text: () => t(lightOn(roomId) ? "prompt.lightOff" : "prompt.lightOn"), action: () => toggleLight(roomId) });
64509
+ I().items.push({ type: "light_switch", id: roomId, floor: f, anchor: an, range: 1.5, angle: 0.45, pieces: [piece22], text: () => t(lightOn(roomId) ? "prompt.lightOff" : "prompt.lightOn"), action: () => toggleLight(roomId) });
64104
64510
  return true;
64105
64511
  }
64106
64512
  return false;
64107
64513
  }
64108
- const defined = { gatesInteractive, mailboxInteractive, placeSwitches, putSwitch };
64514
+ const defined = { walkInInteractive, gatesInteractive, mailboxInteractive, placeSwitches, putSwitch };
64109
64515
  Object.assign(K, defined);
64110
64516
  }
64111
64517
  function installInteractionDoors(K, shared3) {
@@ -64268,7 +64674,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64268
64674
  const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
64269
64675
  const enter = (...a) => K.enter(...a);
64270
64676
  const roomLightMask = (...a) => K.roomLightMask(...a);
64271
- 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" };
64677
+ const IV_MATERIAL = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", foam: "fabric", plant: "plant", water: "water", emissive: "emissive", atlas_picture: "picture", atlas_floor: "floor" };
64272
64678
  const IV_WIRE = { conduit: 13618628, cable: 2762532, drop: 1381653, cord: 1776413, earth: 3111482, hose: 11556124 };
64273
64679
  const IV_DOOR = /^(door|drawer)/;
64274
64680
  const ivGroup = (e) => e.floor < 0 ? "lot" : "f" + Math.min(e.floor, shared3.ctx.r.floors.length - 1);
@@ -64338,7 +64744,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64338
64744
  const entById = new Map(plane2.items.map((e) => [e.id, e]));
64339
64745
  const entByItem = new Map(plane2.items.map((e) => [e.item, e]));
64340
64746
  const mats = shared3.mats;
64341
- 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 };
64747
+ IV.mats = { plain: mats.plain, metal: shared3.mats.metal, wood: shared3.mats.wood, glass: shared3.mats.glass, fabric: shared3.mats.fabric, foam: 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 };
64342
64748
  const ev = (e) => ivEvent(h, e);
64343
64749
  const world = IV.world = A.createWorld(source, { water, seed: r.seed, onEvent: ev });
64344
64750
  const add0 = world.add;
@@ -64449,7 +64855,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64449
64855
  cursor.stage = stage0;
64450
64856
  cursor.pc = pieceBefore;
64451
64857
  }
64452
- const base = new Set(Object.values(IV.mats));
64858
+ const base2 = new Set(Object.values(IV.mats));
64453
64859
  root.traverse((o) => {
64454
64860
  if (!isMesh(o)) return;
64455
64861
  o.userData.iv = ent.id;
@@ -64457,7 +64863,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64457
64863
  if (!o.geometry.boundingSphere) o.geometry.computeBoundingSphere();
64458
64864
  if (o.geometry.boundingSphere.radius < 0.07) o.castShadow = false;
64459
64865
  }
64460
- for (const m of Array.isArray(o.material) ? o.material : [o.material]) if (m && !base.has(m) && m.userData && m.userData.roomLightMask && m.onBeforeCompile === THREE.Material.prototype.onBeforeCompile) {
64866
+ for (const m of Array.isArray(o.material) ? o.material : [o.material]) if (m && !base2.has(m) && m.userData && m.userData.roomLightMask && m.onBeforeCompile === THREE.Material.prototype.onBeforeCompile) {
64461
64867
  m.userData.roomLightMask = false;
64462
64868
  roomLightMask(m);
64463
64869
  }
@@ -64759,6 +65165,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
64759
65165
  roomStates: IV.roomStates,
64760
65166
  warnings: IV.warnings,
64761
65167
  water: IV.water,
65168
+ solidColliders: () => {
65169
+ const c = IV.collided;
65170
+ return c && c.size ? w.colliders().flatMap((k) => {
65171
+ const floor2 = c.get(k.object);
65172
+ return floor2 === void 0 ? [] : [{ ...k, floor: floor2 }];
65173
+ }) : [];
65174
+ },
64762
65175
  screens: IV.screens,
64763
65176
  effects: () => IV.efx || null,
64764
65177
  // TV screens (id -> kit screen) and the particle system (smoke), for whoever wants to inspect
@@ -65380,8 +65793,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65380
65793
  return { depth: Math.max(drawn, declared2?.depth ?? 0), width: declared2?.width ?? Math.max(u1 - u0, v1 - v0) };
65381
65794
  }
65382
65795
  function groundJointStrength(part, kind) {
65383
- const base = buriedBase(part);
65384
- return base.depth > 0 ? embedmentStrength(kind, base) : void 0;
65796
+ const base2 = buriedBase(part);
65797
+ return base2.depth > 0 ? embedmentStrength(kind, base2) : void 0;
65385
65798
  }
65386
65799
  var NONE = { panels: [], replaced: [], supports: [] };
65387
65800
  var MEMO = /* @__PURE__ */ new WeakMap();
@@ -65493,7 +65906,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65493
65906
  parts2.push(p);
65494
65907
  byId.set(p.id, p);
65495
65908
  }
65496
- const base = parts2.length, view = shared3.ctx.panelView || panelViewOf(null, false), panelIds = new Set(view.panels.map((e) => e.id));
65909
+ const base2 = parts2.length, view = shared3.ctx.panelView || panelViewOf(null, false), panelIds = new Set(view.panels.map((e) => e.id));
65497
65910
  for (const [id, pc] of shared3.ctx.pieces) {
65498
65911
  if (byId.has(id) || panelIds.has(id) || !meshes.has(id)) continue;
65499
65912
  const b = box32(id);
@@ -65523,7 +65936,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65523
65936
  const floorUnder = (p) => {
65524
65937
  const cx = (p.aabb[0] + p.aabb[2]) / 2, cz = (p.aabb[1] + p.aabb[3]) / 2;
65525
65938
  let best = null;
65526
- for (const q of parts2.slice(0, base)) {
65939
+ for (const q of parts2.slice(0, base2)) {
65527
65940
  if (!isFloor(q, p.y0) || cx < q.aabb[0] - HOLD_TOUCH || cx > q.aabb[2] + HOLD_TOUCH || cz < q.aabb[1] - HOLD_TOUCH || cz > q.aabb[3] + HOLD_TOUCH) continue;
65528
65941
  if (!best || q.y1 > best.y1 || q.y1 === best.y1 && q.id < best.id) best = q;
65529
65942
  }
@@ -65556,7 +65969,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65556
65969
  return { part: p.id, on: "ground", joint: joint2, bears: false, extra: true, ...strength !== void 0 ? { strength } : {} };
65557
65970
  };
65558
65971
  const unheld = [];
65559
- for (const p of parts2.slice(base)) {
65972
+ for (const p of parts2.slice(base2)) {
65560
65973
  if (/^sidewalk:/.test(p.id)) {
65561
65974
  supports.push({ part: p.id, on: "ground", joint: "mortar", extra: true });
65562
65975
  continue;
@@ -65584,7 +65997,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65584
65997
  if (!/^(window|window_pane|door|jamb|pipe|water_tank|baseboard)/.test(p.id)) continue;
65585
65998
  const target = /^water_tank/.test(p.id) ? ["slab"] : ["wall", "partition"];
65586
65999
  let m = null, md = 1e9;
65587
- for (const q of parts2.slice(0, base)) {
66000
+ for (const q of parts2.slice(0, base2)) {
65588
66001
  if (!target.includes(q.role) || !inside22(p, q, 0.2)) continue;
65589
66002
  const d = Math.hypot((p.aabb[0] + p.aabb[2] - q.aabb[0] - q.aabb[2]) / 2, (p.aabb[1] + p.aabb[3] - q.aabb[1] - q.aabb[3]) / 2);
65590
66003
  if (d < md) {
@@ -65592,7 +66005,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65592
66005
  m = q;
65593
66006
  }
65594
66007
  }
65595
- if (!m && /^(window|door|jamb)/.test(p.id)) for (const q of parts2.slice(0, base)) {
66008
+ if (!m && /^(window|door|jamb)/.test(p.id)) for (const q of parts2.slice(0, base2)) {
65596
66009
  if (!["wall", "partition", "column", "beam"].includes(q.role) || !touches2(p, q, 0.02)) continue;
65597
66010
  const d = Math.hypot((p.aabb[0] + p.aabb[2] - q.aabb[0] - q.aabb[2]) / 2, (p.y0 + p.y1 - q.y0 - q.y1) / 2, (p.aabb[1] + p.aabb[3] - q.aabb[1] - q.aabb[3]) / 2);
65598
66011
  if (d < md) {
@@ -65730,6 +66143,119 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65730
66143
  if (distance4 <= -depth) return true;
65731
66144
  return distance4 <= -depth * noise3();
65732
66145
  }
66146
+ var JOINT_SHARE = 0.5;
66147
+ var EPSILON22 = 1e-4;
66148
+ function carve(boxes, grid) {
66149
+ const { data, w, h, len, y0, height } = grid;
66150
+ const out = [];
66151
+ for (const box5 of boxes) {
66152
+ const j0 = Math.max(0, Math.floor((box5.y0 - y0) / height * h)), j1 = Math.min(h - 1, Math.ceil((box5.y1 - y0) / height * h) - 1);
66153
+ const i0 = Math.max(0, Math.floor(box5.a / len * w)), i1 = Math.min(w - 1, Math.ceil(box5.b / len * w) - 1);
66154
+ if (j1 < j0 || i1 < i0) {
66155
+ out.push(box5);
66156
+ continue;
66157
+ }
66158
+ for (let j = j0; j <= j1; j++) {
66159
+ const ry0 = Math.max(box5.y0, y0 + j / h * height), ry1 = Math.min(box5.y1, y0 + (j + 1) / h * height);
66160
+ let start = -1;
66161
+ for (let i = i0; i <= i1 + 1; i++) {
66162
+ const solid2 = i <= i1 && data[j * w + i] <= 127;
66163
+ if (solid2 && start < 0) start = i;
66164
+ if (!solid2 && start >= 0) {
66165
+ out.push({ a: Math.max(box5.a, start / w * len), b: Math.min(box5.b, i / w * len), y0: ry0, y1: ry1 });
66166
+ start = -1;
66167
+ }
66168
+ }
66169
+ }
66170
+ }
66171
+ return out;
66172
+ }
66173
+ var groupBy = (items, keyOf2) => {
66174
+ const groups = /* @__PURE__ */ new Map();
66175
+ for (const item of items) {
66176
+ const key2 = keyOf2(item);
66177
+ const group = groups.get(key2);
66178
+ if (group) group.push(item);
66179
+ else groups.set(key2, [item]);
66180
+ }
66181
+ return [...groups.values()];
66182
+ };
66183
+ function mergeSpans(spans, share = JOINT_SHARE) {
66184
+ const runs = [];
66185
+ const unitLengths = /* @__PURE__ */ new Map();
66186
+ for (const row of groupBy(spans, (s) => `${s.y0.toFixed(4)}:${s.y1.toFixed(4)}`)) {
66187
+ row.sort((p, q) => p.a - q.a);
66188
+ let run = { ...row[0] };
66189
+ let unitLength = run.b - run.a;
66190
+ for (const s of row.slice(1)) {
66191
+ if (s.a - run.b <= share * Math.min(s.b - s.a, unitLength) + EPSILON22) run.b = Math.max(run.b, s.b);
66192
+ else {
66193
+ runs.push(run);
66194
+ unitLengths.set(run, unitLength);
66195
+ run = { ...s };
66196
+ }
66197
+ unitLength = s.b - s.a;
66198
+ }
66199
+ runs.push(run);
66200
+ unitLengths.set(run, unitLength);
66201
+ }
66202
+ const out = [];
66203
+ const open = [];
66204
+ for (const r of [...runs].sort((p, q) => p.y0 - q.y0 || p.a - q.a)) {
66205
+ const height = r.y1 - r.y0;
66206
+ const top = open.find((o) => {
66207
+ const slack = share * Math.min(o.unitLength, r.b - r.a) + EPSILON22;
66208
+ return r.y0 - o.box.y1 >= -EPSILON22 && r.y0 - o.box.y1 <= share * Math.min(o.unitHeight, height) + EPSILON22 && Math.abs(r.a - o.box.a) <= slack && Math.abs(r.b - o.box.b) <= slack;
66209
+ });
66210
+ if (top) {
66211
+ top.box.y1 = r.y1;
66212
+ top.box.a = Math.min(top.box.a, r.a);
66213
+ top.box.b = Math.max(top.box.b, r.b);
66214
+ top.unitHeight = height;
66215
+ } else {
66216
+ const box5 = { ...r };
66217
+ out.push(box5);
66218
+ open.push({ box: box5, unitHeight: height, unitLength: unitLengths.get(r) ?? r.b - r.a });
66219
+ }
66220
+ }
66221
+ return out;
66222
+ }
66223
+ function standingSolids(THREE, house, mesh3, line, parts2) {
66224
+ house.updateWorldMatrix(true, false);
66225
+ mesh3.updateWorldMatrix(true, false);
66226
+ const toMesh = new THREE.Matrix4().copy(mesh3.matrixWorld).invert().multiply(house.matrixWorld);
66227
+ const turn2 = new THREE.Quaternion();
66228
+ const scale = new THREE.Vector3();
66229
+ toMesh.decompose(new THREE.Vector3(), turn2, scale);
66230
+ const point = new THREE.Vector3();
66231
+ const out = [];
66232
+ for (const part of parts2) {
66233
+ const boxes = mergeSpans(part.spans);
66234
+ for (const s of line.open ? mergeSpans(carve(boxes, line.open), 0) : boxes) {
66235
+ const along2 = line.start + (s.a + s.b) / 2;
66236
+ point.set(line.alongU ? along2 : part.mid, (s.y0 + s.y1) / 2, line.alongU ? part.mid : along2).applyMatrix4(toMesh);
66237
+ const length2 = (s.b - s.a) / 2, up = (s.y1 - s.y0) / 2, across2 = part.thick / 2;
66238
+ out.push({
66239
+ center: [point.x, point.y, point.z],
66240
+ half: [(line.alongU ? length2 : across2) * scale.x, up * scale.y, (line.alongU ? across2 : length2) * scale.z],
66241
+ rotation: [turn2.x, turn2.y, turn2.z, turn2.w],
66242
+ kind: "box"
66243
+ });
66244
+ }
66245
+ }
66246
+ return out;
66247
+ }
66248
+ function publishSolids(mesh3, v0, v1, solids2) {
66249
+ const u = mesh3.userData;
66250
+ u.drawnSolids = [...(u.drawnSolids ?? []).filter((entry2) => entry2.v0 !== v0), { v0, v1, solids: solids2 }];
66251
+ u.drawnSolidsVersion = (u.drawnSolidsVersion ?? 0) + 1;
66252
+ }
66253
+ function withdrawSolids(mesh3, v0) {
66254
+ const u = mesh3.userData;
66255
+ if (!u.drawnSolids?.some((entry2) => entry2.v0 === v0)) return;
66256
+ u.drawnSolids = u.drawnSolids.filter((entry2) => entry2.v0 !== v0);
66257
+ u.drawnSolidsVersion = (u.drawnSolidsVersion ?? 0) + 1;
66258
+ }
65733
66259
  function collapseRange(mesh3, v0, v1) {
65734
66260
  const pos = mesh3.geometry.attributes.position;
65735
66261
  const a = pos.array;
@@ -65754,6 +66280,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
65754
66280
  markPositionsWritten(mesh3, v0, v0 + saved.length / 3);
65755
66281
  const list2 = mesh3.userData.collapsedRanges;
65756
66282
  if (list2) mesh3.userData.collapsedRanges = list2.filter((r) => r[0] !== v0);
66283
+ withdrawSolids(mesh3, v0);
65757
66284
  }
65758
66285
  function noise2(x, y, cell) {
65759
66286
  const h = (i2, j2) => {
@@ -66077,11 +66604,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66077
66604
  }
66078
66605
  g.computeBoundingBox();
66079
66606
  g.computeBoundingSphere();
66080
- const base = it.mesh.material;
66081
- const material = base.clone();
66607
+ const base2 = it.mesh.material;
66608
+ const material = base2.clone();
66082
66609
  const toHouse = { value: new THREE.Matrix4() };
66083
66610
  material.onBeforeCompile = (sh) => {
66084
- base.onBeforeCompile?.(sh);
66611
+ base2.onBeforeCompile?.(sh);
66085
66612
  sh.uniforms.uToHouse = toHouse;
66086
66613
  sh.uniforms.uMask = { value: mask.texture };
66087
66614
  sh.uniforms.uMaskRect = { value: mask.rect };
@@ -66089,7 +66616,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66089
66616
  sh.vertexShader = sh.vertexShader.replace("void main() {", "uniform mat4 uToHouse;\nvarying vec3 vHousePos;\nvoid main() {").replace("#include <begin_vertex>", "#include <begin_vertex>\nvHousePos = (uToHouse * vec4(transformed, 1.0)).xyz;");
66090
66617
  sh.fragmentShader = sh.fragmentShader.replace("void main() {", "uniform sampler2D uMask;\nuniform vec4 uMaskRect;\nuniform float uMaskAlongX;\nvarying vec3 vHousePos;\nvoid main() {\n vec2 mUv = vec2(((uMaskAlongX > 0.5 ? vHousePos.x : vHousePos.z) - uMaskRect.x) / uMaskRect.z, (vHousePos.y - uMaskRect.y) / uMaskRect.w);\n if (mUv.x >= 0.0 && mUv.x <= 1.0 && mUv.y >= 0.0 && mUv.y <= 1.0 && texture2D(uMask, mUv).r > 0.5) discard;");
66091
66618
  };
66092
- material.customProgramCacheKey = () => "breachMask" + (base.customProgramCacheKey?.() ?? "");
66619
+ material.customProgramCacheKey = () => "breachMask" + (base2.customProgramCacheKey?.() ?? "");
66093
66620
  const mesh3 = new THREE.Mesh(g, material);
66094
66621
  mesh3.name = "breach-shell";
66095
66622
  mesh3.userData.breachMask = mask;
@@ -66204,6 +66731,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66204
66731
  const around = { pillars: pillarSpans(view), gaps: windowGaps(view) };
66205
66732
  for (const id of view.parts) view.kept.set(id, splitUnits(view, id, around).kept);
66206
66733
  view.keptStale = false;
66734
+ publishStanding(view);
66735
+ }
66736
+ function publishStanding(view) {
66737
+ if (!view.saved) return;
66738
+ const { mask } = view;
66739
+ const parts2 = view.parts.map((id) => {
66740
+ const part = structure.byId.get(id);
66741
+ const thick = mask.alongU ? part.aabb[3] - part.aabb[1] : part.aabb[2] - part.aabb[0];
66742
+ const mid = mask.alongU ? (part.aabb[1] + part.aabb[3]) / 2 : (part.aabb[0] + part.aabb[2]) / 2;
66743
+ return { spans: view.kept.get(id) ?? [], thick, mid };
66744
+ });
66745
+ const line = { alongU: mask.alongU, start: mask.start, open: view.core };
66746
+ view.items.forEach((it, k) => publishSolids(it.mesh, it.v0, it.v1, k === 0 ? standingSolids(THREE, house, it.mesh, line, parts2) : []));
66207
66747
  }
66208
66748
  function paint2(view) {
66209
66749
  const { mask, core } = view;
@@ -66278,13 +66818,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66278
66818
  const unit = clipToBox({ x: mask.alongU ? centre : mid, y, z: mask.alongU ? mid : centre, sx: mask.alongU ? s : d, sy: dy, sz: mask.alongU ? d : s, colour }, inner);
66279
66819
  if (unit && !discs.some((k) => Math.hypot((mask.alongU ? unit.x : unit.z) - mask.start - k.s, unit.y - k.y) < k.r)) list2.push(unit);
66280
66820
  };
66281
- const base = fragmentMaterial(part.material).color.getHex();
66821
+ const base2 = fragmentMaterial(part.material).color.getHex();
66282
66822
  const n = noise2(centre * 3.1, y * 2.7, 0.07);
66283
66823
  if (units2.mortar === "concrete") {
66284
- at4(len, h, thick - 2 * COVER2, tone(base, 0.9 + 0.04 * n));
66824
+ at4(len, h, thick - 2 * COVER2, tone(base2, 0.9 + 0.04 * n));
66285
66825
  } else {
66286
66826
  at4(len, h, thick - 2 * COVER2 - 0.012, 10327948);
66287
- at4(len - 0.012, h - 0.012, thick - 2 * COVER2, tone(base, 0.8 + 0.35 * n));
66827
+ at4(len - 0.012, h - 0.012, thick - 2 * COVER2, tone(base2, 0.8 + 0.35 * n));
66288
66828
  }
66289
66829
  }
66290
66830
  const lumps = stuckLumps(castGone, mask, view.bounds);
@@ -66308,6 +66848,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66308
66848
  view.gone = holes.length;
66309
66849
  view.pits = pits.length;
66310
66850
  view.flakes = flakes.length;
66851
+ publishStanding(view);
66311
66852
  }
66312
66853
  function chipBox(chip, alongU) {
66313
66854
  house.updateWorldMatrix(true, false);
@@ -66419,6 +66960,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66419
66960
  view.shells = view.items.map((it) => shell(it, view.mask));
66420
66961
  for (const m of view.shells) m.userData.behind = () => view.units;
66421
66962
  view.saved = view.items.map((it) => ({ it, v0: it.v0, data: collapseRange(it.mesh, it.v0, it.v1) }));
66963
+ refreshKept(view);
66422
66964
  }
66423
66965
  function draw2(partId, change) {
66424
66966
  if (lod !== 0) return false;
@@ -66469,6 +67011,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
66469
67011
  if (shown2) restoreRange(s.it.mesh, s.v0, s.data);
66470
67012
  else s.data = collapseRange(s.it.mesh, s.v0, s.it.v1);
66471
67013
  }
67014
+ if (!shown2) publishStanding(view);
66472
67015
  }
66473
67016
  function flush(budgetMs) {
66474
67017
  if (budgetMs !== void 0 || !cutState.attached) paintCut();
@@ -67435,9 +67978,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67435
67978
  walk(house, void 0);
67436
67979
  return stages;
67437
67980
  }
67438
- function stageOfPiece(piece2, stages) {
67981
+ function stageOfPiece(piece22, stages) {
67439
67982
  let found;
67440
- piece2.root.traverse((o) => {
67983
+ piece22.root.traverse((o) => {
67441
67984
  if (found) return;
67442
67985
  const part = o.userData?.destructionPart;
67443
67986
  if (typeof part === "string") found = stages.get(part);
@@ -67446,20 +67989,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67446
67989
  }
67447
67990
  function stageLoosePieces(pieces, stages, level, opts, held) {
67448
67991
  let hidden = 0;
67449
- for (const piece2 of pieces) {
67450
- const stage2 = stageOfPiece(piece2, stages);
67992
+ for (const piece22 of pieces) {
67993
+ const stage2 = stageOfPiece(piece22, stages);
67451
67994
  if (!stage2) continue;
67452
67995
  const shown2 = stageVisible(stage2, level, opts);
67453
- piece2.root.visible = shown2;
67996
+ piece22.root.visible = shown2;
67454
67997
  if (!shown2) {
67455
67998
  hidden++;
67456
- if (!piece2.held) {
67457
- piece2.held = true;
67458
- held.add(piece2);
67999
+ if (!piece22.held) {
68000
+ piece22.held = true;
68001
+ held.add(piece22);
67459
68002
  }
67460
- } else if (held.has(piece2)) {
67461
- piece2.held = false;
67462
- held.delete(piece2);
68003
+ } else if (held.has(piece22)) {
68004
+ piece22.held = false;
68005
+ held.delete(piece22);
67463
68006
  }
67464
68007
  }
67465
68008
  return hidden;
@@ -67841,7 +68384,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67841
68384
  return { u: P.u - Math.sign(P.frontU || 0) * PANEL_RECESS, v: P.v - Math.sign(P.frontV || 0) * PANEL_RECESS, y0: P.y - h / 2 + PANEL_LIFT - BOX_CHASE_CLEAR, y1: P.y + h / 2 + PANEL_LIFT + BOX_CHASE_CLEAR, radius: w / 2, depth: 0 };
67842
68385
  }
67843
68386
  function installBuildBuild(K, shared3) {
67844
- const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS42, 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, drainPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, pieceRecord, createHouseDestruction, newState, enter, tagDamage } = K;
68387
+ const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS42, 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, walkInInteractive, newInteractiveState, newMirrorState, outbuildings, paths, perimeter, placeSwitches, roofs, roomAt, solar, targetOf, terrain, toggleDoor, toggleLight, walls, waterPipes, drainPipes, windows, props, TYPES, IVK, VEG, vegMaterials, markGroups, assembleStructure, pieceRecord, createHouseDestruction, newState, enter, tagDamage } = K;
67845
68388
  function build(r0, options) {
67846
68389
  const opts = options || {};
67847
68390
  const r = withLaidConduits(applyOutbuildings(r0), !!(opts.constructionStages || opts.constructionLevel != null));
@@ -67988,6 +68531,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
67988
68531
  assembleInteractive(gs);
67989
68532
  linkDoorLeaves();
67990
68533
  mailboxInteractive();
68534
+ walkInInteractive();
67991
68535
  if (cs) {
67992
68536
  for (const def of shared3.inter.defs.values()) {
67993
68537
  if (def.outer && !def.outer.userData.constructionStage) def.outer.userData.constructionStage = /^gate/.test(def.kind) ? "perimeter" : "furniture";
@@ -68678,7 +69222,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68678
69222
  joinBodies(params, byId);
68679
69223
  }
68680
69224
  function holdHanging({ parts: parts2, joints, boxOf: boxOf4 }, byId) {
68681
- const back = Math.min(...parts2.map((part) => boxOf4(part.id).min[2]));
69225
+ const back2 = Math.min(...parts2.map((part) => boxOf4(part.id).min[2]));
68682
69226
  for (let pass = 0; pass < parts2.length; pass++) {
68683
69227
  const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
68684
69228
  const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
@@ -68692,8 +69236,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68692
69236
  changed = true;
68693
69237
  continue;
68694
69238
  }
68695
- const againstWall = held.length === 0 || held.some((part) => boxOf4(part.id).min[2] <= back + AGAINST_WALL);
68696
- const onWall = againstWall ? group.filter((part) => !SOFT.has(part.material) && boxOf4(part.id).min[2] <= back + BACK_TOUCH) : [];
69239
+ const againstWall = held.length === 0 || held.some((part) => boxOf4(part.id).min[2] <= back2 + AGAINST_WALL);
69240
+ const onWall = againstWall ? group.filter((part) => !SOFT.has(part.material) && boxOf4(part.id).min[2] <= back2 + BACK_TOUCH) : [];
68697
69241
  if (onWall.length === 0) continue;
68698
69242
  for (const part of onWall) part.anchored = true;
68699
69243
  changed = true;
@@ -68706,6 +69250,230 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68706
69250
  return;
68707
69251
  }
68708
69252
  }
69253
+ var COVER22 = 6e-3;
69254
+ var SPRING = 3e-3;
69255
+ var SPRING_WIDTH = 0.012;
69256
+ var CLOTH_COVER = [{ material: "fabric", thickness: COVER22, faces: "all" }];
69257
+ function piece2(id, key2, material, min2, max2, color2) {
69258
+ const size = [max2[0] - min2[0], max2[1] - min2[1], max2[2] - min2[2]];
69259
+ const position = [(min2[0] + max2[0]) / 2, (min2[1] + max2[1]) / 2, (min2[2] + max2[2]) / 2];
69260
+ return { id, key: key2, material, shape: { kind: "box", size }, position, rotation: null, color: color2, min: min2, max: max2 };
69261
+ }
69262
+ var bothSides = (x0, x1) => [
69263
+ [x0, x1],
69264
+ [-x1, -x0]
69265
+ ];
69266
+ var SIDE_RAIL = 0.03;
69267
+ var SLAT_TOP = 0.297;
69268
+ var SLAT_THICK = 0.027;
69269
+ var SLAT_WIDTH = 0.07;
69270
+ var SLAT_PITCH = 0.12;
69271
+ var SPRING_STRIPS = 5;
69272
+ function bedParts(drawn) {
69273
+ const [frame2, ...otherWood] = drawn.filter((p) => p.key === "wood");
69274
+ const [mattress, ...bedclothes] = drawn.filter((p) => p.key === "fabric");
69275
+ if (!frame2 || !mattress) return [...drawn];
69276
+ const hw = (frame2.max[0] - frame2.min[0]) / 2;
69277
+ const [z0, z1] = [frame2.min[2], frame2.max[2]];
69278
+ const wood = frame2.color;
69279
+ const out = [...otherWood.map((p, k) => ({ ...p, id: k === 0 ? "bed_headboard" : "bed_footboard" }))];
69280
+ bothSides(hw - SIDE_RAIL, hw).forEach(([x0, x1], k) => out.push(piece2(`bed_side_rail_${k}`, "wood", "wood_hard", [x0, 0, z0], [x1, frame2.max[1], z1], wood)));
69281
+ out.push(piece2("bed_centre_rail", "wood", "wood_soft", [-0.03, 0.2, z0], [0.03, SLAT_TOP - SLAT_THICK, z1], wood));
69282
+ const slats = Math.floor((z1 - z0 - 2 * 0.02 - SLAT_WIDTH) / SLAT_PITCH) + 1;
69283
+ for (let k = 0; k < slats; k++) {
69284
+ const z = z0 + 0.02 + k * SLAT_PITCH;
69285
+ out.push(piece2(`bed_slat_${k}`, "wood", "wood_soft", [-hw + SIDE_RAIL, SLAT_TOP - SLAT_THICK, z], [hw - SIDE_RAIL, SLAT_TOP, z + SLAT_WIDTH], wood));
69286
+ }
69287
+ const span = 2 * (hw - SIDE_RAIL);
69288
+ for (let k = 0; k < SPRING_STRIPS; k++) {
69289
+ const x = -hw + SIDE_RAIL + (k + 1) * span / (SPRING_STRIPS + 1);
69290
+ out.push(piece2(`bed_spring_${k}`, "metal", "spring_steel", [x - SPRING_WIDTH / 2, SLAT_TOP, z0], [x + SPRING_WIDTH / 2, SLAT_TOP + SPRING, z1], 4869200));
69291
+ }
69292
+ out.push({ ...mattress, id: "bed_mattress", material: "foam", layers: CLOTH_COVER });
69293
+ return [...out, ...bedclothes];
69294
+ }
69295
+ var RAIL_HEIGHT = 0.08;
69296
+ var POST = 0.05;
69297
+ var BOARD = 0.05;
69298
+ function base(L, c, seats, plinth) {
69299
+ const { hw, hd, armWidth: aT, postX: px } = L;
69300
+ const ix = hw - aT;
69301
+ const railTop = L.support - 6e-3;
69302
+ const railBottom = railTop - RAIL_HEIGHT;
69303
+ const zFrom = L.backFrame + BOARD;
69304
+ const zTo = L.coverFront - L.railDepth;
69305
+ const out = [];
69306
+ const wood = (id, min2, max2, material = "wood_hard") => out.push(piece2(id, "wood", material, min2, max2, c.wood));
69307
+ if (plinth) {
69308
+ wood("seat_plinth_front", [-hw, 0, hd - 0.06], [hw, L.postFloor, hd]);
69309
+ wood("seat_plinth_back", [-hw, 0, L.rear], [hw, L.postFloor, L.rear + 0.04]);
69310
+ for (const [k, [x0, x1]] of bothSides(hw - 0.04, hw).entries()) wood(`seat_plinth_side_${k}`, [x0, 0, L.rear + 0.04], [x1, L.postFloor, hd - 0.06]);
69311
+ }
69312
+ const upright = (id, x, z, top) => wood(id, [x - POST / 2, L.postFloor, z - POST / 2], [x + POST / 2, top, z + POST / 2]);
69313
+ for (const [k, sx] of [-1, 1].entries()) {
69314
+ upright(`seat_post_front_${k}`, sx * px, L.postFront, railTop);
69315
+ upright(`seat_post_back_${k}`, sx * px, L.postBack, L.stiles === "posts" ? L.armTop - 0.03 : railTop);
69316
+ }
69317
+ wood("seat_rail_front", [-(px - POST / 2), railBottom, zTo], [px - POST / 2, railTop, L.coverFront]);
69318
+ wood("seat_rail_back", [-(px - POST / 2), railBottom, L.backFrame], [px - POST / 2, railTop, zFrom]);
69319
+ for (const [k, [x0, x1]] of bothSides(hw - aT + COVER22, px - POST / 2).entries()) wood(`seat_rail_side_${k}`, [x0, railBottom, zFrom], [x1, railTop, zTo]);
69320
+ for (const seat2 of seats) if (seat2.seam !== void 0) wood(`seat_divider_${out.length}`, [seat2.seam - 0.02, railBottom, zFrom], [seat2.seam + 0.02, railTop, zTo]);
69321
+ for (const [k, seat2] of seats.entries()) {
69322
+ for (const [j, dx] of [-0.12, 0.12].entries()) {
69323
+ const x = seat2.x + dx;
69324
+ out.push(piece2(`seat_spring_${k * 2 + j}`, "metal", "spring_steel", [x - SPRING_WIDTH / 2, railTop, L.backFrame + BOARD / 2], [x + SPRING_WIDTH / 2, railTop + SPRING, L.springEnd], 4869200));
69325
+ }
69326
+ }
69327
+ out.push(piece2("seat_cover_front", "fabric", "fabric", [-ix, L.skirt, L.coverFront], [ix, L.support, L.coverFront + COVER22], c.skirt));
69328
+ if (L.springEnd < L.coverFront - 0.03) out.push(piece2("seat_ledge", "fabric", "fabric", [-ix, railTop, L.springEnd], [ix, L.support, L.coverFront + COVER22], c.skirt));
69329
+ return out;
69330
+ }
69331
+ function back(L, c) {
69332
+ const { hw, armWidth: aT } = L;
69333
+ const ix = hw - aT;
69334
+ const railTop = L.support - 6e-3;
69335
+ const top = L.backTop - COVER22;
69336
+ const zFrame = [L.backFrame, L.backFrame + BOARD];
69337
+ const out = [];
69338
+ if (L.stiles === "rail") {
69339
+ for (const [k, [x0, x1]] of bothSides(ix - POST, ix).entries()) out.push(piece2(`back_stile_${k}`, "wood", "wood_hard", [x0, railTop, zFrame[0]], [x1, top, zFrame[1]], c.wood));
69340
+ out.push(piece2("back_top_rail", "wood", "wood_hard", [-(ix - POST), top - BOARD, zFrame[0]], [ix - POST, top, zFrame[1]], c.wood));
69341
+ }
69342
+ const midX = L.stiles === "rail" ? ix - POST : L.postX - POST / 2;
69343
+ out.push(piece2("back_mid_rail", "wood", "wood_hard", [-midX, 0.5, zFrame[0]], [midX, 0.5 + POST, zFrame[1]], c.wood));
69344
+ if (L.backFrame > L.rear + COVER22 + 0.01) out.push(piece2("back_pad_rear", "fabric", "foam", [-ix, L.skirt, L.rear + COVER22], [ix, top, L.backFrame], c.skirt));
69345
+ out.push(piece2("back_pad", "fabric", "foam", [-ix, L.support, zFrame[1]], [ix, top, L.rear + L.backDepth], c.back));
69346
+ out.push(piece2("back_cover_rear", "fabric", "fabric", [-L.rearHalf, L.skirt, L.rear], [L.rearHalf, L.backTop, L.rear + COVER22], c.skirt));
69347
+ out.push(piece2("back_cover_top", "fabric", "fabric", [-L.rearHalf, top, L.rear + COVER22], [L.rearHalf, L.backTop, L.rear + L.backDepth], c.back));
69348
+ if (L.rearHalf > ix) {
69349
+ for (const [k, [x0, x1]] of bothSides(ix, L.rearHalf).entries()) out.push(piece2(`back_shoulder_${k}`, "fabric", "foam", [x0, L.armTop, L.rear + COVER22], [x1, top, L.rear + L.backDepth], c.back));
69350
+ }
69351
+ return out;
69352
+ }
69353
+ function arms(L, c, boardBack) {
69354
+ const { hw, armWidth: aT, postX: px } = L;
69355
+ const railTop = L.support - 6e-3;
69356
+ const padTop = L.armTop - 0.03;
69357
+ const front = L.armFront;
69358
+ const out = [];
69359
+ const sides = [bothSides(px - POST / 2, px + POST / 2), bothSides(px + POST / 2, hw - COVER22), bothSides(hw - aT + COVER22, px - POST / 2), bothSides(hw - aT + COVER22, hw - COVER22), bothSides(hw - COVER22, hw), bothSides(hw - aT, hw - aT + COVER22)];
69360
+ const [board2, outer, inner, top, coverOuter, coverInner] = sides;
69361
+ for (const k of [0, 1]) {
69362
+ const z0 = L.armBack;
69363
+ out.push(piece2(`arm_board_${k}`, "wood", "wood_hard", [board2[k][0], railTop, boardBack], [board2[k][1], padTop, L.postFront + POST / 2], c.wood));
69364
+ out.push(piece2(`arm_pad_outer_${k}`, "fabric", "foam", [outer[k][0], railTop, z0], [outer[k][1], padTop, front - COVER22], c.arm));
69365
+ out.push(piece2(`arm_pad_inner_${k}`, "fabric", "foam", [inner[k][0], railTop, z0], [inner[k][1], padTop, front - COVER22], c.arm));
69366
+ out.push(piece2(`arm_pad_top_${k}`, "fabric", "foam", [top[k][0], padTop, z0], [top[k][1], L.armTop - COVER22, front - COVER22], c.arm));
69367
+ out.push(piece2(`arm_cover_outer_${k}`, "fabric", "fabric", [coverOuter[k][0], L.armBottom, z0], [coverOuter[k][1], L.armTop, front], c.arm));
69368
+ out.push(piece2(`arm_cover_inner_${k}`, "fabric", "fabric", [coverInner[k][0], L.armBottom, z0], [coverInner[k][1], L.armTop, front], c.arm));
69369
+ out.push(piece2(`arm_cover_top_${k}`, "fabric", "fabric", [top[k][0], L.armTop - COVER22, z0], [top[k][1], L.armTop, front - COVER22], c.arm));
69370
+ out.push(piece2(`arm_cover_front_${k}`, "fabric", "fabric", [top[k][0], L.armBottom, front - COVER22], [top[k][1], L.armTop - COVER22, front], c.arm));
69371
+ if (z0 > L.rear + 0.01) out.push(piece2(`arm_cover_back_${k}`, "fabric", "fabric", [top[k][0], L.armBottom, z0], [top[k][1], L.armTop - COVER22, z0 + COVER22], c.arm));
69372
+ }
69373
+ return out;
69374
+ }
69375
+ function seatStructure(L, c, seats, options) {
69376
+ return [...base(L, c, seats, options.plinth), ...back(L, c), ...arms(L, c, options.boardBack)];
69377
+ }
69378
+ function cushion(block, id) {
69379
+ return { ...block, id, material: "foam", layers: CLOTH_COVER };
69380
+ }
69381
+ var SOFAS = /^sofa_/;
69382
+ var ARMCHAIRS = /^armchair/;
69383
+ var BEDS = /^(double_bed|queen_bed|king_bed|single_bed|mattress)$/;
69384
+ var seatsOf = (cushions) => cushions.map((block, k) => ({ x: block.position[0], ...cushions[k + 1] ? { seam: (block.position[0] + cushions[k + 1].position[0]) / 2 } : {} }));
69385
+ function sofaParts(drawn) {
69386
+ const woods = drawn.filter((p) => p.key === "wood");
69387
+ const cloth2 = drawn.filter((p) => p.key === "fabric");
69388
+ const count = (cloth2.length - 5) / 2;
69389
+ const [skirt, ...rest2] = cloth2;
69390
+ const seatCushions = rest2.slice(0, count);
69391
+ const [back2] = rest2.slice(count, count + 1);
69392
+ const backCushions = rest2.slice(count + 1, 2 * count + 1);
69393
+ const [armLeft, , pillow] = rest2.slice(2 * count + 1);
69394
+ const feet = woods.slice(1);
69395
+ if (!skirt || !back2 || !armLeft || !pillow || feet.length !== 4) return [...drawn];
69396
+ const hd = (armLeft.max[2] - armLeft.min[2]) / 2 + 0.02;
69397
+ const hw = (woods[0].max[0] - woods[0].min[0]) / 2;
69398
+ const frontFoot = Math.max(...feet.map((foot) => foot.position[2]));
69399
+ const backFoot = Math.min(...feet.map((foot) => foot.position[2]));
69400
+ const layout = {
69401
+ hw,
69402
+ hd,
69403
+ rear: -hd,
69404
+ armWidth: armLeft.max[0] - armLeft.min[0],
69405
+ armTop: armLeft.max[1],
69406
+ armBottom: armLeft.min[1],
69407
+ backTop: back2.max[1],
69408
+ backDepth: back2.max[2] - back2.min[2],
69409
+ skirt: skirt.min[1],
69410
+ support: skirt.max[1],
69411
+ postX: Math.abs(feet[0].position[0]),
69412
+ postFront: frontFoot,
69413
+ postBack: backFoot,
69414
+ postFloor: 0,
69415
+ coverFront: skirt.max[2] - COVER22,
69416
+ railDepth: 0.07,
69417
+ springEnd: skirt.max[2] - 0.05,
69418
+ backFrame: backFoot - 0.025,
69419
+ armBack: armLeft.min[2],
69420
+ armFront: armLeft.max[2],
69421
+ rearHalf: hw - (armLeft.max[0] - armLeft.min[0]),
69422
+ stiles: "rail"
69423
+ };
69424
+ const colours = { wood: feet[0].color, skirt: skirt.color, back: back2.color, arm: armLeft.color };
69425
+ const structure = seatStructure(layout, colours, seatsOf(seatCushions), { plinth: false, boardBack: layout.backFrame });
69426
+ const cushions = [...seatCushions.map((block, k) => cushion(block, `seat_cushion_${k}`)), ...backCushions.map((block, k) => cushion(block, `back_cushion_${k}`)), cushion(pillow, "accent_pillow")];
69427
+ return [...structure, ...cushions];
69428
+ }
69429
+ var ARMCHAIR_SUPPORT = 0.28;
69430
+ function armchairParts(drawn) {
69431
+ const plinth = drawn.find((p) => p.key === "wood");
69432
+ const [seat2, back2, armLeft] = drawn.filter((p) => p.key === "fabric");
69433
+ if (!plinth || !seat2 || !back2 || !armLeft) return [...drawn];
69434
+ const [hw, hd] = [(plinth.max[0] - plinth.min[0]) / 2, (plinth.max[2] - plinth.min[2]) / 2];
69435
+ const armWidth = armLeft.max[0] - armLeft.min[0];
69436
+ const rear = back2.min[2];
69437
+ const backFrame = rear + COVER22;
69438
+ const coverFront = hd - 0.04;
69439
+ const layout = {
69440
+ hw,
69441
+ hd,
69442
+ rear,
69443
+ armWidth,
69444
+ armTop: armLeft.max[1],
69445
+ armBottom: armLeft.min[1],
69446
+ backTop: back2.max[1],
69447
+ backDepth: back2.max[2] - rear,
69448
+ skirt: plinth.max[1],
69449
+ support: ARMCHAIR_SUPPORT,
69450
+ postX: hw - 0.07,
69451
+ postFront: hd - 0.065,
69452
+ postBack: backFrame + 0.025,
69453
+ postFloor: plinth.max[1],
69454
+ coverFront,
69455
+ railDepth: 0.05,
69456
+ springEnd: coverFront - 0.02,
69457
+ backFrame,
69458
+ armBack: backFrame,
69459
+ armFront: armLeft.max[2],
69460
+ rearHalf: (back2.max[0] - back2.min[0]) / 2,
69461
+ stiles: "posts"
69462
+ };
69463
+ const colours = { wood: plinth.color, skirt: seat2.color, back: back2.color, arm: armLeft.color };
69464
+ const structure = seatStructure(layout, colours, [{ x: 0 }], { plinth: true, boardBack: backFrame + 0.05 });
69465
+ const ix = hw - armWidth;
69466
+ const seatCushion = { ...seat2, id: "seat_cushion_0", min: [-(ix - 2e-3), ARMCHAIR_SUPPORT, rear + layout.backDepth], max: [ix - 2e-3, seat2.max[1], seat2.max[2]] };
69467
+ const size = [seatCushion.max[0] - seatCushion.min[0], seatCushion.max[1] - seatCushion.min[1], seatCushion.max[2] - seatCushion.min[2]];
69468
+ const position = [0, (seatCushion.min[1] + seatCushion.max[1]) / 2, (seatCushion.min[2] + seatCushion.max[2]) / 2];
69469
+ return [...structure, cushion({ ...seatCushion, shape: { kind: "box", size }, position }, "seat_cushion_0")];
69470
+ }
69471
+ function upholster(drawn, type) {
69472
+ const made2 = SOFAS.test(type) ? sofaParts(drawn) : ARMCHAIRS.test(type) ? armchairParts(drawn) : BEDS.test(type) ? bedParts(drawn) : void 0;
69473
+ if (!made2) return false;
69474
+ drawn.splice(0, drawn.length, ...made2);
69475
+ return true;
69476
+ }
68709
69477
  var WOOD_THIN = 0.035;
68710
69478
  var BOARD_TOP_THICK = 0.07;
68711
69479
  var BOARD_TOP_WIDTH = 0.5;
@@ -68932,6 +69700,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68932
69700
  run(A);
68933
69701
  if (!drawn.length) throw new Error(`game-floorplan-three: the builder of "${name}" drew no box or cylinder`);
68934
69702
  hollowCases(drawn, name);
69703
+ upholster(drawn, name);
68935
69704
  const boardsOf = splitTopsIntoBoards(drawn, materialOf2, Boolean(opts.carcass));
68936
69705
  const parts2 = drawn.map((p) => {
68937
69706
  const thin = Math.min(...p.shape.kind === "box" ? p.shape.size : p.shape.kind === "cylinder" ? [p.shape.radius * 2, p.shape.height] : [p.shape.radius * 2]);
@@ -68944,6 +69713,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68944
69713
  const fill22 = structureFill(material, p.shape);
68945
69714
  if (fill22 < 1) part.fill = Math.round(fill22 * 1e4) / 1e4;
68946
69715
  if (p.rotation) part.rotation = p.rotation;
69716
+ if (p.layers) part.layers = p.layers;
68947
69717
  if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
68948
69718
  if (opts.carcass && LOOSE.has(material)) {
68949
69719
  part.hands = 1;
@@ -68981,7 +69751,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
68981
69751
  let top = null;
68982
69752
  for (const p of drawn) {
68983
69753
  const part = parts2.find((x) => x.id === p.id);
68984
- if (part.shape.kind === "sphere" || part.rotation || part.material === "fabric" || LOOSE.has(part.material)) continue;
69754
+ if (part.shape.kind === "sphere" || part.rotation || part.material === "fabric" || part.material === "foam" || LOOSE.has(part.material)) continue;
68985
69755
  const area3 = (p.max[0] - p.min[0]) * (p.max[2] - p.min[2]);
68986
69756
  if (area3 < 0.6 * footprint || p.max[1] < 0.2) continue;
68987
69757
  if (!top || p.max[1] > top.y + 1e-6) top = { part: p.id, y: p.max[1] };
@@ -73841,31 +74611,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
73841
74611
  const handguardHeight = frames.receiverHeight * 0.8;
73842
74612
  const railTopY = frames.receiverHeight / 2 + (frames.hasRail ? 6e-3 : 0);
73843
74613
  const forendMiddle = (frames.receiverEnd + frames.handguardEnd) / 2;
73844
- const base = { mount, barrelRadius: frames.barrelRadius, receiverWidth: frames.receiverWidth, receiverHeight: frames.receiverHeight, hasRail: frames.hasRail };
74614
+ const base2 = { mount, barrelRadius: frames.barrelRadius, receiverWidth: frames.receiverWidth, receiverHeight: frames.receiverHeight, hasRail: frames.hasRail };
73845
74615
  switch (mount) {
73846
74616
  case "muzzle":
73847
- return { ...base, position: toRoot(frames.length, frames.barrelY, 0), side: 0 };
74617
+ return { ...base2, position: toRoot(frames.length, frames.barrelY, 0), side: 0 };
73848
74618
  case "rail_top":
73849
- return { ...base, position: toRoot((frames.receiverStart + frames.receiverEnd) / 2 + 0.03, railTopY, 0), side: 0 };
74619
+ return { ...base2, position: toRoot((frames.receiverStart + frames.receiverEnd) / 2 + 0.03, railTopY, 0), side: 0 };
73850
74620
  case "rail_bottom":
73851
- return { ...base, position: toRoot(forendMiddle, frames.barrelY - handguardHeight / 2, 0), side: 0 };
74621
+ return { ...base2, position: toRoot(forendMiddle, frames.barrelY - handguardHeight / 2, 0), side: 0 };
73852
74622
  case "rail_left":
73853
- return { ...base, position: toRoot(forendMiddle, frames.barrelY, -(frames.receiverWidth * 0.54 + 4e-3)), side: -1 };
74623
+ return { ...base2, position: toRoot(forendMiddle, frames.barrelY, -(frames.receiverWidth * 0.54 + 4e-3)), side: -1 };
73854
74624
  case "rail_right":
73855
- return { ...base, position: toRoot(forendMiddle, frames.barrelY, frames.receiverWidth * 0.54 + 4e-3), side: 1 };
74625
+ return { ...base2, position: toRoot(forendMiddle, frames.barrelY, frames.receiverWidth * 0.54 + 4e-3), side: 1 };
73856
74626
  case "underbarrel": {
73857
74627
  const [x, y] = frames.underbarrel ?? [frames.receiverEnd + (frames.handguardEnd - frames.receiverEnd) * 0.25, frames.barrelY - handguardHeight / 2 - 0.02];
73858
- return { ...base, position: toRoot(x, y, 0), side: 0 };
74628
+ return { ...base2, position: toRoot(x, y, 0), side: 0 };
73859
74629
  }
73860
74630
  case "magazine":
73861
- return { ...base, position: toRoot(frames.magazineX, -frames.receiverHeight / 2, 0), side: 0 };
74631
+ return { ...base2, position: toRoot(frames.magazineX, -frames.receiverHeight / 2, 0), side: 0 };
73862
74632
  case "feed": {
73863
74633
  const belt = model.parts.belt?.position;
73864
- return { ...base, position: belt ? toRoot(belt.x, belt.y, belt.z) : toRoot(frames.magazineX + 0.02, -frames.receiverHeight / 2 - 0.05, -0.045), side: -1 };
74634
+ return { ...base2, position: belt ? toRoot(belt.x, belt.y, belt.z) : toRoot(frames.magazineX + 0.02, -frames.receiverHeight / 2 - 0.05, -0.045), side: -1 };
73865
74635
  }
73866
74636
  case "sling":
73867
74637
  return {
73868
- ...base,
74638
+ ...base2,
73869
74639
  position: toRoot(frames.receiverEnd + (frames.length - frames.receiverEnd) * 0.45, -frames.receiverHeight / 2 - 0.03, 0),
73870
74640
  secondary: toRoot(0.08, -0.09, 0),
73871
74641
  side: 0
@@ -75947,13 +76717,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
75947
76717
  ];
75948
76718
  }
75949
76719
  function showcasePedestalItem(name) {
75950
- const piece2 = (THREE) => furnitureSpec(THREE, PEDESTAL_FURNITURE, { w: SHOWCASE.size, d: SHOWCASE.size, h: SHOWCASE.height });
76720
+ const piece3 = (THREE) => furnitureSpec(THREE, PEDESTAL_FURNITURE, { w: SHOWCASE.size, d: SHOWCASE.size, h: SHOWCASE.height });
75951
76721
  return {
75952
76722
  id: SHOWCASE_PEDESTAL_ID,
75953
76723
  name,
75954
76724
  build: (lent) => {
75955
76725
  const THREE = lent;
75956
- const built2 = piece2(THREE);
76726
+ const built2 = piece3(THREE);
75957
76727
  const root = built2.build(THREE);
75958
76728
  root.userData.pedestalSpec = { ...built2.spec, name, tags: [...built2.spec.tags ?? [], "furniture"] };
75959
76729
  return root;
@@ -76057,15 +76827,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
76057
76827
  const samples = [];
76058
76828
  const tiersOf = /* @__PURE__ */ new Map();
76059
76829
  for (const sound3 of manifest.sounds) {
76060
- const { base, tier } = splitTier(sound3.id);
76061
- if (tier) tiersOf.set(base, [...tiersOf.get(base) ?? [], sound3]);
76830
+ const { base: base2, tier } = splitTier(sound3.id);
76831
+ if (tier) tiersOf.set(base2, [...tiersOf.get(base2) ?? [], sound3]);
76062
76832
  }
76063
76833
  const bases = /* @__PURE__ */ new Map();
76064
76834
  for (const sound3 of manifest.sounds) {
76065
76835
  if (!splitTier(sound3.id).tier) bases.set(sound3.id, sound3);
76066
76836
  }
76067
- for (const [base, tiers] of tiersOf) {
76068
- if (!bases.has(base)) bases.set(base, { id: base, category: tiers[0]?.category ?? "", layers: { close: tiers[0]?.layers.close ?? [] } });
76837
+ for (const [base2, tiers] of tiersOf) {
76838
+ if (!bases.has(base2)) bases.set(base2, { id: base2, category: tiers[0]?.category ?? "", layers: { close: tiers[0]?.layers.close ?? [] } });
76069
76839
  }
76070
76840
  for (const sound3 of bases.values()) {
76071
76841
  const numbers = options.sounds?.[sound3.id] ?? options.defaults?.(sound3);
@@ -76403,8 +77173,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
76403
77173
  function isPlainObject2(value) {
76404
77174
  return typeof value === "object" && value !== null && !Array.isArray(value);
76405
77175
  }
76406
- function mergeRecords(base, patch) {
76407
- const merged2 = { ...base };
77176
+ function mergeRecords(base2, patch) {
77177
+ const merged2 = { ...base2 };
76408
77178
  for (const [key2, value] of Object.entries(patch)) {
76409
77179
  if (value === void 0) continue;
76410
77180
  const current = merged2[key2];
@@ -76722,7 +77492,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
76722
77492
  const falloffLevel = falloffGain(recipe2.falloff, input.volume ?? 1, distance22);
76723
77493
  const level = occlusion > 0 ? falloffLevel * (1 - OCCLUSION_GAIN * occlusion) : falloffLevel;
76724
77494
  const silent = isSilent(recipe2.falloff, falloffLevel);
76725
- const base = {
77495
+ const base2 = {
76726
77496
  id: recipe2.id,
76727
77497
  bus: recipe2.bus,
76728
77498
  order: order2,
@@ -76732,7 +77502,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
76732
77502
  distance: distance22,
76733
77503
  ...recipe2.pan ? { pan: input.position ? panFor(listener, input.position) : 0 } : {}
76734
77504
  };
76735
- if (silent) return recipe2.keepSilent ? { ...base, silent: true, length: 0, layers: [] } : null;
77505
+ if (silent) return recipe2.keepSilent ? { ...base2, silent: true, length: 0, layers: [] } : null;
76736
77506
  const scope2 = { random: input.random ?? createRng3(1), params: { ...input.params } };
76737
77507
  for (const [name, range3] of Object.entries(recipe2.vars ?? {})) if (scope2.params[name] === void 0) scope2.params[name] = draw(range3, scope2);
76738
77508
  const defaults = {
@@ -76742,7 +77512,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
76742
77512
  };
76743
77513
  const divisor = cutoffDivisor(recipe2.falloff, distance22) / (1 - OCCLUSION_CUTOFF * occlusion);
76744
77514
  const layers = recipe2.layers.flatMap((layer3) => planLayer(layer3, scope2, defaults, order2 !== "layered", level)).map((layer3) => muffle(layer3, divisor));
76745
- return { ...base, silent: false, length: Math.max(0, ...layers.map(layerEnd)), layers };
77515
+ return { ...base2, silent: false, length: Math.max(0, ...layers.map(layerEnd)), layers };
76746
77516
  }
76747
77517
  function fillNoise(random, length2) {
76748
77518
  const samples = new Float32Array(length2);
@@ -80451,7 +81221,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
80451
81221
  var CRACK_CUTOFF = 3e3;
80452
81222
  var CRACK_SECONDS = 0.03;
80453
81223
  var BODY_TO_FREQUENCY = 40;
80454
- var linear = ([base, span], k) => base + span * k;
81224
+ var linear = ([base2, span], k) => base2 + span * k;
80455
81225
  var energyPosition = (energyJ, curve) => Math.min(1, Math.max(0, Math.log10(Math.max(energyJ, curve.floorJ) / curve.floorJ) / curve.spanDecades));
80456
81226
  var energyOfShot = (input) => {
80457
81227
  if (input.energyJ !== void 0) return input.energyJ;
@@ -82214,8 +82984,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
82214
82984
  var isGunshot = (id) => GUNSHOT_SAMPLE_IDS.includes(id);
82215
82985
  function weaponSampleDefaults(sound3, overrides = {}) {
82216
82986
  if (sound3.category !== "armas") return void 0;
82217
- const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : droppedPartDefaults(sound3.id) ?? RELOAD_SAMPLE;
82218
- return { ...base, ...overrides[sound3.id] };
82987
+ const base2 = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : droppedPartDefaults(sound3.id) ?? RELOAD_SAMPLE;
82988
+ return { ...base2, ...overrides[sound3.id] };
82219
82989
  }
82220
82990
  function weaponSampleBank(options) {
82221
82991
  const bank = sampleBankFromManifest(options.manifest, { id: "weapons_three_samples", ...options.url ? {} : { baseUrl: options.baseUrl ?? "" }, defaults: (sound3) => weaponSampleDefaults(sound3, options.sounds) });
@@ -82345,12 +83115,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
82345
83115
  return {
82346
83116
  shot(energyJ, category, extras = {}) {
82347
83117
  if (options.shotModel !== "game") {
82348
- const base = { energyJ, category, ...extras, space: extras.space ?? (extras.indoors ? "indoor" : "outdoor") };
82349
- const profile = computeGunshot(base, options.gunshot).profile;
83118
+ const base2 = { energyJ, category, ...extras, space: extras.space ?? (extras.indoors ? "indoor" : "outdoor") };
83119
+ const profile = computeGunshot(base2, options.gunshot).profile;
82350
83120
  const take = pickTake2(lastTake.get(profile), channel.random);
82351
83121
  lastTake.set(profile, take);
82352
83122
  const pitch = 1 + (channel.random() * 2 - 1) * pitchSpread;
82353
- const shot = computeGunshot({ ...base, take, pitch }, options.gunshot);
83123
+ const shot = computeGunshot({ ...base2, take, pitch }, options.gunshot);
82354
83124
  const recorded = shot.samples.close;
82355
83125
  const sample = shot.audible && sampleReady(recorded);
82356
83126
  const fitted = shot.audible && !sample && fittedReady(recorded);
@@ -82358,20 +83128,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
82358
83128
  const occlusion = Math.min(1, Math.max(0, extras.occlusion ?? 0));
82359
83129
  const handle = channel.play(recorded, {
82360
83130
  volume: (extras.volume ?? 1) * (1 - 0.5 * occlusion),
82361
- environment: base.space === "indoor" ? "indoor" : "outdoor",
83131
+ environment: base2.space === "indoor" ? "indoor" : "outdoor",
82362
83132
  ...extras.position ? { position: [extras.position[0], extras.position[1], extras.position[2]] } : {},
82363
83133
  ...extras.distance === void 0 ? {} : { distance: extras.distance },
82364
83134
  ...shot.delay > 0 ? { delay: shot.delay } : {}
82365
83135
  });
82366
- if (base.space === "indoor") {
83136
+ if (base2.space === "indoor") {
82367
83137
  for (const voice2 of shot.voices) if (voice2.group === "tail") playGunshotVoice(voice2, extras);
82368
83138
  }
82369
83139
  const layers = handle?.kind === "sample" ? handle.plan.layers.map((layer3) => ({ role: layer3.role, take: layer3.take, rate: layer3.rate })) : [];
82370
- options.onGunshot?.(shot, { ...base, take, pitch }, fitted ? { kind: "fitted", id: recorded } : { kind: "sample", id: recorded, layers });
83140
+ options.onGunshot?.(shot, { ...base2, take, pitch }, fitted ? { kind: "fitted", id: recorded } : { kind: "sample", id: recorded, layers });
82371
83141
  return;
82372
83142
  }
82373
83143
  for (const voice2 of shot.voices) playGunshotVoice(voice2, extras);
82374
- if (shot.audible) options.onGunshot?.(shot, { ...base, take, pitch }, { kind: "synth" });
83144
+ if (shot.audible) options.onGunshot?.(shot, { ...base2, take, pitch }, { kind: "synth" });
82375
83145
  return;
82376
83146
  }
82377
83147
  const sound3 = shotSound({ ...extras, energyJ, category });
@@ -83480,8 +84250,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
83480
84250
  const materials = [];
83481
84251
  const M = (color2, tag, options = {}) => {
83482
84252
  const material = new T2.MeshStandardMaterial(Object.assign({ color: color2, roughness: 0.78, metalness: 0 }, options));
83483
- const base = new T2.Color(color2);
83484
- const data = { base, baseRgb: channelsOf(color2), tag, rough: material.roughness };
84253
+ const base2 = new T2.Color(color2);
84254
+ const data = { base: base2, baseRgb: channelsOf(color2), tag, rough: material.roughness };
83485
84255
  material.userData = data;
83486
84256
  materials.push(material);
83487
84257
  return material;
@@ -87082,11 +87852,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87082
87852
  const steel = metal2(6251625);
87083
87853
  const dark = metal2(4080199);
87084
87854
  const arm = (x, y, angle, z) => mesh3(bx(12.65, 1.2, 1.6), steel, [x, y, z], [0, 0, angle]);
87085
- const arms = [3.8, -3.8].flatMap((z) => [arm(-5.9, 2, 0.3217, z), arm(-5.9, -2, -0.3217, z), arm(5.9, 2, -0.3217, z), arm(5.9, -2, 0.3217, z)]);
87855
+ const arms2 = [3.8, -3.8].flatMap((z) => [arm(-5.9, 2, 0.3217, z), arm(-5.9, -2, -0.3217, z), arm(5.9, 2, -0.3217, z), arm(5.9, -2, 0.3217, z)]);
87086
87856
  return G(
87087
87857
  mesh3(bx(8, 1, 11), dark, [0, -5, 0]),
87088
87858
  mesh3(bx(8, 1, 11), dark, [0, 5, 0]),
87089
- ...arms,
87859
+ ...arms2,
87090
87860
  mesh3(cyl(0.6, 0.6, 30, 8), metal2(9277846), [0, 0, 0], [0, 0, Math.PI / 2]),
87091
87861
  mesh3(bx(1.6, 2.4, 3), dark, [-11.8, 0, 0]),
87092
87862
  mesh3(bx(1.6, 2.4, 3), dark, [11.8, 0, 0]),
@@ -87298,12 +88068,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87298
88068
  const rod = (x1, y1, x2, y2, radius) => [cyl(radius, radius, Math.hypot(x2 - x1, y2 - y1), 8), [(x1 + x2) / 2, (y1 + y2) / 2, 0], [0, 0, Math.atan2(-(x2 - x1), y2 - y1)]];
87299
88069
  const frame2 = wood(7031340);
87300
88070
  const band = cloth2(2039583);
87301
- const arms = [-1, 1].map((side) => rod(0, -0.15, side * 0.5675, 0.7, 0.1));
88071
+ const arms2 = [-1, 1].map((side) => rod(0, -0.15, side * 0.5675, 0.7, 0.1));
87302
88072
  const bands = [-1, 1].map((side) => rod(side * 0.5675, 0.7, side * 0.12, 0.25, 0.03));
87303
88073
  return G(
87304
88074
  mesh3(cyl(0.12, 0.1, 0.65, 8), frame2, [0, -0.425, 0]),
87305
88075
  mesh3(cyl(0.126, 0.126, 0.3, 8), cloth2(8007455), [0, -0.5, 0]),
87306
- ...arms.map(([geometry, position, rotation2]) => mesh3(geometry, frame2, [...position], [...rotation2])),
88076
+ ...arms2.map(([geometry, position, rotation2]) => mesh3(geometry, frame2, [...position], [...rotation2])),
87307
88077
  ...bands.map(([geometry, position, rotation2]) => mesh3(geometry, band, [...position], [...rotation2])),
87308
88078
  mesh3(bx(0.26, 0.2, 0.05), cloth2(9067061), [0, 0.2, 0])
87309
88079
  );
@@ -87503,10 +88273,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87503
88273
  const R = Math.PI / 2;
87504
88274
  const pane = glass(12575711, 0.55);
87505
88275
  const deep = glass(8369584, 0.7);
87506
- const base = extrude2([[-0.6, -0.1], [0.45, -0.5], [0.6, 0.2], [-0.1, 0.5]], 0.04, 2e-3);
88276
+ const base2 = extrude2([[-0.6, -0.1], [0.45, -0.5], [0.6, 0.2], [-0.1, 0.5]], 0.04, 2e-3);
87507
88277
  const chip = extrude2([[0, 0], [0.25, 0.05], [0.1, 0.22]], 0.03, 2e-3);
87508
88278
  return G(
87509
- mesh3(base, pane, [0, 0, 0], [R, 0, 0]),
88279
+ mesh3(base2, pane, [0, 0, 0], [R, 0, 0]),
87510
88280
  mesh3(chip, deep, [0.2, 0.03, -0.35], [R, 0, 0.4]),
87511
88281
  mesh3(new T2.ConeGeometry(0.14, 0.46, 3), pane, [-0.2, 0.23, 0.1], [0, 0.3, 0.12]),
87512
88282
  mesh3(new T2.ConeGeometry(0.1, 0.34, 3), deep, [0.25, 0.17, -0.1], [0.15, 0, -0.2]),
@@ -87707,10 +88477,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87707
88477
  );
87708
88478
  };
87709
88479
  var rag = ({ mesh: mesh3, bx, G, cloth: cloth2 }) => {
87710
- const base = cloth2(11028282);
88480
+ const base2 = cloth2(11028282);
87711
88481
  const fringe = cloth2(12877167);
87712
88482
  return G(
87713
- mesh3(bx(2, 0.1, 1.8), base, [0, -0.076, 0]),
88483
+ mesh3(bx(2, 0.1, 1.8), base2, [0, -0.076, 0]),
87714
88484
  mesh3(bx(1.7, 0.09, 1.5), cloth2(10108723), [0.1, 0.02, 0], [0, 0.1, 0]),
87715
88485
  mesh3(bx(1.5, 0.036, 1.2), cloth2(11818826), [0, 0.083, 0]),
87716
88486
  mesh3(bx(0.2, 0.02, 1.7), fringe, [1, -0.076, 0]),
@@ -87794,13 +88564,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
87794
88564
  );
87795
88565
  };
87796
88566
  var armyCamouflageUniform = ({ mesh: mesh3, bx, G, cloth: cloth2 }) => {
87797
- const base = cloth2(5857855);
88567
+ const base2 = cloth2(5857855);
87798
88568
  const dark = cloth2(3554600);
87799
88569
  const tan = cloth2(9076565);
87800
88570
  return G(
87801
- mesh3(bx(0.24, 0.08, 0.32), base, [0, 0.04, 0]),
87802
- mesh3(bx(0.08, 0.07, 0.2), base, [-0.16, 0.035, -0.06]),
87803
- mesh3(bx(0.08, 0.07, 0.2), base, [0.16, 0.035, -0.06]),
88571
+ mesh3(bx(0.24, 0.08, 0.32), base2, [0, 0.04, 0]),
88572
+ mesh3(bx(0.08, 0.07, 0.2), base2, [-0.16, 0.035, -0.06]),
88573
+ mesh3(bx(0.08, 0.07, 0.2), base2, [0.16, 0.035, -0.06]),
87804
88574
  mesh3(bx(0.08, 0.074, 0.024), dark, [-0.16, 0.037, 0.052]),
87805
88575
  mesh3(bx(0.08, 0.074, 0.024), dark, [0.16, 0.037, 0.052]),
87806
88576
  mesh3(bx(0.08, 0.01, 0.045), dark, [-0.04, 0.09, -0.135]),
@@ -90192,10 +90962,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
90192
90962
  var toggleClip = () => composeClip("toggle", [turn(ROOT2, "z", 0, TOGGLE_SECONDS / 2, 0, TOGGLE_TILT), turn(ROOT2, "z", TOGGLE_SECONDS / 2, TOGGLE_SECONDS / 2, TOGGLE_TILT, 0)]);
90193
90963
  function launcherClips(context) {
90194
90964
  if (!context.parts.ugl) return [];
90195
- const { open, loaded, close, end: end3, slide: slide2, back } = LAUNCHER_RELOAD;
90965
+ const { open, loaded, close, end: end3, slide: slide2, back: back2 } = LAUNCHER_RELOAD;
90196
90966
  const reload = composeClip(
90197
90967
  "reload_ugl",
90198
- [move("ugl", "x", open, slide2, 0, LAUNCHER_SLIDE), move("ugl", "x", close, back, LAUNCHER_SLIDE, 0)],
90968
+ [move("ugl", "x", open, slide2, 0, LAUNCHER_SLIDE), move("ugl", "x", close, back2, LAUNCHER_SLIDE, 0)],
90199
90969
  [stage("breech_open", open), stage("round_in", loaded), stage("breech_close", close)],
90200
90970
  end3
90201
90971
  );
@@ -90489,7 +91259,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
90489
91259
  if (!BLOWBACK.has(family) || !parts2[part]) return [misfire];
90490
91260
  const travel = strokeOf(parts2);
90491
91261
  const stopped = Object.entries(FAULT_SLIDE_BACK).map(
90492
- ([fault, back]) => composeClip(`fault_${fault}`, [move(part, "x", 0, 0.025, 0, travel), move(part, "x", 0.025, 0.04, travel, travel * back)], fault === "stovepipe" ? [cue(0.03, "stuck_case")] : [], 0.25)
91262
+ ([fault, back2]) => composeClip(`fault_${fault}`, [move(part, "x", 0, 0.025, 0, travel), move(part, "x", 0.025, 0.04, travel, travel * back2)], fault === "stovepipe" ? [cue(0.03, "stuck_case")] : [], 0.25)
90493
91263
  );
90494
91264
  return [misfire, ...stopped];
90495
91265
  }
@@ -90744,7 +91514,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
90744
91514
  const group = kit.group();
90745
91515
  const spare = kit.group();
90746
91516
  spare.position.set(0, 0, 0.032);
90747
- for (const piece2 of factoryMagazine) spare.add(piece2.clone(true));
91517
+ for (const piece3 of factoryMagazine) spare.add(piece3.clone(true));
90748
91518
  group.add(spare);
90749
91519
  box5(group, 0.05, 0.012, 0.04, M.tape, 0, -0.03, 0.016);
90750
91520
  return { object: group, hangsFrom: "magazine" };
@@ -90882,12 +91652,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
90882
91652
  kit.roundness = null;
90883
91653
  for (let i = 0; i < 3; i++) box5(grip, 6e-3, 0.012, 0.028, M.poly, 1e-3, -length2 * 0.25 - i * 0.02, 0);
90884
91654
  };
90885
- var triggerGuard = (kit, fixed2, back, front, bottom) => {
91655
+ var triggerGuard = (kit, fixed2, back2, front, bottom) => {
90886
91656
  const { M, box: box5 } = kit;
90887
91657
  const drop = 0.03;
90888
- box5(fixed2, front - back, 5e-3, 0.01, M.dark, (back + front) / 2, bottom - drop, 0);
91658
+ box5(fixed2, front - back2, 5e-3, 0.01, M.dark, (back2 + front) / 2, bottom - drop, 0);
90889
91659
  box5(fixed2, 5e-3, drop, 0.01, M.dark, front, bottom - drop / 2, 0);
90890
- box5(fixed2, 5e-3, 0.02, 6e-3, M.metal, back + (front - back) * 0.45, bottom - 0.011, 0, 0.25);
91660
+ box5(fixed2, 5e-3, 0.02, 6e-3, M.metal, back2 + (front - back2) * 0.45, bottom - 0.011, 0, 0.25);
90891
91661
  };
90892
91662
  var m203 = (kit, fixed2) => {
90893
91663
  const { M, box: box5 } = kit;
@@ -91151,14 +91921,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
91151
91921
  const mesh3 = object2;
91152
91922
  if (!mesh3.isMesh) return;
91153
91923
  (_a = mesh3.userData).baseMaterial ?? (_a.baseMaterial = mesh3.material);
91154
- const base = mesh3.userData.baseMaterial;
91924
+ const base2 = mesh3.userData.baseMaterial;
91155
91925
  if (glowing.has(mesh3)) {
91156
91926
  const material = mesh3.material;
91157
91927
  (_b = mesh3.userData).baseColor ?? (_b.baseColor = material.color.clone());
91158
91928
  material.color.copy(paint2 ?? mesh3.userData.baseColor);
91159
91929
  return;
91160
91930
  }
91161
- mesh3.material = replacement?.get(base) ?? base;
91931
+ mesh3.material = replacement?.get(base2) ?? base2;
91162
91932
  });
91163
91933
  }
91164
91934
 
@@ -94818,7 +95588,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
94818
95588
  var ORIGIN = [0, 0, 0];
94819
95589
  var FACING4 = [0, 0, 1];
94820
95590
  var UP11 = [0, 1, 0];
94821
- var grow = (piece2, factor) => [piece2[0] * factor, piece2[1] * factor, piece2[2] * factor];
95591
+ var grow = (piece3, factor) => [piece3[0] * factor, piece3[1] * factor, piece3[2] * factor];
94822
95592
  var debrisTone = (look) => or(variable(DEBRIS_COLOR_VARIABLE), look.debris);
94823
95593
  var dustTone = (look) => or(variable(DUST_COLOR_VARIABLE), look.dust);
94824
95594
  var sparks = (look, count) => look.sparks ? [call2("spark_at", ORIGIN, FACING4, count, 0.9)] : [];
@@ -95136,7 +95906,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
95136
95906
  ]
95137
95907
  };
95138
95908
  var VIEWMODEL_EFFECTS = [MUZZLE_FLASH2, SMOKE_PUFF, BACKBLAST, FLAME_JET];
95139
- var aliasOf = (base, id, changes) => ({ ...base, id, pageId: `vehicle:${id}`, anchor: CAR_ORIGIN2, ...changes });
95909
+ var aliasOf = (base2, id, changes) => ({ ...base2, id, pageId: `vehicle:${id}`, anchor: CAR_ORIGIN2, ...changes });
95140
95910
  var BODYWORK_IMPACT = {
95141
95911
  id: "impact_bodywork",
95142
95912
  pageId: "vehicle:impact_bodywork",
@@ -97870,8 +98640,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97870
98640
  }
97871
98641
  var CELL2 = 0.12;
97872
98642
  var OBSTACLE_BOUNCE = 0.3;
97873
- var radiusOf = (piece2) => Math.max(piece2.sx, piece2.sz) * 0.5;
97874
- var thicknessOf2 = (piece2) => Math.min(piece2.sx, piece2.sy, piece2.sz);
98643
+ var radiusOf = (piece3) => Math.max(piece3.sx, piece3.sz) * 0.5;
98644
+ var thicknessOf2 = (piece3) => Math.min(piece3.sx, piece3.sy, piece3.sz);
97875
98645
  var cellKey2 = (i, k) => (i + 4096) * 8192 + (k + 4096);
97876
98646
  var RestingGrid = class {
97877
98647
  constructor() {
@@ -97882,50 +98652,50 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97882
98652
  }
97883
98653
  rebuild(pieces) {
97884
98654
  this.clear();
97885
- for (const piece2 of pieces) {
97886
- if (!piece2.on || !piece2.rest) continue;
97887
- const key2 = cellKey2(Math.floor(piece2.x / CELL2), Math.floor(piece2.z / CELL2));
98655
+ for (const piece3 of pieces) {
98656
+ if (!piece3.on || !piece3.rest) continue;
98657
+ const key2 = cellKey2(Math.floor(piece3.x / CELL2), Math.floor(piece3.z / CELL2));
97888
98658
  const list2 = this.cells.get(key2);
97889
- if (list2) list2.push(piece2);
97890
- else this.cells.set(key2, [piece2]);
98659
+ if (list2) list2.push(piece3);
98660
+ else this.cells.set(key2, [piece3]);
97891
98661
  }
97892
98662
  }
97893
98663
  /** The height a piece at `piece`'s place lands at on the pieces under it (the top of the highest one it overlaps), or `-Infinity` over none. */
97894
- supportUnder(piece2) {
97895
- const i = Math.floor(piece2.x / CELL2);
97896
- const k = Math.floor(piece2.z / CELL2);
97897
- const reach2 = radiusOf(piece2);
98664
+ supportUnder(piece3) {
98665
+ const i = Math.floor(piece3.x / CELL2);
98666
+ const k = Math.floor(piece3.z / CELL2);
98667
+ const reach2 = radiusOf(piece3);
97898
98668
  let top = -Infinity;
97899
98669
  for (let di = -1; di <= 1; di++) {
97900
98670
  for (let dk = -1; dk <= 1; dk++) {
97901
98671
  for (const other of this.cells.get(cellKey2(i + di, k + dk)) ?? []) {
97902
- if (other === piece2) continue;
97903
- if (Math.hypot(other.x - piece2.x, other.z - piece2.z) > reach2 + radiusOf(other)) continue;
98672
+ if (other === piece3) continue;
98673
+ if (Math.hypot(other.x - piece3.x, other.z - piece3.z) > reach2 + radiusOf(other)) continue;
97904
98674
  const otherTop = other.y + thicknessOf2(other) * 0.5;
97905
- if (otherTop <= piece2.y + thicknessOf2(piece2) * 0.5) top = Math.max(top, otherTop + thicknessOf2(piece2) * 0.5);
98675
+ if (otherTop <= piece3.y + thicknessOf2(piece3) * 0.5) top = Math.max(top, otherTop + thicknessOf2(piece3) * 0.5);
97906
98676
  }
97907
98677
  }
97908
98678
  }
97909
98679
  return top;
97910
98680
  }
97911
98681
  };
97912
- function pushOutOfObstacles(piece2, obstacles) {
98682
+ function pushOutOfObstacles(piece3, obstacles) {
97913
98683
  let moved = false;
97914
98684
  for (const body of obstacles) {
97915
- if (piece2.y < body.bottom || piece2.y > body.top) continue;
97916
- const dx = piece2.x - body.x;
97917
- const dz = piece2.z - body.z;
98685
+ if (piece3.y < body.bottom || piece3.y > body.top) continue;
98686
+ const dx = piece3.x - body.x;
98687
+ const dz = piece3.z - body.z;
97918
98688
  const distance4 = Math.hypot(dx, dz);
97919
- const reach2 = body.radius + radiusOf(piece2);
98689
+ const reach2 = body.radius + radiusOf(piece3);
97920
98690
  if (distance4 >= reach2) continue;
97921
98691
  const nx = distance4 > 1e-6 ? dx / distance4 : 1;
97922
98692
  const nz = distance4 > 1e-6 ? dz / distance4 : 0;
97923
- piece2.x = body.x + nx * reach2;
97924
- piece2.z = body.z + nz * reach2;
97925
- const into = piece2.vx * nx + piece2.vz * nz;
98693
+ piece3.x = body.x + nx * reach2;
98694
+ piece3.z = body.z + nz * reach2;
98695
+ const into = piece3.vx * nx + piece3.vz * nz;
97926
98696
  if (into < 0) {
97927
- piece2.vx -= (1 + OBSTACLE_BOUNCE) * into * nx;
97928
- piece2.vz -= (1 + OBSTACLE_BOUNCE) * into * nz;
98697
+ piece3.vx -= (1 + OBSTACLE_BOUNCE) * into * nx;
98698
+ piece3.vz -= (1 + OBSTACLE_BOUNCE) * into * nz;
97929
98699
  }
97930
98700
  moved = true;
97931
98701
  }
@@ -97955,36 +98725,36 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97955
98725
  }
97956
98726
  spawn(options) {
97957
98727
  const random = this.context.random;
97958
- const piece2 = this.pieces[this.next++ % CAPACITY];
98728
+ const piece3 = this.pieces[this.next++ % CAPACITY];
97959
98729
  coneDirection(random, options.dir, options.cone ?? 3.2, this.direction);
97960
98730
  const speed = drawRange(random, options.sp);
97961
98731
  const size = options.size ?? DEFAULT_SIZE;
97962
98732
  const scale = options.k ? drawRange(random, options.k) : 1;
97963
98733
  const box5 = options.box;
97964
98734
  const spin = options.spin || DEFAULT_SPIN;
97965
- piece2.on = true;
97966
- piece2.x = options.p[0] + (box5 ? random.between(-box5[0], box5[0]) : 0);
97967
- piece2.y = options.p[1] + (box5 ? random.between(-box5[1], box5[1]) : 0);
97968
- piece2.z = options.p[2] + (box5 ? random.between(-box5[2], box5[2]) : 0);
97969
- piece2.vx = this.direction.x * speed + (options.v ? options.v[0] : 0);
97970
- piece2.vy = this.direction.y * speed + (options.v ? options.v[1] : 0);
97971
- piece2.vz = this.direction.z * speed + (options.v ? options.v[2] : 0);
97972
- piece2.sx = size[0] * scale;
97973
- piece2.sy = size[1] * scale;
97974
- piece2.sz = size[2] * scale;
97975
- piece2.rx = random.between(0, FULL_TURN_DRAWN3);
97976
- piece2.ry = random.between(0, FULL_TURN_DRAWN3);
97977
- piece2.rz = random.between(0, FULL_TURN_DRAWN3);
97978
- piece2.ax = random.between(-1, 1) * spin;
97979
- piece2.ay = random.between(-1, 1) * spin;
97980
- piece2.az = random.between(-1, 1) * spin;
97981
- piece2.life = options.life || DEFAULT_LIFE;
97982
- piece2.bounce = options.bounce ?? DEFAULT_BOUNCE;
97983
- piece2.rest = false;
97984
- piece2.color = options.c ?? DEFAULT_COLOR32;
98735
+ piece3.on = true;
98736
+ piece3.x = options.p[0] + (box5 ? random.between(-box5[0], box5[0]) : 0);
98737
+ piece3.y = options.p[1] + (box5 ? random.between(-box5[1], box5[1]) : 0);
98738
+ piece3.z = options.p[2] + (box5 ? random.between(-box5[2], box5[2]) : 0);
98739
+ piece3.vx = this.direction.x * speed + (options.v ? options.v[0] : 0);
98740
+ piece3.vy = this.direction.y * speed + (options.v ? options.v[1] : 0);
98741
+ piece3.vz = this.direction.z * speed + (options.v ? options.v[2] : 0);
98742
+ piece3.sx = size[0] * scale;
98743
+ piece3.sy = size[1] * scale;
98744
+ piece3.sz = size[2] * scale;
98745
+ piece3.rx = random.between(0, FULL_TURN_DRAWN3);
98746
+ piece3.ry = random.between(0, FULL_TURN_DRAWN3);
98747
+ piece3.rz = random.between(0, FULL_TURN_DRAWN3);
98748
+ piece3.ax = random.between(-1, 1) * spin;
98749
+ piece3.ay = random.between(-1, 1) * spin;
98750
+ piece3.az = random.between(-1, 1) * spin;
98751
+ piece3.life = options.life || DEFAULT_LIFE;
98752
+ piece3.bounce = options.bounce ?? DEFAULT_BOUNCE;
98753
+ piece3.rest = false;
98754
+ piece3.color = options.c ?? DEFAULT_COLOR32;
97985
98755
  }
97986
98756
  clear() {
97987
- for (const piece2 of this.pieces) piece2.on = false;
98757
+ for (const piece3 of this.pieces) piece3.on = false;
97988
98758
  this.count = 0;
97989
98759
  }
97990
98760
  update(dt) {
@@ -97992,46 +98762,46 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
97992
98762
  const contacts = this.context.debrisContacts;
97993
98763
  const obstacles = contacts?.obstacles() ?? [];
97994
98764
  let moving = false;
97995
- for (const piece2 of this.pieces) {
97996
- if (!piece2.on) continue;
97997
- piece2.life -= dt;
97998
- if (piece2.life <= 0) piece2.on = false;
97999
- else if (!piece2.rest) moving = true;
98765
+ for (const piece3 of this.pieces) {
98766
+ if (!piece3.on) continue;
98767
+ piece3.life -= dt;
98768
+ if (piece3.life <= 0) piece3.on = false;
98769
+ else if (!piece3.rest) moving = true;
98000
98770
  }
98001
98771
  if (moving && contacts) this.resting.rebuild(this.pieces);
98002
98772
  else this.resting.clear();
98003
- for (const piece2 of this.pieces) {
98004
- if (!piece2.on) continue;
98773
+ for (const piece3 of this.pieces) {
98774
+ if (!piece3.on) continue;
98005
98775
  this.count++;
98006
- if (obstacles.length > 0 && pushOutOfObstacles(piece2, obstacles)) piece2.rest = false;
98007
- if (!piece2.rest) this.move(piece2, dt);
98776
+ if (obstacles.length > 0 && pushOutOfObstacles(piece3, obstacles)) piece3.rest = false;
98777
+ if (!piece3.rest) this.move(piece3, dt);
98008
98778
  }
98009
98779
  }
98010
98780
  /** Scale at the end of its life, 1 until the last half second (the renderer's `sh`). */
98011
- static fade(piece2) {
98012
- return Math.min(1, piece2.life / FADE_SECONDS);
98013
- }
98014
- move(piece2, dt) {
98015
- piece2.vy -= GRAVITY22 * dt;
98016
- piece2.x += piece2.vx * dt;
98017
- piece2.y += piece2.vy * dt;
98018
- piece2.z += piece2.vz * dt;
98019
- piece2.rx += piece2.ax * dt;
98020
- piece2.ry += piece2.ay * dt;
98021
- piece2.rz += piece2.az * dt;
98022
- const groundHeight = Math.max(this.context.groundAt(piece2.x, piece2.z) + Math.min(piece2.sx, piece2.sy, piece2.sz) * 0.5, this.resting.supportUnder(piece2));
98023
- if (piece2.y >= groundHeight) return;
98024
- piece2.y = groundHeight;
98025
- piece2.vy *= -piece2.bounce;
98026
- piece2.vx *= 0.55;
98027
- piece2.vz *= 0.55;
98028
- piece2.ax *= 0.5;
98029
- piece2.ay *= 0.5;
98030
- piece2.az *= 0.5;
98031
- if (Math.abs(piece2.vy) < 0.5 && Math.hypot(piece2.vx, piece2.vz) < 0.3) {
98032
- piece2.rest = true;
98033
- piece2.rx = Math.round(piece2.rx / QUARTER_TURN4) * QUARTER_TURN4;
98034
- piece2.rz = Math.round(piece2.rz / QUARTER_TURN4) * QUARTER_TURN4;
98781
+ static fade(piece3) {
98782
+ return Math.min(1, piece3.life / FADE_SECONDS);
98783
+ }
98784
+ move(piece3, dt) {
98785
+ piece3.vy -= GRAVITY22 * dt;
98786
+ piece3.x += piece3.vx * dt;
98787
+ piece3.y += piece3.vy * dt;
98788
+ piece3.z += piece3.vz * dt;
98789
+ piece3.rx += piece3.ax * dt;
98790
+ piece3.ry += piece3.ay * dt;
98791
+ piece3.rz += piece3.az * dt;
98792
+ const groundHeight = Math.max(this.context.groundAt(piece3.x, piece3.z) + Math.min(piece3.sx, piece3.sy, piece3.sz) * 0.5, this.resting.supportUnder(piece3));
98793
+ if (piece3.y >= groundHeight) return;
98794
+ piece3.y = groundHeight;
98795
+ piece3.vy *= -piece3.bounce;
98796
+ piece3.vx *= 0.55;
98797
+ piece3.vz *= 0.55;
98798
+ piece3.ax *= 0.5;
98799
+ piece3.ay *= 0.5;
98800
+ piece3.az *= 0.5;
98801
+ if (Math.abs(piece3.vy) < 0.5 && Math.hypot(piece3.vx, piece3.vz) < 0.3) {
98802
+ piece3.rest = true;
98803
+ piece3.rx = Math.round(piece3.rx / QUARTER_TURN4) * QUARTER_TURN4;
98804
+ piece3.rz = Math.round(piece3.rz / QUARTER_TURN4) * QUARTER_TURN4;
98035
98805
  }
98036
98806
  }
98037
98807
  };
@@ -98989,9 +99759,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
98989
99759
  peekWorkshop: () => engine,
98990
99760
  effectIds: () => "volumetric_fire" in effects ? Object.keys(effects) : [...Object.keys(effects), "volumetric_fire"],
98991
99761
  explosion(id, point, explosionOptions = {}) {
98992
- const base = definitionOf(id);
98993
- if (!base) return null;
98994
- const def = scaleDefinition(base, explosionOptions.scale ?? 1);
99762
+ const base2 = definitionOf(id);
99763
+ if (!base2) return null;
99764
+ const def = scaleDefinition(base2, explosionOptions.scale ?? 1);
98995
99765
  const handle = ++handles.next;
98996
99766
  const direction = explosionOptions.direction && { x: explosionOptions.direction[0], y: explosionOptions.direction[1], z: explosionOptions.direction[2] };
98997
99767
  const random = streamOf(explosionOptions.seed);
@@ -100192,8 +100962,8 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
100192
100962
  var REST_TRIES = 8;
100193
100963
  var SAME_NORMAL = 0.9995;
100194
100964
  var restBox = () => ({ c: new Float64Array(3), axes: new Float64Array(9), half: new Float64Array(3), ext: new Float64Array(3) });
100195
- function boxOf3(piece2, out) {
100196
- const cx = Math.cos(piece2.rx), sx = Math.sin(piece2.rx), cy = Math.cos(piece2.ry), sy = Math.sin(piece2.ry), cz = Math.cos(piece2.rz), sz = Math.sin(piece2.rz);
100965
+ function boxOf3(piece3, out) {
100966
+ const cx = Math.cos(piece3.rx), sx = Math.sin(piece3.rx), cy = Math.cos(piece3.ry), sy = Math.sin(piece3.ry), cz = Math.cos(piece3.rz), sz = Math.sin(piece3.rz);
100197
100967
  const a = out.axes;
100198
100968
  a[0] = cy * cz;
100199
100969
  a[1] = sx * sy * cz + cx * sz;
@@ -100204,12 +100974,12 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
100204
100974
  a[6] = sy;
100205
100975
  a[7] = -sx * cy;
100206
100976
  a[8] = cx * cy;
100207
- out.half[0] = piece2.sx / 2;
100208
- out.half[1] = piece2.sy / 2;
100209
- out.half[2] = piece2.sz / 2;
100210
- out.c[0] = piece2.x;
100211
- out.c[1] = piece2.y;
100212
- out.c[2] = piece2.z;
100977
+ out.half[0] = piece3.sx / 2;
100978
+ out.half[1] = piece3.sy / 2;
100979
+ out.half[2] = piece3.sz / 2;
100980
+ out.c[0] = piece3.x;
100981
+ out.c[1] = piece3.y;
100982
+ out.c[2] = piece3.z;
100213
100983
  for (let w = 0; w < 3; w++) out.ext[w] = Math.abs(a[w]) * out.half[0] + Math.abs(a[3 + w]) * out.half[1] + Math.abs(a[6 + w]) * out.half[2];
100214
100984
  }
100215
100985
  function sharedPlane(a, b, push) {
@@ -100281,21 +101051,21 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
100281
101051
  sync() {
100282
101052
  let drawn = false;
100283
101053
  for (let index = 0; index < DEBRIS_CAPACITY; index++) {
100284
- const piece2 = pool.pieces[index];
100285
- if (!piece2.on || !piece2.rest) settled[index] = 0;
100286
- if (!piece2.on) {
101054
+ const piece3 = pool.pieces[index];
101055
+ if (!piece3.on || !piece3.rest) settled[index] = 0;
101056
+ if (!piece3.on) {
100287
101057
  mesh3.setMatrixAt(index, hidden);
100288
101058
  continue;
100289
101059
  }
100290
- if (piece2.rest && !settled[index]) settle(index);
101060
+ if (piece3.rest && !settled[index]) settle(index);
100291
101061
  drawn = true;
100292
- const shrink = Math.min(1, piece2.life / FADE_SECONDS2);
100293
- euler.set(piece2.rx, piece2.ry, piece2.rz);
101062
+ const shrink = Math.min(1, piece3.life / FADE_SECONDS2);
101063
+ euler.set(piece3.rx, piece3.ry, piece3.rz);
100294
101064
  quaternion2.setFromEuler(euler);
100295
- const off = piece2.rest ? 3 * index : -1;
100296
- matrix.compose(position.set(piece2.x + (off >= 0 ? offset[off] : 0), piece2.y + (off >= 0 ? offset[off + 1] : 0), piece2.z + (off >= 0 ? offset[off + 2] : 0)), quaternion2, scale.set(piece2.sx * shrink, piece2.sy * shrink, piece2.sz * shrink));
101065
+ const off = piece3.rest ? 3 * index : -1;
101066
+ matrix.compose(position.set(piece3.x + (off >= 0 ? offset[off] : 0), piece3.y + (off >= 0 ? offset[off + 1] : 0), piece3.z + (off >= 0 ? offset[off + 2] : 0)), quaternion2, scale.set(piece3.sx * shrink, piece3.sy * shrink, piece3.sz * shrink));
100297
101067
  mesh3.setMatrixAt(index, matrix);
100298
- mesh3.setColorAt(index, colour.setHex(piece2.color));
101068
+ mesh3.setColorAt(index, colour.setHex(piece3.color));
100299
101069
  }
100300
101070
  mesh3.instanceMatrix.needsUpdate = true;
100301
101071
  if (mesh3.instanceColor) mesh3.instanceColor.needsUpdate = true;
@@ -100710,12 +101480,12 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
100710
101480
  if (reducedMotion || !(shake > SHAKE_FLOOR)) return () => {
100711
101481
  };
100712
101482
  const camera2 = options.camera;
100713
- const base = camera2.position.clone();
101483
+ const base2 = camera2.position.clone();
100714
101484
  const reach2 = shake * SHAKE_REACH;
100715
101485
  camera2.position.x += Math.sin(clock * 71) * reach2;
100716
101486
  camera2.position.y += Math.sin(clock * 53 + 1) * reach2 * 0.7;
100717
101487
  camera2.position.z += Math.sin(clock * 67 + 2) * reach2;
100718
- return () => camera2.position.copy(base);
101488
+ return () => camera2.position.copy(base2);
100719
101489
  },
100720
101490
  stats() {
100721
101491
  const { lastBlast, ...counters } = world.stats();
@@ -101183,12 +101953,12 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
101183
101953
  const rest2 = /* @__PURE__ */ new Map();
101184
101954
  for (const part of [...registry.values(), model.root]) rest2.set(part, { position: part.position.clone(), rotation: part.rotation.clone() });
101185
101955
  const apply = (object2, pose2) => {
101186
- const base = rest2.get(object2);
101187
- if (!base) return;
101956
+ const base2 = rest2.get(object2);
101957
+ if (!base2) return;
101188
101958
  const [dx, dy, dz] = pose2.position ?? [0, 0, 0];
101189
101959
  const [rx, ry, rz] = pose2.rotation ?? [0, 0, 0];
101190
- object2.position.set(base.position.x + dx, base.position.y + dy, base.position.z + dz);
101191
- object2.rotation.set(base.rotation.x + rx, base.rotation.y + ry, base.rotation.z + rz);
101960
+ object2.position.set(base2.position.x + dx, base2.position.y + dy, base2.position.z + dz);
101961
+ object2.rotation.set(base2.rotation.x + rx, base2.rotation.y + ry, base2.rotation.z + rz);
101192
101962
  };
101193
101963
  return {
101194
101964
  setPartPose(partId, pose2) {
@@ -102656,11 +103426,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
102656
103426
  const quaternion2 = hand.quaternion.clone().multiply(rig.grip.quaternion.clone().invert());
102657
103427
  return { position: hand.position.clone().sub(rig.grip.position.clone().applyQuaternion(quaternion2)), quaternion: quaternion2 };
102658
103428
  };
102659
- const relativeTo = (frame2, base) => {
102660
- const inverse = base.quaternion.clone().invert();
102661
- return { position: frame2.position.clone().sub(base.position).applyQuaternion(inverse), quaternion: inverse.multiply(frame2.quaternion) };
103429
+ const relativeTo = (frame2, base2) => {
103430
+ const inverse = base2.quaternion.clone().invert();
103431
+ return { position: frame2.position.clone().sub(base2.position).applyQuaternion(inverse), quaternion: inverse.multiply(frame2.quaternion) };
102662
103432
  };
102663
- const inFrame = (local2, base) => ({ position: local2.position.clone().applyQuaternion(base.quaternion).add(base.position), quaternion: base.quaternion.clone().multiply(local2.quaternion) });
103433
+ const inFrame = (local2, base2) => ({ position: local2.position.clone().applyQuaternion(base2.quaternion).add(base2.position), quaternion: base2.quaternion.clone().multiply(local2.quaternion) });
102664
103434
  const holdFrame = () => {
102665
103435
  const pose2 = options.holdFrame?.();
102666
103436
  return pose2 ? frameOf2(pose2) : null;
@@ -102673,8 +103443,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
102673
103443
  return { position: start.position.clone().addScaledVector(ahead, HOLSTER_TOSS.ahead).add(new THREE.Vector3(0, -HOLSTER_TOSS.drop, 0)), quaternion: turn2.multiply(start.quaternion.clone()) };
102674
103444
  }
102675
103445
  if (entry2.motion?.kind === "back") {
102676
- const base = holdFrame();
102677
- return base && entry2.taken ? inFrame(entry2.taken, base) : null;
103446
+ const base2 = holdFrame();
103447
+ return base2 && entry2.taken ? inFrame(entry2.taken, base2) : null;
102678
103448
  }
102679
103449
  const pose2 = options.bodySlot(entry2.slot);
102680
103450
  if (!pose2) return null;
@@ -102754,8 +103524,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
102754
103524
  const entry2 = { weapon: event.weapon, slot: event.slot, rig, motion: null, taken: null, swing: event.slot === "sling" ? createSlingSwing() : null, last: null, speed: new THREE.Vector3(), lean: 0 };
102755
103525
  if (event.from && seconds > 0) {
102756
103526
  const start = holderOnHand(rig, frameOf2(event.from));
102757
- const base = holdFrame();
102758
- entry2.taken = base ? relativeTo(start, base) : null;
103527
+ const base2 = holdFrame();
103528
+ entry2.taken = base2 ? relativeTo(start, base2) : null;
102759
103529
  entry2.motion = { kind: event.slot === GROUND_SLOT ? "toss" : "away", time: 0, seconds, start };
102760
103530
  } else if (event.slot === GROUND_SLOT) return;
102761
103531
  away.set(event.weapon, entry2);
@@ -103639,9 +104409,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
103639
104409
  return entry2?.source === "commons" && entry2.author && entry2.license ? `${entry2.author}, ${entry2.license}` : void 0;
103640
104410
  }
103641
104411
  var DEFAULT_THUMBNAIL_BASE = "weapon-svg/";
103642
- function weaponThumbnailUrl(id, base = DEFAULT_THUMBNAIL_BASE) {
104412
+ function weaponThumbnailUrl(id, base2 = DEFAULT_THUMBNAIL_BASE) {
103643
104413
  const entry2 = WEAPON_THUMBNAILS[id];
103644
- return entry2 ? `${base}${entry2.file}` : void 0;
104414
+ return entry2 ? `${base2}${entry2.file}` : void 0;
103645
104415
  }
103646
104416
 
103647
104417
  // src/world-explosives.ts
@@ -104007,9 +104777,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
104007
104777
  id: COUNTER_ITEM_ID,
104008
104778
  name,
104009
104779
  build: (THREE) => {
104010
- const piece2 = counter(THREE);
104011
- const root = piece2.build(THREE);
104012
- root.userData.counterSpec = { ...piece2.spec, name, tags: [...piece2.spec.tags ?? [], "furniture"] };
104780
+ const piece3 = counter(THREE);
104781
+ const root = piece3.build(THREE);
104782
+ root.userData.counterSpec = { ...piece3.spec, name, tags: [...piece3.spec.tags ?? [], "furniture"] };
104013
104783
  return root;
104014
104784
  },
104015
104785
  spec: (root) => root.userData.counterSpec,
@@ -104878,8 +105648,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
104878
105648
  if (!needRoom() || !room) return false;
104879
105649
  const vessel = withVessel();
104880
105650
  if (!vessel) return false;
104881
- const base = vessel.root.getWorldPosition(new (T2()).Vector3());
104882
- const point = [base.x + FIRE_OFFSET[0], base.y + FIRE_OFFSET[1], base.z + FIRE_OFFSET[2]];
105651
+ const base2 = vessel.root.getWorldPosition(new (T2()).Vector3());
105652
+ const point = [base2.x + FIRE_OFFSET[0], base2.y + FIRE_OFFSET[1], base2.z + FIRE_OFFSET[2]];
104883
105653
  const config = def.fire ?? { temperature: 700, radius: 1.4, seconds: 7 };
104884
105654
  vessel.firePoint = point;
104885
105655
  vessel.fireUntil = now() + config.seconds + 3;
@@ -105348,7 +106118,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
105348
106118
  area: () => {
105349
106119
  bench.areaOpened();
105350
106120
  const placements = [
105351
- ...scene.furniture.map((piece2) => ({ item: piece2.item, position: piece2.at, ...piece2.rotationY === void 0 ? {} : { rotationY: piece2.rotationY } })),
106121
+ ...scene.furniture.map((piece3) => ({ item: piece3.item, position: piece3.at, ...piece3.rotationY === void 0 ? {} : { rotationY: piece3.rotationY } })),
105352
106122
  { item: `${WORLD_EXPLOSIVE_PREFIX}${EXPLOSIVE_ID}`, position: scene.cylinder },
105353
106123
  // facing the cylinder (the front of an item looks to +z, the cylinder is at -z)
105354
106124
  { item: scene.zombie.item, position: scene.zombie.at, rotationY: Math.PI },