@adatechnology/game-items-three 0.10.4 → 0.10.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.
- package/dist/index.global.js +210 -55
- package/dist/index.global.js.map +1 -1
- package/package.json +13 -13
package/dist/index.global.js
CHANGED
|
@@ -19891,6 +19891,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19891
19891
|
return reach2;
|
|
19892
19892
|
};
|
|
19893
19893
|
let blastTntPerJoule = TNT_PER_JOULE;
|
|
19894
|
+
let blastHasCharge = false;
|
|
19894
19895
|
let blastFireball = chargeFireball(0);
|
|
19895
19896
|
const burstFuel = (p) => {
|
|
19896
19897
|
const c = p.spec.contains;
|
|
@@ -19995,7 +19996,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19995
19996
|
}
|
|
19996
19997
|
for (const im of [...impls.values()]) {
|
|
19997
19998
|
if (!implInRange(im, point, radius)) continue;
|
|
19998
|
-
out.push(implHit(im, { type: "explosive", point, energy, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...src !== void 0 ? { source: src } : {} }));
|
|
19999
|
+
out.push(implHit(im, { type: "explosive", point, energy, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule, ...blastHasCharge ? { hasCharge: true } : {}, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...src !== void 0 ? { source: src } : {} }));
|
|
19999
20000
|
yield "part";
|
|
20000
20001
|
}
|
|
20001
20002
|
return out;
|
|
@@ -20120,7 +20121,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20120
20121
|
den += f;
|
|
20121
20122
|
}
|
|
20122
20123
|
const k = den > 0 ? num2 / den : 1;
|
|
20123
|
-
const res = implHit(im, { type: "explosive", point, energy: E * k, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule * k, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...shelter ? { shelter: k } : {}, ...src !== void 0 ? { source: src } : {} });
|
|
20124
|
+
const res = implHit(im, { type: "explosive", point, energy: E * k, radius, fireball: blastFireball, tnt: energy * blastTntPerJoule * k, ...blastHasCharge ? { hasCharge: true } : {}, ...lethal !== void 0 ? { lethalRadius: lethal } : {}, ...shelter ? { shelter: k } : {}, ...src !== void 0 ? { source: src } : {} });
|
|
20124
20125
|
results.set(im, res);
|
|
20125
20126
|
report(im).shelter = k;
|
|
20126
20127
|
}
|
|
@@ -20462,13 +20463,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20462
20463
|
const fireball = charge?.fuel ? fuelFireball(charge.fuel) : chargeFireball(energy * tntPerJoule);
|
|
20463
20464
|
const inBlast = (fn) => {
|
|
20464
20465
|
const outer = blastTntPerJoule;
|
|
20466
|
+
const outerHasCharge = blastHasCharge;
|
|
20465
20467
|
const outerFireball = blastFireball;
|
|
20466
20468
|
blastTntPerJoule = tntPerJoule;
|
|
20469
|
+
blastHasCharge = charge?.tnt !== void 0;
|
|
20467
20470
|
blastFireball = fireball;
|
|
20468
20471
|
try {
|
|
20469
20472
|
return fn();
|
|
20470
20473
|
} finally {
|
|
20471
20474
|
blastTntPerJoule = outer;
|
|
20475
|
+
blastHasCharge = outerHasCharge;
|
|
20472
20476
|
blastFireball = outerFireball;
|
|
20473
20477
|
}
|
|
20474
20478
|
};
|
|
@@ -46651,7 +46655,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46651
46655
|
}
|
|
46652
46656
|
var residentialTower = residentialTowerTemplate();
|
|
46653
46657
|
|
|
46654
|
-
// ../game-floorplan-three/dist/chunk-
|
|
46658
|
+
// ../game-floorplan-three/dist/chunk-EYIWURKO.js
|
|
46655
46659
|
var __defProp3 = Object.defineProperty;
|
|
46656
46660
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
46657
46661
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -48699,7 +48703,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48699
48703
|
}
|
|
48700
48704
|
function paths() {
|
|
48701
48705
|
const lt = shared2.ctx.r.lot;
|
|
48702
|
-
if (!lt || !lt.paths) return;
|
|
48706
|
+
if (!lt || !lt.paths || shared2.ctx.noGroundSurfaces) return;
|
|
48703
48707
|
cursor.group = "lot";
|
|
48704
48708
|
for (const c of lt.paths) {
|
|
48705
48709
|
if (c.type === "vehicle" && c.id !== "cargo_path") continue;
|
|
@@ -49993,6 +49997,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49993
49997
|
__publicField(this, "positions", []);
|
|
49994
49998
|
__publicField(this, "normals", []);
|
|
49995
49999
|
__publicField(this, "indices", []);
|
|
50000
|
+
__publicField(this, "ranges", []);
|
|
50001
|
+
}
|
|
50002
|
+
/** What is added from here on, up to the next call, is the piece `id` (null: no piece). */
|
|
50003
|
+
piece(id) {
|
|
50004
|
+
const v = this.positions.length / 3, i = this.indices.length;
|
|
50005
|
+
const last = this.ranges[this.ranges.length - 1];
|
|
50006
|
+
if (last && last.v1 < 0) {
|
|
50007
|
+
last.v1 = v;
|
|
50008
|
+
last.i1 = i;
|
|
50009
|
+
if (last.v1 === last.v0) this.ranges.pop();
|
|
50010
|
+
}
|
|
50011
|
+
if (id !== null) this.ranges.push({ id, v0: v, v1: -1, i0: i, i1: -1 });
|
|
49996
50012
|
}
|
|
49997
50013
|
get count() {
|
|
49998
50014
|
return this.indices.length / 36;
|
|
@@ -50013,12 +50029,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50013
50029
|
}
|
|
50014
50030
|
/**
|
|
50015
50031
|
* A six-faced solid from its eight corners: four at the start (in turn around the section) and the same four at the end, for a timber laid on a slope. Each
|
|
50016
|
-
* face is wound to look out of the solid.
|
|
50032
|
+
* face is wound to look out of the solid. `open`: the start or end face is left out (a stretch of a timber cut into pieces, against the next one).
|
|
50017
50033
|
*/
|
|
50018
|
-
addHexahedron(corners) {
|
|
50034
|
+
addHexahedron(corners, open = {}) {
|
|
50019
50035
|
if (corners.length !== 8) return;
|
|
50020
50036
|
const centre = [0, 1, 2].map((k) => corners.reduce((sum, c) => sum + c[k], 0) / 8);
|
|
50021
50037
|
for (const quad of HEXAHEDRON_FACES) {
|
|
50038
|
+
if (open.start && quad === HEXAHEDRON_FACES[0] || open.end && quad === HEXAHEDRON_FACES[1]) continue;
|
|
50022
50039
|
const a = corners[quad[0]], b = corners[quad[1]], c = corners[quad[2]], d = corners[quad[3]];
|
|
50023
50040
|
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]];
|
|
50024
50041
|
let n = [e1[1] * e2[2] - e1[2] * e2[1], e1[2] * e2[0] - e1[0] * e2[2], e1[0] * e2[1] - e1[1] * e2[0]];
|
|
@@ -50053,6 +50070,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50053
50070
|
/** The mesh of everything added, or null when nothing was. */
|
|
50054
50071
|
mesh(THREE, material, name) {
|
|
50055
50072
|
if (!this.indices.length) return null;
|
|
50073
|
+
this.piece(null);
|
|
50056
50074
|
const geometry = new THREE.BufferGeometry();
|
|
50057
50075
|
geometry.setAttribute("position", new THREE.Float32BufferAttribute(this.positions, 3));
|
|
50058
50076
|
geometry.setAttribute("normal", new THREE.Float32BufferAttribute(this.normals, 3));
|
|
@@ -50063,6 +50081,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50063
50081
|
mesh2.name = name;
|
|
50064
50082
|
mesh2.castShadow = true;
|
|
50065
50083
|
mesh2.receiveShadow = true;
|
|
50084
|
+
if (this.ranges.length) mesh2.userData.ranges = this.ranges.map((range2) => ({ ...range2 }));
|
|
50066
50085
|
return mesh2;
|
|
50067
50086
|
}
|
|
50068
50087
|
};
|
|
@@ -50071,7 +50090,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50071
50090
|
var FEED_Y = -0.6;
|
|
50072
50091
|
var FEED_EXIT_Y = -0.15;
|
|
50073
50092
|
var FEED_BOX_OFFSET = 0.25;
|
|
50074
|
-
|
|
50093
|
+
function chaseDepth(diameter = CHASE_DIAMETER) {
|
|
50094
|
+
return PLASTER_PER_FACE + CHASE_CLEAR + diameter;
|
|
50095
|
+
}
|
|
50096
|
+
var CHASE_DIAMETER = 0.025;
|
|
50097
|
+
var CHASE_CLEAR = 6e-3;
|
|
50075
50098
|
var SLAB_MIDDLE = 0.065;
|
|
50076
50099
|
var CEILING_SLAB = 0.5;
|
|
50077
50100
|
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
@@ -50128,7 +50151,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50128
50151
|
const inward = (alongU ? (box4[1] + box4[3]) / 2 : (box4[0] + box4[2]) / 2) - line;
|
|
50129
50152
|
const side = Math.abs(across2) > 1e-3 ? Math.sign(across2) : inward >= 0 ? 1 : -1;
|
|
50130
50153
|
const half = (wall.thickness ?? DEFAULT_THICKNESS) / 2;
|
|
50131
|
-
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half -
|
|
50154
|
+
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half - chaseDepth(options.diameter);
|
|
50132
50155
|
const at2 = line + side * offset;
|
|
50133
50156
|
return { u: alongU ? along2 : at2, v: alongU ? at2 : along2, wall };
|
|
50134
50157
|
}
|
|
@@ -50804,6 +50827,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50804
50827
|
}
|
|
50805
50828
|
var PIPE_WALL_FILL = 0.3;
|
|
50806
50829
|
var WALL_PIPE_MASS = 3;
|
|
50830
|
+
var UNDER_SINK_RISER_OFF_WALL = 0.08;
|
|
50831
|
+
var UNDER_SINK_VALVE_RISE = 0.1;
|
|
50807
50832
|
var pipeMass = (diameter, length) => DENSITY.plastic * Math.PI * (diameter / 2) ** 2 * length * PIPE_WALL_FILL;
|
|
50808
50833
|
function installUtilitiesWater(K, shared2) {
|
|
50809
50834
|
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
@@ -51003,7 +51028,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51003
51028
|
}
|
|
51004
51029
|
}
|
|
51005
51030
|
function underSink(tr) {
|
|
51006
|
-
const H = shared2.ctx.r.utilities?.plumbing, nA = shared2.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to),
|
|
51031
|
+
const H = shared2.ctx.r.utilities?.plumbing, nA = shared2.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to), d = tr.diameter || 0.025;
|
|
51032
|
+
const pts = riserUnderBack(tr.points.map((p) => [p[0], p[2], p[1]]));
|
|
51007
51033
|
const stage = cursor.stage;
|
|
51008
51034
|
if (shared2.ctx.constructionStages) cursor.stage = "furniture";
|
|
51009
51035
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
@@ -51015,6 +51041,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51015
51041
|
cursor.pc = null;
|
|
51016
51042
|
cursor.stage = stage;
|
|
51017
51043
|
}
|
|
51044
|
+
function riserUnderBack(pts) {
|
|
51045
|
+
if (pts.length < 3 || shared2.ctx.visorScene) return pts;
|
|
51046
|
+
const wall = pts[0], mid = pts[1], dx = mid[0] - wall[0], dz = mid[2] - wall[2], L = Math.hypot(dx, dz);
|
|
51047
|
+
if (L <= UNDER_SINK_RISER_OFF_WALL) return pts;
|
|
51048
|
+
const x = wall[0] + dx / L * UNDER_SINK_RISER_OFF_WALL, z = wall[2] + dz / L * UNDER_SINK_RISER_OFF_WALL;
|
|
51049
|
+
const top = mid[1] + UNDER_SINK_VALVE_RISE;
|
|
51050
|
+
return [wall, ...pts.slice(1).map((p) => [x, Math.min(p[1], top), z])];
|
|
51051
|
+
}
|
|
51018
51052
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
51019
51053
|
Object.assign(K, defined);
|
|
51020
51054
|
}
|
|
@@ -51361,15 +51395,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51361
51395
|
const aabb = wall.alongU ? [solid.aabb[0], line - width / 2, solid.aabb[2], line + width / 2] : [line - width / 2, solid.aabb[1], line + width / 2, solid.aabb[3]];
|
|
51362
51396
|
return { ...solid, aabb };
|
|
51363
51397
|
}
|
|
51364
|
-
var
|
|
51398
|
+
var CHASE_CLEAR2 = 3e-3;
|
|
51365
51399
|
function chasesIn(wall, core, runs) {
|
|
51366
51400
|
const out = [];
|
|
51367
51401
|
for (const r of runs) {
|
|
51368
51402
|
const along2 = wall.alongU ? r.u : r.v, across2 = (wall.alongU ? r.v : r.u) - core.line;
|
|
51369
|
-
if (along2 + r.radius +
|
|
51403
|
+
if (along2 + r.radius + CHASE_CLEAR2 < wall.a0 || along2 - r.radius - CHASE_CLEAR2 > wall.a1 || r.y1 <= core.y0 || r.y0 >= core.y1) continue;
|
|
51370
51404
|
if (Math.abs(across2) > wall.thickness / 2 + 1e-6) continue;
|
|
51371
|
-
const back = Math.abs(across2) - (r.depth ?? r.radius) -
|
|
51372
|
-
out.push({ a0: along2 - r.radius -
|
|
51405
|
+
const back = Math.abs(across2) - (r.depth ?? r.radius) - CHASE_CLEAR2;
|
|
51406
|
+
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 } : {} });
|
|
51373
51407
|
}
|
|
51374
51408
|
return out;
|
|
51375
51409
|
}
|
|
@@ -52899,7 +52933,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52899
52933
|
alias("tv", "flat_tv");
|
|
52900
52934
|
alias("tv_large", "flat_tv");
|
|
52901
52935
|
mine("coffee_table", (M, A) => FURNITURE.table(M, A, { noChairs: true }));
|
|
52902
|
-
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, {
|
|
52936
|
+
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, { noChairs: true, round: true }));
|
|
52903
52937
|
mine("rug", FURNITURE.rug);
|
|
52904
52938
|
mine("rug_small", FURNITURE.rug, "game (rug)");
|
|
52905
52939
|
mine("shelf_unit", FURNITURE.shelf);
|
|
@@ -53628,17 +53662,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53628
53662
|
}
|
|
53629
53663
|
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
53630
53664
|
var PLANT_CLEAR = 0.04;
|
|
53631
|
-
var PLANT_MIN_REACH = 0.
|
|
53665
|
+
var PLANT_MIN_REACH = 0.12;
|
|
53632
53666
|
var PLANT_SPAN = [0.03, 2.4];
|
|
53667
|
+
var PLANT_HEIGHT_MARGIN = 1.5;
|
|
53633
53668
|
function footprintOf(m) {
|
|
53634
53669
|
const c = Math.abs(Math.cos(m.ry || 0)), s = Math.abs(Math.sin(m.ry || 0)), hx = ((m.w || 0) * c + (m.d || 0) * s) / 2, hz = ((m.w || 0) * s + (m.d || 0) * c) / 2;
|
|
53635
53670
|
return [m.x - hx, m.z - hz, m.x + hx, m.z + hz];
|
|
53636
53671
|
}
|
|
53637
53672
|
var reachTo = (x, z, x0, z0, x1, z1) => Math.hypot(Math.max(x0 - x, 0, x - x1), Math.max(z0 - z, 0, z - z1));
|
|
53638
53673
|
function freeReachOf(p) {
|
|
53639
|
-
const
|
|
53674
|
+
const tall = p.self.h != null && p.self.h > 0 ? Math.min(PLANT_SPAN[1], p.self.h * PLANT_HEIGHT_MARGIN) : PLANT_SPAN[1];
|
|
53675
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + tall;
|
|
53640
53676
|
let reach2 = Number.POSITIVE_INFINITY;
|
|
53641
|
-
for (const b of p.boxes)
|
|
53677
|
+
for (const b of p.boxes) {
|
|
53678
|
+
if (b[1] >= y1 || b[4] <= y0) continue;
|
|
53679
|
+
if (b[1] > p.y && p.x >= b[0] && p.x <= b[3] && p.z >= b[2] && p.z <= b[5]) continue;
|
|
53680
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, b[0], b[2], b[3], b[5]));
|
|
53681
|
+
}
|
|
53642
53682
|
for (const m of p.items) {
|
|
53643
53683
|
if (m === p.self || m.id === p.self.id || m.floor !== p.self.floor || m.flat || m.category === "ground_cover" || m.w == null || m.d == null) continue;
|
|
53644
53684
|
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
@@ -53702,7 +53742,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53702
53742
|
const covers = [];
|
|
53703
53743
|
for (const m of ordered) {
|
|
53704
53744
|
if (m.type === "stairs") continue;
|
|
53705
|
-
const exterior = m.outdoor || m.floor < 0
|
|
53745
|
+
const exterior = m.outdoor || m.floor < 0;
|
|
53746
|
+
if (exterior && m.category === "ground_cover" && shared2.ctx.noGroundSurfaces) continue;
|
|
53747
|
+
const f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
|
|
53706
53748
|
cursor.group = exterior && !(m.type === "cooking_gas_cylinder" && m.shelter && !shared2.ctx.visorScene) ? "lot" : "f" + Math.max(f, 0);
|
|
53707
53749
|
const com = m.room != null ? shared2.ctx.roomById[m.room] : void 0, lift = !exterior && f === 0 && shared2.ctx.constructionStages && !shared2.ctx.visorScene && !com?.outbuilding ? FLOOR_OVER_GROUND : 0, base = exterior ? 0 : Y0(f) + lift;
|
|
53708
53750
|
const M = { visorScene: shared2.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: shared2.ctx.colors, color: m.category === "ground_cover" ? void 0 : colorOf(m.color) ?? void 0, seed: m.id, room: m.room, typeWith: com ? com.type : null, ceiling: com ? com.ceiling : 2.9, on: shared2.ctx.night, light: shared2.ctx.night, lit: shared2.ctx.night, open: !!m.doorOpen, overhead: m.overhead, assembly: m.assembly, hose: m.hose, shelter: m.shelter, pipe: m.pipe };
|
|
@@ -54748,6 +54790,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54748
54790
|
const defined = { targetOf };
|
|
54749
54791
|
Object.assign(K, defined);
|
|
54750
54792
|
}
|
|
54793
|
+
var CORD_RADIUS = 6e-3;
|
|
54751
54794
|
function installInteractablesBridge(K, shared2) {
|
|
54752
54795
|
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
54753
54796
|
const enter = (...a) => K.enter(...a);
|
|
@@ -54893,9 +54936,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54893
54936
|
const spec = ik.A.household.build(type, loc, mesh2.api);
|
|
54894
54937
|
const out = mesh2.finish(spec);
|
|
54895
54938
|
for (const l of out.lights) l.removeFromParent();
|
|
54896
|
-
const group = ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
54939
|
+
const group = type === "gas_bottle" && item.shelter && !shared2.ctx.visorScene ? "f0" : ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
54897
54940
|
root.name = "iv:" + ent.id;
|
|
54898
|
-
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance"
|
|
54941
|
+
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance";
|
|
54899
54942
|
const isPlate = type === "wall_switch" || type === "wall_socket";
|
|
54900
54943
|
const ivStage = shared2.ctx.constructionStages ? isInst ? "installations" : isPlate ? "finishes" : "furniture" : void 0;
|
|
54901
54944
|
if (ivStage) root.userData.constructionStage = ivStage;
|
|
@@ -54951,6 +54994,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54951
54994
|
if (root.children.length) IV.roots.push(E);
|
|
54952
54995
|
return spec;
|
|
54953
54996
|
}
|
|
54997
|
+
const floorFinishOf = (floor) => shared2.ctx.constructionStages && !shared2.ctx.visorScene && floor === 0 ? FLOOR_OVER_GROUND : 0;
|
|
54954
54998
|
function ivCords(IV) {
|
|
54955
54999
|
const ik = IV.k, w = IV.world, wl = (o, p) => ik.GI.localToWorld(o.transform, p), g0 = cursor.group;
|
|
54956
55000
|
const tube2 = (pts, radius, color2, ox, oy, oz, ry) => {
|
|
@@ -54977,15 +55021,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54977
55021
|
if (!so || !sk) continue;
|
|
54978
55022
|
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
54979
55023
|
if (last[1] < 0.3 + E.pos[1]) {
|
|
54980
|
-
const
|
|
54981
|
-
|
|
55024
|
+
const lie = E.pos[1] + floorFinishOf(E.floor) + CORD_RADIUS + 1e-3;
|
|
55025
|
+
const foot = [sp[0] + dir[0] * 0.035, lie, sp[2] + dir[1] * 0.035];
|
|
55026
|
+
pts.push([last[0] + (foot[0] - last[0]) * 0.4, lie, last[2] + (foot[2] - last[2]) * 0.4], [last[0] + (foot[0] - last[0]) * 0.75, lie, last[2] + (foot[2] - last[2]) * 0.75], foot, [foot[0], Math.max(E.pos[1] + 0.1, sp[1] - 0.04), foot[2]], [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012]);
|
|
54982
55027
|
} else {
|
|
54983
55028
|
const hang = ik.gfx.catenary(last, [sp[0] + dir[0] * 0.012, sp[1] - 0.01, sp[2] + dir[1] * 0.012], 0.1, 8);
|
|
54984
55029
|
hang.shift();
|
|
54985
55030
|
for (const p of hang) pts.push(p);
|
|
54986
55031
|
}
|
|
54987
55032
|
shared2.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
54988
|
-
tube2(pts,
|
|
55033
|
+
tube2(pts, CORD_RADIUS, IV_WIRE.cord, 0, 0, 0, 0);
|
|
54989
55034
|
}
|
|
54990
55035
|
}
|
|
54991
55036
|
} finally {
|
|
@@ -57834,6 +57879,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57834
57879
|
return level >= STAGE_LEVEL.openings;
|
|
57835
57880
|
case "roof":
|
|
57836
57881
|
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
57882
|
+
// the timber of the roof (its stage group is shown by name, `groupVisible`): a stretch of it broken off the frame keeps the frame's stage
|
|
57883
|
+
case "roofFraming":
|
|
57884
|
+
return level >= STAGE_LEVEL.roofFraming && opts.roofLayer !== false;
|
|
57837
57885
|
case "furniture":
|
|
57838
57886
|
return level >= STAGE_LEVEL.last;
|
|
57839
57887
|
// the protective sidewalk round the house: the last of the work outside
|
|
@@ -57899,6 +57947,50 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57899
57947
|
}
|
|
57900
57948
|
return level;
|
|
57901
57949
|
}
|
|
57950
|
+
function partStagesOf(house) {
|
|
57951
|
+
const stages = /* @__PURE__ */ new Map();
|
|
57952
|
+
const walk = (o, inherited) => {
|
|
57953
|
+
const own = typeof o.userData?.constructionStage === "string" ? o.userData.constructionStage : inherited;
|
|
57954
|
+
const part = o.userData?.destructionPart;
|
|
57955
|
+
if (own && typeof part === "string" && !stages.has(part)) stages.set(part, own);
|
|
57956
|
+
const ranges = o.userData?.ranges;
|
|
57957
|
+
if (own && Array.isArray(ranges)) {
|
|
57958
|
+
for (const range2 of ranges) if (!stages.has(range2.id)) stages.set(range2.id, own);
|
|
57959
|
+
}
|
|
57960
|
+
for (const c of o.children) walk(c, own);
|
|
57961
|
+
};
|
|
57962
|
+
walk(house, void 0);
|
|
57963
|
+
return stages;
|
|
57964
|
+
}
|
|
57965
|
+
function stageOfPiece(piece2, stages) {
|
|
57966
|
+
let found;
|
|
57967
|
+
piece2.root.traverse((o) => {
|
|
57968
|
+
if (found) return;
|
|
57969
|
+
const part = o.userData?.destructionPart;
|
|
57970
|
+
if (typeof part === "string") found = stages.get(part);
|
|
57971
|
+
});
|
|
57972
|
+
return found;
|
|
57973
|
+
}
|
|
57974
|
+
function stageLoosePieces(pieces, stages, level, opts, held) {
|
|
57975
|
+
let hidden = 0;
|
|
57976
|
+
for (const piece2 of pieces) {
|
|
57977
|
+
const stage = stageOfPiece(piece2, stages);
|
|
57978
|
+
if (!stage) continue;
|
|
57979
|
+
const shown2 = stageVisible(stage, level, opts);
|
|
57980
|
+
piece2.root.visible = shown2;
|
|
57981
|
+
if (!shown2) {
|
|
57982
|
+
hidden++;
|
|
57983
|
+
if (!piece2.held) {
|
|
57984
|
+
piece2.held = true;
|
|
57985
|
+
held.add(piece2);
|
|
57986
|
+
}
|
|
57987
|
+
} else if (held.has(piece2)) {
|
|
57988
|
+
piece2.held = false;
|
|
57989
|
+
held.delete(piece2);
|
|
57990
|
+
}
|
|
57991
|
+
}
|
|
57992
|
+
return hidden;
|
|
57993
|
+
}
|
|
57902
57994
|
var INSTALLATIONS_STAGE = "stage:4:installations";
|
|
57903
57995
|
function toWorld2(THREE, object2, x, z) {
|
|
57904
57996
|
return new THREE.Vector3(x, 0, z).applyMatrix4(object2.matrixWorld);
|
|
@@ -57930,24 +58022,53 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57930
58022
|
hip: { top: 0.065, width: 0.06, height: 0.14 },
|
|
57931
58023
|
post: { side: 0.07, spacing: 2 }
|
|
57932
58024
|
};
|
|
58025
|
+
var along = (p0, p1, f) => [p0[0] + (p1[0] - p0[0]) * f, p0[1] + (p1[1] - p0[1]) * f, p0[2] + (p1[2] - p0[2]) * f];
|
|
57933
58026
|
var EDGE2 = 0.04;
|
|
57934
|
-
|
|
58027
|
+
var ROOF_TIMBER_STRETCH = 1.2;
|
|
58028
|
+
var ROOF_TIMBER_MATERIAL = "wood_hard";
|
|
58029
|
+
var TIMBER_DENSITY = 750;
|
|
58030
|
+
var TimberLog = class {
|
|
58031
|
+
constructor(prefix, onPiece) {
|
|
58032
|
+
__publicField(this, "prefix", prefix);
|
|
58033
|
+
__publicField(this, "onPiece", onPiece);
|
|
58034
|
+
__publicField(this, "count", 0);
|
|
58035
|
+
}
|
|
58036
|
+
next(kind, mass, chain) {
|
|
58037
|
+
const id = `${this.prefix}:${this.count++}`;
|
|
58038
|
+
this.onPiece({ id, kind, mass, chain });
|
|
58039
|
+
return id;
|
|
58040
|
+
}
|
|
58041
|
+
};
|
|
58042
|
+
var LOGS = /* @__PURE__ */ new WeakMap();
|
|
58043
|
+
function addTimber(batch, top0, top1, width, height, kind) {
|
|
57935
58044
|
const dx = top1[0] - top0[0], dz = top1[2] - top0[2];
|
|
57936
58045
|
const flat = Math.hypot(dx, dz);
|
|
57937
58046
|
if (flat < 1e-4 && Math.abs(top1[1] - top0[1]) < 1e-4) return;
|
|
57938
58047
|
const sx = flat < 1e-4 ? width / 2 : -dz / flat * (width / 2);
|
|
57939
58048
|
const sz = flat < 1e-4 ? 0 : dx / flat * (width / 2);
|
|
57940
58049
|
const corner = (p, side, down2) => [p[0] + sx * side, p[1] - down2, p[2] + sz * side];
|
|
57941
|
-
|
|
57942
|
-
|
|
57943
|
-
|
|
57944
|
-
|
|
57945
|
-
|
|
57946
|
-
|
|
57947
|
-
|
|
57948
|
-
|
|
57949
|
-
|
|
57950
|
-
|
|
58050
|
+
const log = LOGS.get(batch);
|
|
58051
|
+
const length = Math.hypot(dx, top1[1] - top0[1], dz);
|
|
58052
|
+
const stretches = log ? Math.max(1, Math.ceil(length / ROOF_TIMBER_STRETCH)) : 1;
|
|
58053
|
+
let before = null;
|
|
58054
|
+
for (let k = 0; k < stretches; k++) {
|
|
58055
|
+
const a = along(top0, top1, k / stretches), b = along(top0, top1, (k + 1) / stretches);
|
|
58056
|
+
if (log) {
|
|
58057
|
+
before = log.next(kind, TIMBER_DENSITY * width * height * (length / stretches), before ? [before] : []);
|
|
58058
|
+
batch.piece(before);
|
|
58059
|
+
}
|
|
58060
|
+
batch.addHexahedron([
|
|
58061
|
+
corner(a, -1, height),
|
|
58062
|
+
corner(a, 1, height),
|
|
58063
|
+
corner(a, 1, 0),
|
|
58064
|
+
corner(a, -1, 0),
|
|
58065
|
+
corner(b, -1, height),
|
|
58066
|
+
corner(b, 1, height),
|
|
58067
|
+
corner(b, 1, 0),
|
|
58068
|
+
corner(b, -1, 0)
|
|
58069
|
+
], { start: k > 0, end: k < stretches - 1 });
|
|
58070
|
+
}
|
|
58071
|
+
if (log) batch.piece(null);
|
|
57951
58072
|
}
|
|
57952
58073
|
var KEEP_OUT_GAP = 0.03;
|
|
57953
58074
|
function clearStretches(top0, top1, width, height, keepOut) {
|
|
@@ -57971,16 +58092,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57971
58092
|
}
|
|
57972
58093
|
return stretches;
|
|
57973
58094
|
}
|
|
57974
|
-
|
|
57975
|
-
function addTimberAround(batch, top0, top1, width, height, keepOut, onCut) {
|
|
58095
|
+
function addTimberAround(batch, top0, top1, width, height, kind, keepOut, onCut) {
|
|
57976
58096
|
if (!keepOut.length) {
|
|
57977
|
-
addTimber(batch, top0, top1, width, height);
|
|
58097
|
+
addTimber(batch, top0, top1, width, height, kind);
|
|
57978
58098
|
return;
|
|
57979
58099
|
}
|
|
57980
58100
|
const length = Math.hypot(top1[0] - top0[0], top1[1] - top0[1], top1[2] - top0[2]);
|
|
57981
58101
|
for (const [f0, f1] of clearStretches(top0, top1, width, height, keepOut)) {
|
|
57982
58102
|
if ((f1 - f0) * length < 0.05) continue;
|
|
57983
|
-
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height);
|
|
58103
|
+
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height, kind);
|
|
57984
58104
|
const inset = TIMBER.post.side / 2 / Math.max(length, 1e-6);
|
|
57985
58105
|
if (f0 > 0) onCut?.(along(top0, top1, Math.min(f1, f0 + inset)));
|
|
57986
58106
|
if (f1 < 1) onCut?.(along(top0, top1, Math.max(f0, f1 - inset)));
|
|
@@ -57989,7 +58109,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57989
58109
|
var postBlocked = (x, z, keepOut) => keepOut.some((b) => x > b[0] - TIMBER.post.side / 2 - KEEP_OUT_GAP && x < b[3] + TIMBER.post.side / 2 + KEEP_OUT_GAP && z > b[2] - TIMBER.post.side / 2 - KEEP_OUT_GAP && z < b[5] + TIMBER.post.side / 2 + KEEP_OUT_GAP);
|
|
57990
58110
|
function addPost(batch, x, z, y0, y1) {
|
|
57991
58111
|
const h = TIMBER.post.side / 2;
|
|
57992
|
-
if (y1 - y0
|
|
58112
|
+
if (y1 - y0 <= 0.02) return;
|
|
58113
|
+
const log = LOGS.get(batch);
|
|
58114
|
+
if (log) batch.piece(log.next("post", TIMBER_DENSITY * TIMBER.post.side * TIMBER.post.side * (y1 - y0), []));
|
|
58115
|
+
batch.add([x - h, y0, z - h, x + h, y1, z + h], true);
|
|
58116
|
+
if (log) batch.piece(null);
|
|
57993
58117
|
}
|
|
57994
58118
|
function slopesOf(rect) {
|
|
57995
58119
|
const [x0, z0, x1, z1] = rect.exterior;
|
|
@@ -58047,7 +58171,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58047
58171
|
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
58048
58172
|
if (b - a <= 0.05) continue;
|
|
58049
58173
|
const at2 = battenClearOfSolids(slope, s, [a, b], solids);
|
|
58050
|
-
addTimberAround(batches.battens, down(slope.point(at2, a), batten.top), down(slope.point(at2, b), batten.top), batten.width, batten.height, keepOut);
|
|
58174
|
+
addTimberAround(batches.battens, down(slope.point(at2, a), batten.top), down(slope.point(at2, b), batten.top), batten.width, batten.height, "batten", keepOut);
|
|
58051
58175
|
}
|
|
58052
58176
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
58053
58177
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -58057,7 +58181,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58057
58181
|
if (end < 0.1) continue;
|
|
58058
58182
|
const axis = slope.point(0, 1)[0] - slope.point(0, 0)[0] !== 0 ? 0 : 2;
|
|
58059
58183
|
const t = clearOfSolids(at2, rafter.width, down(slope.point(EDGE2, at2), rafter.top), down(slope.point(end, at2), rafter.top), axis, solids);
|
|
58060
|
-
addTimberAround(batches.timber, down(slope.point(EDGE2, t), rafter.top), down(slope.point(end, t), rafter.top), rafter.width, rafter.height, keepOut);
|
|
58184
|
+
addTimberAround(batches.timber, down(slope.point(EDGE2, t), rafter.top), down(slope.point(end, t), rafter.top), rafter.width, rafter.height, "rafter", keepOut);
|
|
58061
58185
|
}
|
|
58062
58186
|
const lines = [slope.wall, slope.wall + (slope.run - slope.wall) / 3, slope.wall + (slope.run - slope.wall) * 2 / 3];
|
|
58063
58187
|
lines.forEach((s, k) => {
|
|
@@ -58067,7 +58191,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58067
58191
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
58068
58192
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
58069
58193
|
if (depth < 0.02) return;
|
|
58070
|
-
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, keepOut, k === 0 ? void 0 : (end) => addPost(batches.timber, end[0], end[2], slabTop, end[1] - purlin.height));
|
|
58194
|
+
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, "purlin", keepOut, k === 0 ? void 0 : (end) => addPost(batches.timber, end[0], end[2], slabTop, end[1] - purlin.height));
|
|
58071
58195
|
if (k === 0) return;
|
|
58072
58196
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
58073
58197
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -58099,10 +58223,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58099
58223
|
}
|
|
58100
58224
|
return out;
|
|
58101
58225
|
}
|
|
58102
|
-
function buildRoofFramingStage(THREE, roofRects, material, solids = [], keepOut = []) {
|
|
58226
|
+
function buildRoofFramingStage(THREE, roofRects, material, solids = [], keepOut = [], onPiece) {
|
|
58103
58227
|
const group = new THREE.Group();
|
|
58104
58228
|
group.name = "stage:7:roof_framing";
|
|
58105
58229
|
const timber = new BoxBatch(), battens = new BoxBatch();
|
|
58230
|
+
if (onPiece) {
|
|
58231
|
+
LOGS.set(timber, new TimberLog("roof_timber", onPiece));
|
|
58232
|
+
LOGS.set(battens, new TimberLog("roof_batten", onPiece));
|
|
58233
|
+
}
|
|
58106
58234
|
for (const rr of roofRects) {
|
|
58107
58235
|
if (rr.slab || rr.yb === void 0 || rr.tp === void 0 || !rr.exterior || rr.rm === void 0 || rr.alongX === void 0) continue;
|
|
58108
58236
|
const rect = { yb: rr.yb, tp: rr.tp, exterior: rr.exterior, rm: rr.rm, alongX: rr.alongX, r: rr.r, gable: !!rr.gable };
|
|
@@ -58113,7 +58241,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58113
58241
|
const xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
58114
58242
|
const ends = rr.alongX ? [[rr.gable ? x0 + EDGE2 : x0 + rr.rm, ridgeY, zm], [rr.gable ? x1 - EDGE2 : x1 - rr.rm, ridgeY, zm]] : [[xm, ridgeY, rr.gable ? z0 + EDGE2 : z0 + rr.rm], [xm, ridgeY, rr.gable ? z1 - EDGE2 : z1 - rr.rm]];
|
|
58115
58243
|
const ridgeTop = TIMBER.purlin.top;
|
|
58116
|
-
addTimberAround(timber, down(ends[0], ridgeTop), down(ends[1], ridgeTop), TIMBER.purlin.width, TIMBER.purlin.height, keepOut, (end) => addPost(timber, end[0], end[2], slabTop, end[1] - TIMBER.purlin.height));
|
|
58244
|
+
addTimberAround(timber, down(ends[0], ridgeTop), down(ends[1], ridgeTop), TIMBER.purlin.width, TIMBER.purlin.height, "purlin", keepOut, (end) => addPost(timber, end[0], end[2], slabTop, end[1] - TIMBER.purlin.height));
|
|
58117
58245
|
const along2 = Math.hypot(ends[1][0] - ends[0][0], ends[1][2] - ends[0][2]);
|
|
58118
58246
|
const posts = Math.max(1, Math.ceil(along2 / TIMBER.post.spacing));
|
|
58119
58247
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -58129,12 +58257,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58129
58257
|
const corners = [[x0 + e, h, z0 + e], [x1 - e, h, z0 + e], [x0 + e, h, z1 - e], [x1 - e, h, z1 - e]];
|
|
58130
58258
|
for (const c of corners) {
|
|
58131
58259
|
const end = Math.hypot(c[0] - ends[0][0], c[2] - ends[0][2]) <= Math.hypot(c[0] - ends[1][0], c[2] - ends[1][2]) ? ends[0] : ends[1];
|
|
58132
|
-
addTimberAround(timber, down(c, TIMBER.hip.top), down(end, TIMBER.hip.top), TIMBER.hip.width, TIMBER.hip.height, keepOut);
|
|
58260
|
+
addTimberAround(timber, down(c, TIMBER.hip.top), down(end, TIMBER.hip.top), TIMBER.hip.width, TIMBER.hip.height, "hip", keepOut);
|
|
58133
58261
|
}
|
|
58134
58262
|
}
|
|
58135
58263
|
}
|
|
58136
58264
|
const wood = material ?? new THREE.MeshStandardMaterial({ color: 11042380, roughness: 0.82 });
|
|
58137
|
-
for (const mesh2 of [timber.mesh(THREE, wood, "roof_framing:timber"), battens.mesh(THREE, wood, "roof_framing:battens")])
|
|
58265
|
+
for (const mesh2 of [timber.mesh(THREE, wood, "roof_framing:timber"), battens.mesh(THREE, wood, "roof_framing:battens")]) {
|
|
58266
|
+
if (!mesh2) continue;
|
|
58267
|
+
mesh2.userData.constructionStage = "roofFraming";
|
|
58268
|
+
if (onPiece) mesh2.userData.destructionMaterial = ROOF_TIMBER_MATERIAL;
|
|
58269
|
+
group.add(mesh2);
|
|
58270
|
+
}
|
|
58138
58271
|
return group;
|
|
58139
58272
|
}
|
|
58140
58273
|
var HOUSE_SHADOW_BUDGET_MS = 2;
|
|
@@ -58177,6 +58310,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58177
58310
|
}
|
|
58178
58311
|
};
|
|
58179
58312
|
}
|
|
58313
|
+
var ROOF_TIMBER_REACH = 3;
|
|
58180
58314
|
function withLaidConduits(r, stages) {
|
|
58181
58315
|
const E = r.utilities?.electrical;
|
|
58182
58316
|
if (!stages || !E || !E.conduits?.length) return r;
|
|
@@ -58234,7 +58368,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58234
58368
|
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 };
|
|
58235
58369
|
}
|
|
58236
58370
|
function installBuildBuild(K, shared2) {
|
|
58237
|
-
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS4, 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, createHouseDestruction, newState, enter, tagDamage } = K;
|
|
58371
|
+
const { THREE, cfg, rectsOf: rectsOf2, invalidateShadow, colliderChanged, VERSION: VERSION2, CARS, EPS: EPS4, 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;
|
|
58238
58372
|
function build(r0, options) {
|
|
58239
58373
|
const opts = options || {};
|
|
58240
58374
|
const r = withLaidConduits(applyOutbuildings(r0), !!(opts.constructionStages || opts.constructionLevel != null));
|
|
@@ -58252,6 +58386,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58252
58386
|
shared2.ctx.colliders = [];
|
|
58253
58387
|
shared2.ctx.stairs = [];
|
|
58254
58388
|
shared2.ctx.noTerrain = opts.terrain === false;
|
|
58389
|
+
shared2.ctx.noGroundSurfaces = opts.groundSurfaces === false;
|
|
58255
58390
|
shared2.ctx.serviceFrom = opts.serviceFrom ?? null;
|
|
58256
58391
|
shared2.ctx.roomById = {};
|
|
58257
58392
|
for (const c of r.rooms) shared2.ctx.roomById[c.id] = c;
|
|
@@ -58403,6 +58538,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58403
58538
|
(k === "floor" || k === "building" ? root : house).add(g);
|
|
58404
58539
|
}
|
|
58405
58540
|
let currentConstructionLevel = CONSTRUCTION_LEVEL_MAX;
|
|
58541
|
+
let partStages = null, stageOptsNow = {}, piecesStaged = -1;
|
|
58542
|
+
const stageHeld = /* @__PURE__ */ new Set();
|
|
58406
58543
|
h.groups = gs;
|
|
58407
58544
|
h.root = root;
|
|
58408
58545
|
h.house = house;
|
|
@@ -58583,22 +58720,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58583
58720
|
return house.localToWorld(localCenter.clone());
|
|
58584
58721
|
};
|
|
58585
58722
|
const distance2 = (focus) => center().distanceTo(focus instanceof THREE.Vector3 ? focus : new THREE.Vector3(focus.x, focus.y, focus.z));
|
|
58586
|
-
markGroups(r, root, parts2);
|
|
58587
|
-
const structure = assembleStructure(r0, root), destruction = createHouseDestruction(root, house, structure, parts2, colliders, water);
|
|
58588
|
-
h.destruction = destruction;
|
|
58589
|
-
destruction.breach.setLod(h.lodCurrent);
|
|
58590
58723
|
if (cs) {
|
|
58591
58724
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
58592
58725
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared2.ctx.wallBoxShifts)], shared2.ctx.blockLaid ?? []);
|
|
58593
58726
|
const instGroup = buildInstallationsStage(THREE, r, shared2.ctx.gutterInfo?.drains ?? [], shared2.ctx.paving ?? []);
|
|
58594
|
-
const roofFraming = buildRoofFramingStage(THREE, shared2.ctx.roofRects || [], void 0, [...shared2.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared2.ctx.gutterInfo?.gutters ?? [])])
|
|
58727
|
+
const roofFraming = buildRoofFramingStage(THREE, shared2.ctx.roofRects || [], void 0, [...shared2.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared2.ctx.gutterInfo?.gutters ?? [])], (t) => {
|
|
58728
|
+
pieceRecord(t.id, ROOF_TIMBER_MATERIAL, null, { holdOn: t.kind === "post" ? "floor" : "wall", holdReach: ROOF_TIMBER_REACH, holdJoint: "nail", mass: t.mass, tags: ["roof_timber", t.kind], ...t.chain.length ? { chain: t.chain } : {} });
|
|
58729
|
+
});
|
|
58595
58730
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
58596
58731
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
58597
58732
|
gs[sg.name] = sg;
|
|
58598
58733
|
house.add(sg);
|
|
58599
58734
|
}
|
|
58600
|
-
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
58601
58735
|
}
|
|
58736
|
+
markGroups(r, root, parts2);
|
|
58737
|
+
const structure = assembleStructure(r0, root), destruction = createHouseDestruction(root, house, structure, parts2, colliders, water);
|
|
58738
|
+
h.destruction = destruction;
|
|
58739
|
+
destruction.breach.setLod(h.lodCurrent);
|
|
58740
|
+
if (cs) {
|
|
58741
|
+
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
58742
|
+
partStages = partStagesOf(house);
|
|
58743
|
+
}
|
|
58744
|
+
const stagePieces = () => {
|
|
58745
|
+
const R = destruction.renderer;
|
|
58746
|
+
if (!partStages || !R?.pieces) return;
|
|
58747
|
+
const list2 = R.pieces();
|
|
58748
|
+
piecesStaged = list2.length;
|
|
58749
|
+
stageLoosePieces(list2, partStages, currentConstructionLevel, stageOptsNow, stageHeld);
|
|
58750
|
+
};
|
|
58602
58751
|
const strikePiece = (id, point, type, amount, d, before) => {
|
|
58603
58752
|
if (!destruction.world) return;
|
|
58604
58753
|
const pid = id && structure.byId.has(id) ? id : parts2[id] && parts2[id].type === "water_tank" && structure.byId.has("water_tank") ? "water_tank" : null;
|
|
@@ -58680,6 +58829,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58680
58829
|
// per frame: doors, parts, wind-blown laundry and (with a focus) distance LOD; dt in seconds, time in ms (rAF); focus = {x,y,z} in world coordinates
|
|
58681
58830
|
update(dt, time, focus) {
|
|
58682
58831
|
enter(h);
|
|
58832
|
+
if (partStages && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX && destruction.renderer?.pieces && destruction.renderer.pieces().length !== piecesStaged) stagePieces();
|
|
58683
58833
|
animateDoors(dt);
|
|
58684
58834
|
animateInteractive(dt);
|
|
58685
58835
|
water.step(dt);
|
|
@@ -58713,12 +58863,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58713
58863
|
g.visible = v;
|
|
58714
58864
|
}
|
|
58715
58865
|
if (cs && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX) {
|
|
58716
|
-
|
|
58866
|
+
stageOptsNow = { roofLayer: !cut && sel < 0, lotLayer: o.lot !== false };
|
|
58867
|
+
applyConstructionLevel(house, currentConstructionLevel, stageOptsNow);
|
|
58868
|
+
stagePieces();
|
|
58717
58869
|
}
|
|
58718
58870
|
},
|
|
58719
58871
|
setConstructionLevel(level, stageOpts) {
|
|
58720
58872
|
enter(h);
|
|
58873
|
+
stageOptsNow = stageOpts ?? {};
|
|
58721
58874
|
currentConstructionLevel = applyConstructionLevel(house, level, stageOpts);
|
|
58875
|
+
stagePieces();
|
|
58722
58876
|
invalidateShadow();
|
|
58723
58877
|
return currentConstructionLevel;
|
|
58724
58878
|
},
|
|
@@ -59091,6 +59245,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59091
59245
|
}
|
|
59092
59246
|
var FLOOR_TOUCH2 = 5e-3;
|
|
59093
59247
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
59248
|
+
var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
|
|
59094
59249
|
var BASE_MATERIAL = {
|
|
59095
59250
|
wood: "wood_hard",
|
|
59096
59251
|
metal: "steel",
|
|
@@ -59202,7 +59357,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59202
59357
|
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
59203
59358
|
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
59204
59359
|
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
59205
|
-
const fixed = wallMounted || sunk || rooted;
|
|
59360
|
+
const fixed = wallMounted || sunk || rooted || PLANTED.has(name);
|
|
59206
59361
|
const all = drawn.reduce(
|
|
59207
59362
|
(m, p) => ({ x0: Math.min(m.x0, p.min[0]), x1: Math.max(m.x1, p.max[0]), z0: Math.min(m.z0, p.min[2]), z1: Math.max(m.z1, p.max[2]) }),
|
|
59208
59363
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|