@adatechnology/game-items-three 0.10.4 → 0.10.6
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 +275 -65
- package/dist/index.global.js.map +1 -1
- package/package.json +11 -11
package/dist/index.global.js
CHANGED
|
@@ -1990,7 +1990,8 @@ var GameItemsThree = (() => {
|
|
|
1990
1990
|
PIECE_BOXES: "destruction.piece-boxes",
|
|
1991
1991
|
STATIC_COLLIDERS: "destruction.static-colliders",
|
|
1992
1992
|
SHAPES_GENERATE: "shapes.generate",
|
|
1993
|
-
WORLD_REGION: "world.region"
|
|
1993
|
+
WORLD_REGION: "world.region",
|
|
1994
|
+
VEHICLE_HULL_PLAN: "vehicles.hull-plan"
|
|
1994
1995
|
};
|
|
1995
1996
|
var WORKER_KIND_DEFAULTS = {
|
|
1996
1997
|
[WORKER_KIND_ID.GROUND_TILES]: { lane: "sim", priority: 300, latencyFrames: 2, late: "sync" },
|
|
@@ -1998,7 +1999,8 @@ var GameItemsThree = (() => {
|
|
|
1998
1999
|
[WORKER_KIND_ID.PIECE_BOXES]: { lane: "sim", priority: 200, latencyFrames: 2, late: "sync" },
|
|
1999
2000
|
[WORKER_KIND_ID.STATIC_COLLIDERS]: { lane: "build", priority: 150, late: "sync" },
|
|
2000
2001
|
[WORKER_KIND_ID.SHAPES_GENERATE]: { lane: "build", priority: 100, late: "sync" },
|
|
2001
|
-
[WORKER_KIND_ID.WORLD_REGION]: { lane: "background", priority: 10, latencyFrames: 10, late: "drop" }
|
|
2002
|
+
[WORKER_KIND_ID.WORLD_REGION]: { lane: "background", priority: 10, latencyFrames: 10, late: "drop" },
|
|
2003
|
+
[WORKER_KIND_ID.VEHICLE_HULL_PLAN]: { lane: "build", priority: 120, late: "keep-waiting" }
|
|
2002
2004
|
};
|
|
2003
2005
|
|
|
2004
2006
|
// ../game-shapes/dist/index.js
|
|
@@ -16368,6 +16370,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16368
16370
|
let time = 0;
|
|
16369
16371
|
let counter = 0;
|
|
16370
16372
|
const objects = /* @__PURE__ */ new Map();
|
|
16373
|
+
const slots = /* @__PURE__ */ new Map();
|
|
16374
|
+
let slotCounter = 0;
|
|
16375
|
+
let objectsRevision = 0;
|
|
16376
|
+
const putObject = (id, object2) => {
|
|
16377
|
+
if (!objects.has(id)) slots.set(id, ++slotCounter);
|
|
16378
|
+
objectsRevision++;
|
|
16379
|
+
objects.set(id, object2);
|
|
16380
|
+
};
|
|
16381
|
+
const dropObject = (id) => {
|
|
16382
|
+
if (objects.delete(id)) {
|
|
16383
|
+
slots.delete(id);
|
|
16384
|
+
objectsRevision++;
|
|
16385
|
+
}
|
|
16386
|
+
};
|
|
16371
16387
|
const listeners = /* @__PURE__ */ new Map();
|
|
16372
16388
|
let cur = [];
|
|
16373
16389
|
const blasts = [];
|
|
@@ -18258,18 +18274,52 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18258
18274
|
if (o.soil?.sets.size) restCarry.soilSets = Object.fromEntries(o.soil.sets);
|
|
18259
18275
|
const rest2 = build(sub(inOld), o.id, o.soil ? o.base.pos : pos, o.soil ? o.base.rot : rot, restCarry);
|
|
18260
18276
|
dirtyHosted.delete(o);
|
|
18261
|
-
|
|
18262
|
-
for (const [nid, object2] of fresh)
|
|
18277
|
+
putObject(o.id, rest2);
|
|
18278
|
+
for (const [nid, object2] of fresh) putObject(nid, object2);
|
|
18263
18279
|
return fresh.map(([nid]) => nid);
|
|
18264
18280
|
};
|
|
18281
|
+
let rayBroad = null;
|
|
18282
|
+
let uncovered = [];
|
|
18283
|
+
let uncoveredFor = { hook: null, coverage: -1, objects: -1 };
|
|
18284
|
+
const metObjects = [];
|
|
18285
|
+
const rayObjects = [];
|
|
18286
|
+
const candidatesOf2 = (hook) => {
|
|
18287
|
+
const asked = hook.candidates;
|
|
18288
|
+
if (!asked) return null;
|
|
18289
|
+
const coverage2 = asked.revision();
|
|
18290
|
+
if (uncoveredFor.hook !== hook || uncoveredFor.coverage !== coverage2 || uncoveredFor.objects !== objectsRevision) {
|
|
18291
|
+
uncovered = [];
|
|
18292
|
+
for (const o of objects.values()) if (!asked.covers(o.id)) uncovered.push(o);
|
|
18293
|
+
uncoveredFor = { hook, coverage: coverage2, objects: objectsRevision };
|
|
18294
|
+
}
|
|
18295
|
+
if (uncovered.length * 2 > objects.size) return null;
|
|
18296
|
+
metObjects.length = 0;
|
|
18297
|
+
for (const id of asked.met()) {
|
|
18298
|
+
const o = objects.get(id);
|
|
18299
|
+
if (o && asked.covers(id)) metObjects.push(o);
|
|
18300
|
+
}
|
|
18301
|
+
metObjects.sort((a, b) => slots.get(a.id) - slots.get(b.id));
|
|
18302
|
+
rayObjects.length = 0;
|
|
18303
|
+
let m = 0;
|
|
18304
|
+
let u = 0;
|
|
18305
|
+
while (m < metObjects.length || u < uncovered.length) {
|
|
18306
|
+
const takeMet = u >= uncovered.length || m < metObjects.length && slots.get(metObjects[m].id) < slots.get(uncovered[u].id);
|
|
18307
|
+
rayObjects.push(takeMet ? metObjects[m++] : uncovered[u++]);
|
|
18308
|
+
}
|
|
18309
|
+
return rayObjects;
|
|
18310
|
+
};
|
|
18265
18311
|
const raycastInternal = (origin, dir, maxDist, ignore, worldOnly = false, precise = false, skip = {}, scope) => {
|
|
18266
18312
|
const d = vec.normalize(dir);
|
|
18313
|
+
const asked = rayBroad && !scope && rayBroad.begin(origin, d, maxDist) ? rayBroad : null;
|
|
18314
|
+
const candidates = asked ? candidatesOf2(asked) : null;
|
|
18315
|
+
const outside = candidates ? null : asked;
|
|
18267
18316
|
const minRadius = skip.minObjectRadius ?? 0;
|
|
18268
18317
|
let best = null;
|
|
18269
18318
|
const counts = sweepCounts;
|
|
18270
|
-
for (const o of scope ? scope.objects : objects.values()) {
|
|
18319
|
+
for (const o of scope ? scope.objects : candidates ?? objects.values()) {
|
|
18271
18320
|
if (counts) counts.objectVisits++;
|
|
18272
18321
|
if (skip.skipLoose && o.loose || o.br < minRadius) continue;
|
|
18322
|
+
if (outside && !outside.mayMeet(o.id)) continue;
|
|
18273
18323
|
if (raySphereMiss(origin, d, worldCentreOf(o), o.br, best ? Math.min(maxDist, best.distance) : maxDist)) continue;
|
|
18274
18324
|
const qi = quat.conjugate(o.st.rotation);
|
|
18275
18325
|
const lo = rotateVec(qi, vec.sub(origin, o.st.position));
|
|
@@ -19891,6 +19941,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19891
19941
|
return reach2;
|
|
19892
19942
|
};
|
|
19893
19943
|
let blastTntPerJoule = TNT_PER_JOULE;
|
|
19944
|
+
let blastHasCharge = false;
|
|
19894
19945
|
let blastFireball = chargeFireball(0);
|
|
19895
19946
|
const burstFuel = (p) => {
|
|
19896
19947
|
const c = p.spec.contains;
|
|
@@ -19995,7 +20046,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19995
20046
|
}
|
|
19996
20047
|
for (const im of [...impls.values()]) {
|
|
19997
20048
|
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 } : {} }));
|
|
20049
|
+
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
20050
|
yield "part";
|
|
20000
20051
|
}
|
|
20001
20052
|
return out;
|
|
@@ -20120,7 +20171,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20120
20171
|
den += f;
|
|
20121
20172
|
}
|
|
20122
20173
|
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 } : {} });
|
|
20174
|
+
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
20175
|
results.set(im, res);
|
|
20125
20176
|
report(im).shelter = k;
|
|
20126
20177
|
}
|
|
@@ -20462,13 +20513,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20462
20513
|
const fireball = charge?.fuel ? fuelFireball(charge.fuel) : chargeFireball(energy * tntPerJoule);
|
|
20463
20514
|
const inBlast = (fn) => {
|
|
20464
20515
|
const outer = blastTntPerJoule;
|
|
20516
|
+
const outerHasCharge = blastHasCharge;
|
|
20465
20517
|
const outerFireball = blastFireball;
|
|
20466
20518
|
blastTntPerJoule = tntPerJoule;
|
|
20519
|
+
blastHasCharge = charge?.tnt !== void 0;
|
|
20467
20520
|
blastFireball = fireball;
|
|
20468
20521
|
try {
|
|
20469
20522
|
return fn();
|
|
20470
20523
|
} finally {
|
|
20471
20524
|
blastTntPerJoule = outer;
|
|
20525
|
+
blastHasCharge = outerHasCharge;
|
|
20472
20526
|
blastFireball = outerFireball;
|
|
20473
20527
|
}
|
|
20474
20528
|
};
|
|
@@ -21018,7 +21072,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21018
21072
|
finishExplosions();
|
|
21019
21073
|
const id = opts.id ?? nextId();
|
|
21020
21074
|
if (taken(id)) throw new Error(`object "${id}" already exists`);
|
|
21021
|
-
|
|
21075
|
+
putObject(id, build(resolveSpec(spec), id, opts.position ?? [0, 0, 0], opts.rotation ?? [0, 0, 0, 1]));
|
|
21022
21076
|
return id;
|
|
21023
21077
|
},
|
|
21024
21078
|
register(impl, opts = {}) {
|
|
@@ -21053,7 +21107,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21053
21107
|
impls.get(id)?.impl.dispose?.();
|
|
21054
21108
|
const existing = objects.get(id);
|
|
21055
21109
|
if (existing) dirtyHosted.delete(existing);
|
|
21056
|
-
|
|
21110
|
+
dropObject(id);
|
|
21057
21111
|
impls.delete(id);
|
|
21058
21112
|
},
|
|
21059
21113
|
has: (id) => taken(id),
|
|
@@ -21172,6 +21226,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21172
21226
|
},
|
|
21173
21227
|
beginExplosion,
|
|
21174
21228
|
cancelExplosions,
|
|
21229
|
+
setRayBroadPhase(broadPhase2) {
|
|
21230
|
+
rayBroad = broadPhase2;
|
|
21231
|
+
},
|
|
21175
21232
|
groundLoss(loss) {
|
|
21176
21233
|
if (!(loss.radius > 0) || !(loss.depth > 0) || !Number.isFinite(loss.x) || !Number.isFinite(loss.z)) return;
|
|
21177
21234
|
pendingLosses.push({ ...loss });
|
|
@@ -21426,7 +21483,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21426
21483
|
}
|
|
21427
21484
|
const o = getObj(id);
|
|
21428
21485
|
dirtyHosted.delete(o);
|
|
21429
|
-
|
|
21486
|
+
putObject(id, build(o.spec, id, o.base.pos, o.base.rot));
|
|
21430
21487
|
},
|
|
21431
21488
|
on(type, fn) {
|
|
21432
21489
|
const known = listeners.get(type) ?? [];
|
|
@@ -21455,17 +21512,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21455
21512
|
finishExplosions();
|
|
21456
21513
|
const existing = objects.get(id);
|
|
21457
21514
|
if (existing) dirtyHosted.delete(existing);
|
|
21458
|
-
|
|
21515
|
+
putObject(id, buildFromEntry(entry2, id));
|
|
21459
21516
|
},
|
|
21460
21517
|
load(snap) {
|
|
21461
21518
|
cancelExplosions();
|
|
21462
21519
|
if (snap.version !== 1) throw new Error(`unsupported snapshot version ${String(snap.version)}`);
|
|
21463
21520
|
dirtyHosted.clear();
|
|
21464
21521
|
objects.clear();
|
|
21522
|
+
slots.clear();
|
|
21523
|
+
objectsRevision++;
|
|
21465
21524
|
time = snap.time;
|
|
21466
21525
|
rng3.set(snap.rng);
|
|
21467
21526
|
counter = snap.counter ?? 0;
|
|
21468
|
-
for (const e of snap.objects)
|
|
21527
|
+
for (const e of snap.objects) putObject(e.id, buildFromEntry(e, e.id));
|
|
21469
21528
|
for (const e of snap.impls ?? []) {
|
|
21470
21529
|
const im = impls.get(e.id);
|
|
21471
21530
|
if (!im) continue;
|
|
@@ -46651,7 +46710,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
46651
46710
|
}
|
|
46652
46711
|
var residentialTower = residentialTowerTemplate();
|
|
46653
46712
|
|
|
46654
|
-
// ../game-floorplan-three/dist/chunk-
|
|
46713
|
+
// ../game-floorplan-three/dist/chunk-EYIWURKO.js
|
|
46655
46714
|
var __defProp3 = Object.defineProperty;
|
|
46656
46715
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
46657
46716
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -48699,7 +48758,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
48699
48758
|
}
|
|
48700
48759
|
function paths() {
|
|
48701
48760
|
const lt = shared2.ctx.r.lot;
|
|
48702
|
-
if (!lt || !lt.paths) return;
|
|
48761
|
+
if (!lt || !lt.paths || shared2.ctx.noGroundSurfaces) return;
|
|
48703
48762
|
cursor.group = "lot";
|
|
48704
48763
|
for (const c of lt.paths) {
|
|
48705
48764
|
if (c.type === "vehicle" && c.id !== "cargo_path") continue;
|
|
@@ -49993,6 +50052,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
49993
50052
|
__publicField(this, "positions", []);
|
|
49994
50053
|
__publicField(this, "normals", []);
|
|
49995
50054
|
__publicField(this, "indices", []);
|
|
50055
|
+
__publicField(this, "ranges", []);
|
|
50056
|
+
}
|
|
50057
|
+
/** What is added from here on, up to the next call, is the piece `id` (null: no piece). */
|
|
50058
|
+
piece(id) {
|
|
50059
|
+
const v = this.positions.length / 3, i = this.indices.length;
|
|
50060
|
+
const last = this.ranges[this.ranges.length - 1];
|
|
50061
|
+
if (last && last.v1 < 0) {
|
|
50062
|
+
last.v1 = v;
|
|
50063
|
+
last.i1 = i;
|
|
50064
|
+
if (last.v1 === last.v0) this.ranges.pop();
|
|
50065
|
+
}
|
|
50066
|
+
if (id !== null) this.ranges.push({ id, v0: v, v1: -1, i0: i, i1: -1 });
|
|
49996
50067
|
}
|
|
49997
50068
|
get count() {
|
|
49998
50069
|
return this.indices.length / 36;
|
|
@@ -50013,12 +50084,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50013
50084
|
}
|
|
50014
50085
|
/**
|
|
50015
50086
|
* 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.
|
|
50087
|
+
* 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
50088
|
*/
|
|
50018
|
-
addHexahedron(corners) {
|
|
50089
|
+
addHexahedron(corners, open = {}) {
|
|
50019
50090
|
if (corners.length !== 8) return;
|
|
50020
50091
|
const centre = [0, 1, 2].map((k) => corners.reduce((sum, c) => sum + c[k], 0) / 8);
|
|
50021
50092
|
for (const quad of HEXAHEDRON_FACES) {
|
|
50093
|
+
if (open.start && quad === HEXAHEDRON_FACES[0] || open.end && quad === HEXAHEDRON_FACES[1]) continue;
|
|
50022
50094
|
const a = corners[quad[0]], b = corners[quad[1]], c = corners[quad[2]], d = corners[quad[3]];
|
|
50023
50095
|
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
50096
|
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 +50125,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50053
50125
|
/** The mesh of everything added, or null when nothing was. */
|
|
50054
50126
|
mesh(THREE, material, name) {
|
|
50055
50127
|
if (!this.indices.length) return null;
|
|
50128
|
+
this.piece(null);
|
|
50056
50129
|
const geometry = new THREE.BufferGeometry();
|
|
50057
50130
|
geometry.setAttribute("position", new THREE.Float32BufferAttribute(this.positions, 3));
|
|
50058
50131
|
geometry.setAttribute("normal", new THREE.Float32BufferAttribute(this.normals, 3));
|
|
@@ -50063,6 +50136,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50063
50136
|
mesh2.name = name;
|
|
50064
50137
|
mesh2.castShadow = true;
|
|
50065
50138
|
mesh2.receiveShadow = true;
|
|
50139
|
+
if (this.ranges.length) mesh2.userData.ranges = this.ranges.map((range2) => ({ ...range2 }));
|
|
50066
50140
|
return mesh2;
|
|
50067
50141
|
}
|
|
50068
50142
|
};
|
|
@@ -50071,7 +50145,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50071
50145
|
var FEED_Y = -0.6;
|
|
50072
50146
|
var FEED_EXIT_Y = -0.15;
|
|
50073
50147
|
var FEED_BOX_OFFSET = 0.25;
|
|
50074
|
-
|
|
50148
|
+
function chaseDepth(diameter = CHASE_DIAMETER) {
|
|
50149
|
+
return PLASTER_PER_FACE + CHASE_CLEAR + diameter;
|
|
50150
|
+
}
|
|
50151
|
+
var CHASE_DIAMETER = 0.025;
|
|
50152
|
+
var CHASE_CLEAR = 6e-3;
|
|
50075
50153
|
var SLAB_MIDDLE = 0.065;
|
|
50076
50154
|
var CEILING_SLAB = 0.5;
|
|
50077
50155
|
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
@@ -50128,7 +50206,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50128
50206
|
const inward = (alongU ? (box4[1] + box4[3]) / 2 : (box4[0] + box4[2]) / 2) - line;
|
|
50129
50207
|
const side = Math.abs(across2) > 1e-3 ? Math.sign(across2) : inward >= 0 ? 1 : -1;
|
|
50130
50208
|
const half = (wall.thickness ?? DEFAULT_THICKNESS) / 2;
|
|
50131
|
-
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half -
|
|
50209
|
+
const offset = options.surface ? half + (options.diameter ?? 0.02) / 2 : half - chaseDepth(options.diameter);
|
|
50132
50210
|
const at2 = line + side * offset;
|
|
50133
50211
|
return { u: alongU ? along2 : at2, v: alongU ? at2 : along2, wall };
|
|
50134
50212
|
}
|
|
@@ -50804,6 +50882,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
50804
50882
|
}
|
|
50805
50883
|
var PIPE_WALL_FILL = 0.3;
|
|
50806
50884
|
var WALL_PIPE_MASS = 3;
|
|
50885
|
+
var UNDER_SINK_RISER_OFF_WALL = 0.08;
|
|
50886
|
+
var UNDER_SINK_VALVE_RISE = 0.1;
|
|
50807
50887
|
var pipeMass = (diameter, length) => DENSITY.plastic * Math.PI * (diameter / 2) ** 2 * length * PIPE_WALL_FILL;
|
|
50808
50888
|
function installUtilitiesWater(K, shared2) {
|
|
50809
50889
|
const { THREE, _Y, _q, cursor, cylBase, part, pieceRecord, put } = K;
|
|
@@ -51003,7 +51083,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51003
51083
|
}
|
|
51004
51084
|
}
|
|
51005
51085
|
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),
|
|
51086
|
+
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;
|
|
51087
|
+
const pts = riserUnderBack(tr.points.map((p) => [p[0], p[2], p[1]]));
|
|
51007
51088
|
const stage = cursor.stage;
|
|
51008
51089
|
if (shared2.ctx.constructionStages) cursor.stage = "furniture";
|
|
51009
51090
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
@@ -51015,6 +51096,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51015
51096
|
cursor.pc = null;
|
|
51016
51097
|
cursor.stage = stage;
|
|
51017
51098
|
}
|
|
51099
|
+
function riserUnderBack(pts) {
|
|
51100
|
+
if (pts.length < 3 || shared2.ctx.visorScene) return pts;
|
|
51101
|
+
const wall = pts[0], mid = pts[1], dx = mid[0] - wall[0], dz = mid[2] - wall[2], L = Math.hypot(dx, dz);
|
|
51102
|
+
if (L <= UNDER_SINK_RISER_OFF_WALL) return pts;
|
|
51103
|
+
const x = wall[0] + dx / L * UNDER_SINK_RISER_OFF_WALL, z = wall[2] + dz / L * UNDER_SINK_RISER_OFF_WALL;
|
|
51104
|
+
const top = mid[1] + UNDER_SINK_VALVE_RISE;
|
|
51105
|
+
return [wall, ...pts.slice(1).map((p) => [x, Math.min(p[1], top), z])];
|
|
51106
|
+
}
|
|
51018
51107
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
51019
51108
|
Object.assign(K, defined);
|
|
51020
51109
|
}
|
|
@@ -51361,15 +51450,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51361
51450
|
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
51451
|
return { ...solid, aabb };
|
|
51363
51452
|
}
|
|
51364
|
-
var
|
|
51453
|
+
var CHASE_CLEAR2 = 3e-3;
|
|
51365
51454
|
function chasesIn(wall, core, runs) {
|
|
51366
51455
|
const out = [];
|
|
51367
51456
|
for (const r of runs) {
|
|
51368
51457
|
const along2 = wall.alongU ? r.u : r.v, across2 = (wall.alongU ? r.v : r.u) - core.line;
|
|
51369
|
-
if (along2 + r.radius +
|
|
51458
|
+
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
51459
|
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 -
|
|
51460
|
+
const back = Math.abs(across2) - (r.depth ?? r.radius) - CHASE_CLEAR2;
|
|
51461
|
+
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
51462
|
}
|
|
51374
51463
|
return out;
|
|
51375
51464
|
}
|
|
@@ -52899,7 +52988,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52899
52988
|
alias("tv", "flat_tv");
|
|
52900
52989
|
alias("tv_large", "flat_tv");
|
|
52901
52990
|
mine("coffee_table", (M, A) => FURNITURE.table(M, A, { noChairs: true }));
|
|
52902
|
-
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, {
|
|
52991
|
+
mine("coffee_table_round", (M, A) => FURNITURE.table(M, A, { noChairs: true, round: true }));
|
|
52903
52992
|
mine("rug", FURNITURE.rug);
|
|
52904
52993
|
mine("rug_small", FURNITURE.rug, "game (rug)");
|
|
52905
52994
|
mine("shelf_unit", FURNITURE.shelf);
|
|
@@ -53628,17 +53717,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53628
53717
|
}
|
|
53629
53718
|
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
53630
53719
|
var PLANT_CLEAR = 0.04;
|
|
53631
|
-
var PLANT_MIN_REACH = 0.
|
|
53720
|
+
var PLANT_MIN_REACH = 0.12;
|
|
53632
53721
|
var PLANT_SPAN = [0.03, 2.4];
|
|
53722
|
+
var PLANT_HEIGHT_MARGIN = 1.5;
|
|
53633
53723
|
function footprintOf(m) {
|
|
53634
53724
|
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
53725
|
return [m.x - hx, m.z - hz, m.x + hx, m.z + hz];
|
|
53636
53726
|
}
|
|
53637
53727
|
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
53728
|
function freeReachOf(p) {
|
|
53639
|
-
const
|
|
53729
|
+
const tall = p.self.h != null && p.self.h > 0 ? Math.min(PLANT_SPAN[1], p.self.h * PLANT_HEIGHT_MARGIN) : PLANT_SPAN[1];
|
|
53730
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + tall;
|
|
53640
53731
|
let reach2 = Number.POSITIVE_INFINITY;
|
|
53641
|
-
for (const b of p.boxes)
|
|
53732
|
+
for (const b of p.boxes) {
|
|
53733
|
+
if (b[1] >= y1 || b[4] <= y0) continue;
|
|
53734
|
+
if (b[1] > p.y && p.x >= b[0] && p.x <= b[3] && p.z >= b[2] && p.z <= b[5]) continue;
|
|
53735
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, b[0], b[2], b[3], b[5]));
|
|
53736
|
+
}
|
|
53642
53737
|
for (const m of p.items) {
|
|
53643
53738
|
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
53739
|
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
@@ -53702,7 +53797,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53702
53797
|
const covers = [];
|
|
53703
53798
|
for (const m of ordered) {
|
|
53704
53799
|
if (m.type === "stairs") continue;
|
|
53705
|
-
const exterior = m.outdoor || m.floor < 0
|
|
53800
|
+
const exterior = m.outdoor || m.floor < 0;
|
|
53801
|
+
if (exterior && m.category === "ground_cover" && shared2.ctx.noGroundSurfaces) continue;
|
|
53802
|
+
const f = exterior ? -1 : Math.min(m.floor, R.floors.length - 1);
|
|
53706
53803
|
cursor.group = exterior && !(m.type === "cooking_gas_cylinder" && m.shelter && !shared2.ctx.visorScene) ? "lot" : "f" + Math.max(f, 0);
|
|
53707
53804
|
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
53805
|
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 +54845,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54748
54845
|
const defined = { targetOf };
|
|
54749
54846
|
Object.assign(K, defined);
|
|
54750
54847
|
}
|
|
54848
|
+
var CORD_RADIUS = 6e-3;
|
|
54751
54849
|
function installInteractablesBridge(K, shared2) {
|
|
54752
54850
|
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString: hashString2, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
54753
54851
|
const enter = (...a) => K.enter(...a);
|
|
@@ -54893,9 +54991,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54893
54991
|
const spec = ik.A.household.build(type, loc, mesh2.api);
|
|
54894
54992
|
const out = mesh2.finish(spec);
|
|
54895
54993
|
for (const l of out.lights) l.removeFromParent();
|
|
54896
|
-
const group = ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
54994
|
+
const group = type === "gas_bottle" && item.shelter && !shared2.ctx.visorScene ? "f0" : ivGroup(ent), g0 = cursor.group, stage0 = cursor.stage, root = new THREE.Group();
|
|
54897
54995
|
root.name = "iv:" + ent.id;
|
|
54898
|
-
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance"
|
|
54996
|
+
const isInst = type === "electrical_panel" || type === "power_meter" || type === "service_entrance";
|
|
54899
54997
|
const isPlate = type === "wall_switch" || type === "wall_socket";
|
|
54900
54998
|
const ivStage = shared2.ctx.constructionStages ? isInst ? "installations" : isPlate ? "finishes" : "furniture" : void 0;
|
|
54901
54999
|
if (ivStage) root.userData.constructionStage = ivStage;
|
|
@@ -54951,6 +55049,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54951
55049
|
if (root.children.length) IV.roots.push(E);
|
|
54952
55050
|
return spec;
|
|
54953
55051
|
}
|
|
55052
|
+
const floorFinishOf = (floor) => shared2.ctx.constructionStages && !shared2.ctx.visorScene && floor === 0 ? FLOOR_OVER_GROUND : 0;
|
|
54954
55053
|
function ivCords(IV) {
|
|
54955
55054
|
const ik = IV.k, w = IV.world, wl = (o, p) => ik.GI.localToWorld(o.transform, p), g0 = cursor.group;
|
|
54956
55055
|
const tube2 = (pts, radius, color2, ox, oy, oz, ry) => {
|
|
@@ -54977,15 +55076,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54977
55076
|
if (!so || !sk) continue;
|
|
54978
55077
|
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
54979
55078
|
if (last[1] < 0.3 + E.pos[1]) {
|
|
54980
|
-
const
|
|
54981
|
-
|
|
55079
|
+
const lie = E.pos[1] + floorFinishOf(E.floor) + CORD_RADIUS + 1e-3;
|
|
55080
|
+
const foot = [sp[0] + dir[0] * 0.035, lie, sp[2] + dir[1] * 0.035];
|
|
55081
|
+
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
55082
|
} else {
|
|
54983
55083
|
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
55084
|
hang.shift();
|
|
54985
55085
|
for (const p of hang) pts.push(p);
|
|
54986
55086
|
}
|
|
54987
55087
|
shared2.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
54988
|
-
tube2(pts,
|
|
55088
|
+
tube2(pts, CORD_RADIUS, IV_WIRE.cord, 0, 0, 0, 0);
|
|
54989
55089
|
}
|
|
54990
55090
|
}
|
|
54991
55091
|
} finally {
|
|
@@ -57834,6 +57934,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57834
57934
|
return level >= STAGE_LEVEL.openings;
|
|
57835
57935
|
case "roof":
|
|
57836
57936
|
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
57937
|
+
// 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
|
|
57938
|
+
case "roofFraming":
|
|
57939
|
+
return level >= STAGE_LEVEL.roofFraming && opts.roofLayer !== false;
|
|
57837
57940
|
case "furniture":
|
|
57838
57941
|
return level >= STAGE_LEVEL.last;
|
|
57839
57942
|
// the protective sidewalk round the house: the last of the work outside
|
|
@@ -57899,6 +58002,50 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57899
58002
|
}
|
|
57900
58003
|
return level;
|
|
57901
58004
|
}
|
|
58005
|
+
function partStagesOf(house) {
|
|
58006
|
+
const stages = /* @__PURE__ */ new Map();
|
|
58007
|
+
const walk = (o, inherited) => {
|
|
58008
|
+
const own = typeof o.userData?.constructionStage === "string" ? o.userData.constructionStage : inherited;
|
|
58009
|
+
const part = o.userData?.destructionPart;
|
|
58010
|
+
if (own && typeof part === "string" && !stages.has(part)) stages.set(part, own);
|
|
58011
|
+
const ranges = o.userData?.ranges;
|
|
58012
|
+
if (own && Array.isArray(ranges)) {
|
|
58013
|
+
for (const range2 of ranges) if (!stages.has(range2.id)) stages.set(range2.id, own);
|
|
58014
|
+
}
|
|
58015
|
+
for (const c of o.children) walk(c, own);
|
|
58016
|
+
};
|
|
58017
|
+
walk(house, void 0);
|
|
58018
|
+
return stages;
|
|
58019
|
+
}
|
|
58020
|
+
function stageOfPiece(piece2, stages) {
|
|
58021
|
+
let found;
|
|
58022
|
+
piece2.root.traverse((o) => {
|
|
58023
|
+
if (found) return;
|
|
58024
|
+
const part = o.userData?.destructionPart;
|
|
58025
|
+
if (typeof part === "string") found = stages.get(part);
|
|
58026
|
+
});
|
|
58027
|
+
return found;
|
|
58028
|
+
}
|
|
58029
|
+
function stageLoosePieces(pieces, stages, level, opts, held) {
|
|
58030
|
+
let hidden = 0;
|
|
58031
|
+
for (const piece2 of pieces) {
|
|
58032
|
+
const stage = stageOfPiece(piece2, stages);
|
|
58033
|
+
if (!stage) continue;
|
|
58034
|
+
const shown2 = stageVisible(stage, level, opts);
|
|
58035
|
+
piece2.root.visible = shown2;
|
|
58036
|
+
if (!shown2) {
|
|
58037
|
+
hidden++;
|
|
58038
|
+
if (!piece2.held) {
|
|
58039
|
+
piece2.held = true;
|
|
58040
|
+
held.add(piece2);
|
|
58041
|
+
}
|
|
58042
|
+
} else if (held.has(piece2)) {
|
|
58043
|
+
piece2.held = false;
|
|
58044
|
+
held.delete(piece2);
|
|
58045
|
+
}
|
|
58046
|
+
}
|
|
58047
|
+
return hidden;
|
|
58048
|
+
}
|
|
57902
58049
|
var INSTALLATIONS_STAGE = "stage:4:installations";
|
|
57903
58050
|
function toWorld2(THREE, object2, x, z) {
|
|
57904
58051
|
return new THREE.Vector3(x, 0, z).applyMatrix4(object2.matrixWorld);
|
|
@@ -57930,24 +58077,53 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57930
58077
|
hip: { top: 0.065, width: 0.06, height: 0.14 },
|
|
57931
58078
|
post: { side: 0.07, spacing: 2 }
|
|
57932
58079
|
};
|
|
58080
|
+
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
58081
|
var EDGE2 = 0.04;
|
|
57934
|
-
|
|
58082
|
+
var ROOF_TIMBER_STRETCH = 1.2;
|
|
58083
|
+
var ROOF_TIMBER_MATERIAL = "wood_hard";
|
|
58084
|
+
var TIMBER_DENSITY = 750;
|
|
58085
|
+
var TimberLog = class {
|
|
58086
|
+
constructor(prefix, onPiece) {
|
|
58087
|
+
__publicField(this, "prefix", prefix);
|
|
58088
|
+
__publicField(this, "onPiece", onPiece);
|
|
58089
|
+
__publicField(this, "count", 0);
|
|
58090
|
+
}
|
|
58091
|
+
next(kind, mass, chain) {
|
|
58092
|
+
const id = `${this.prefix}:${this.count++}`;
|
|
58093
|
+
this.onPiece({ id, kind, mass, chain });
|
|
58094
|
+
return id;
|
|
58095
|
+
}
|
|
58096
|
+
};
|
|
58097
|
+
var LOGS = /* @__PURE__ */ new WeakMap();
|
|
58098
|
+
function addTimber(batch, top0, top1, width, height, kind) {
|
|
57935
58099
|
const dx = top1[0] - top0[0], dz = top1[2] - top0[2];
|
|
57936
58100
|
const flat = Math.hypot(dx, dz);
|
|
57937
58101
|
if (flat < 1e-4 && Math.abs(top1[1] - top0[1]) < 1e-4) return;
|
|
57938
58102
|
const sx = flat < 1e-4 ? width / 2 : -dz / flat * (width / 2);
|
|
57939
58103
|
const sz = flat < 1e-4 ? 0 : dx / flat * (width / 2);
|
|
57940
58104
|
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
|
-
|
|
58105
|
+
const log = LOGS.get(batch);
|
|
58106
|
+
const length = Math.hypot(dx, top1[1] - top0[1], dz);
|
|
58107
|
+
const stretches = log ? Math.max(1, Math.ceil(length / ROOF_TIMBER_STRETCH)) : 1;
|
|
58108
|
+
let before = null;
|
|
58109
|
+
for (let k = 0; k < stretches; k++) {
|
|
58110
|
+
const a = along(top0, top1, k / stretches), b = along(top0, top1, (k + 1) / stretches);
|
|
58111
|
+
if (log) {
|
|
58112
|
+
before = log.next(kind, TIMBER_DENSITY * width * height * (length / stretches), before ? [before] : []);
|
|
58113
|
+
batch.piece(before);
|
|
58114
|
+
}
|
|
58115
|
+
batch.addHexahedron([
|
|
58116
|
+
corner(a, -1, height),
|
|
58117
|
+
corner(a, 1, height),
|
|
58118
|
+
corner(a, 1, 0),
|
|
58119
|
+
corner(a, -1, 0),
|
|
58120
|
+
corner(b, -1, height),
|
|
58121
|
+
corner(b, 1, height),
|
|
58122
|
+
corner(b, 1, 0),
|
|
58123
|
+
corner(b, -1, 0)
|
|
58124
|
+
], { start: k > 0, end: k < stretches - 1 });
|
|
58125
|
+
}
|
|
58126
|
+
if (log) batch.piece(null);
|
|
57951
58127
|
}
|
|
57952
58128
|
var KEEP_OUT_GAP = 0.03;
|
|
57953
58129
|
function clearStretches(top0, top1, width, height, keepOut) {
|
|
@@ -57971,16 +58147,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57971
58147
|
}
|
|
57972
58148
|
return stretches;
|
|
57973
58149
|
}
|
|
57974
|
-
|
|
57975
|
-
function addTimberAround(batch, top0, top1, width, height, keepOut, onCut) {
|
|
58150
|
+
function addTimberAround(batch, top0, top1, width, height, kind, keepOut, onCut) {
|
|
57976
58151
|
if (!keepOut.length) {
|
|
57977
|
-
addTimber(batch, top0, top1, width, height);
|
|
58152
|
+
addTimber(batch, top0, top1, width, height, kind);
|
|
57978
58153
|
return;
|
|
57979
58154
|
}
|
|
57980
58155
|
const length = Math.hypot(top1[0] - top0[0], top1[1] - top0[1], top1[2] - top0[2]);
|
|
57981
58156
|
for (const [f0, f1] of clearStretches(top0, top1, width, height, keepOut)) {
|
|
57982
58157
|
if ((f1 - f0) * length < 0.05) continue;
|
|
57983
|
-
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height);
|
|
58158
|
+
addTimber(batch, along(top0, top1, f0), along(top0, top1, f1), width, height, kind);
|
|
57984
58159
|
const inset = TIMBER.post.side / 2 / Math.max(length, 1e-6);
|
|
57985
58160
|
if (f0 > 0) onCut?.(along(top0, top1, Math.min(f1, f0 + inset)));
|
|
57986
58161
|
if (f1 < 1) onCut?.(along(top0, top1, Math.max(f0, f1 - inset)));
|
|
@@ -57989,7 +58164,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57989
58164
|
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
58165
|
function addPost(batch, x, z, y0, y1) {
|
|
57991
58166
|
const h = TIMBER.post.side / 2;
|
|
57992
|
-
if (y1 - y0
|
|
58167
|
+
if (y1 - y0 <= 0.02) return;
|
|
58168
|
+
const log = LOGS.get(batch);
|
|
58169
|
+
if (log) batch.piece(log.next("post", TIMBER_DENSITY * TIMBER.post.side * TIMBER.post.side * (y1 - y0), []));
|
|
58170
|
+
batch.add([x - h, y0, z - h, x + h, y1, z + h], true);
|
|
58171
|
+
if (log) batch.piece(null);
|
|
57993
58172
|
}
|
|
57994
58173
|
function slopesOf(rect) {
|
|
57995
58174
|
const [x0, z0, x1, z1] = rect.exterior;
|
|
@@ -58047,7 +58226,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58047
58226
|
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
58048
58227
|
if (b - a <= 0.05) continue;
|
|
58049
58228
|
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);
|
|
58229
|
+
addTimberAround(batches.battens, down(slope.point(at2, a), batten.top), down(slope.point(at2, b), batten.top), batten.width, batten.height, "batten", keepOut);
|
|
58051
58230
|
}
|
|
58052
58231
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
58053
58232
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -58057,7 +58236,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58057
58236
|
if (end < 0.1) continue;
|
|
58058
58237
|
const axis = slope.point(0, 1)[0] - slope.point(0, 0)[0] !== 0 ? 0 : 2;
|
|
58059
58238
|
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);
|
|
58239
|
+
addTimberAround(batches.timber, down(slope.point(EDGE2, t), rafter.top), down(slope.point(end, t), rafter.top), rafter.width, rafter.height, "rafter", keepOut);
|
|
58061
58240
|
}
|
|
58062
58241
|
const lines = [slope.wall, slope.wall + (slope.run - slope.wall) / 3, slope.wall + (slope.run - slope.wall) * 2 / 3];
|
|
58063
58242
|
lines.forEach((s, k) => {
|
|
@@ -58067,7 +58246,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58067
58246
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
58068
58247
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
58069
58248
|
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));
|
|
58249
|
+
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
58250
|
if (k === 0) return;
|
|
58072
58251
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
58073
58252
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -58099,10 +58278,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58099
58278
|
}
|
|
58100
58279
|
return out;
|
|
58101
58280
|
}
|
|
58102
|
-
function buildRoofFramingStage(THREE, roofRects, material, solids = [], keepOut = []) {
|
|
58281
|
+
function buildRoofFramingStage(THREE, roofRects, material, solids = [], keepOut = [], onPiece) {
|
|
58103
58282
|
const group = new THREE.Group();
|
|
58104
58283
|
group.name = "stage:7:roof_framing";
|
|
58105
58284
|
const timber = new BoxBatch(), battens = new BoxBatch();
|
|
58285
|
+
if (onPiece) {
|
|
58286
|
+
LOGS.set(timber, new TimberLog("roof_timber", onPiece));
|
|
58287
|
+
LOGS.set(battens, new TimberLog("roof_batten", onPiece));
|
|
58288
|
+
}
|
|
58106
58289
|
for (const rr of roofRects) {
|
|
58107
58290
|
if (rr.slab || rr.yb === void 0 || rr.tp === void 0 || !rr.exterior || rr.rm === void 0 || rr.alongX === void 0) continue;
|
|
58108
58291
|
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 +58296,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58113
58296
|
const xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
58114
58297
|
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
58298
|
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));
|
|
58299
|
+
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
58300
|
const along2 = Math.hypot(ends[1][0] - ends[0][0], ends[1][2] - ends[0][2]);
|
|
58118
58301
|
const posts = Math.max(1, Math.ceil(along2 / TIMBER.post.spacing));
|
|
58119
58302
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -58129,12 +58312,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58129
58312
|
const corners = [[x0 + e, h, z0 + e], [x1 - e, h, z0 + e], [x0 + e, h, z1 - e], [x1 - e, h, z1 - e]];
|
|
58130
58313
|
for (const c of corners) {
|
|
58131
58314
|
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);
|
|
58315
|
+
addTimberAround(timber, down(c, TIMBER.hip.top), down(end, TIMBER.hip.top), TIMBER.hip.width, TIMBER.hip.height, "hip", keepOut);
|
|
58133
58316
|
}
|
|
58134
58317
|
}
|
|
58135
58318
|
}
|
|
58136
58319
|
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")])
|
|
58320
|
+
for (const mesh2 of [timber.mesh(THREE, wood, "roof_framing:timber"), battens.mesh(THREE, wood, "roof_framing:battens")]) {
|
|
58321
|
+
if (!mesh2) continue;
|
|
58322
|
+
mesh2.userData.constructionStage = "roofFraming";
|
|
58323
|
+
if (onPiece) mesh2.userData.destructionMaterial = ROOF_TIMBER_MATERIAL;
|
|
58324
|
+
group.add(mesh2);
|
|
58325
|
+
}
|
|
58138
58326
|
return group;
|
|
58139
58327
|
}
|
|
58140
58328
|
var HOUSE_SHADOW_BUDGET_MS = 2;
|
|
@@ -58177,6 +58365,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58177
58365
|
}
|
|
58178
58366
|
};
|
|
58179
58367
|
}
|
|
58368
|
+
var ROOF_TIMBER_REACH = 3;
|
|
58180
58369
|
function withLaidConduits(r, stages) {
|
|
58181
58370
|
const E = r.utilities?.electrical;
|
|
58182
58371
|
if (!stages || !E || !E.conduits?.length) return r;
|
|
@@ -58234,7 +58423,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58234
58423
|
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
58424
|
}
|
|
58236
58425
|
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;
|
|
58426
|
+
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
58427
|
function build(r0, options) {
|
|
58239
58428
|
const opts = options || {};
|
|
58240
58429
|
const r = withLaidConduits(applyOutbuildings(r0), !!(opts.constructionStages || opts.constructionLevel != null));
|
|
@@ -58252,6 +58441,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58252
58441
|
shared2.ctx.colliders = [];
|
|
58253
58442
|
shared2.ctx.stairs = [];
|
|
58254
58443
|
shared2.ctx.noTerrain = opts.terrain === false;
|
|
58444
|
+
shared2.ctx.noGroundSurfaces = opts.groundSurfaces === false;
|
|
58255
58445
|
shared2.ctx.serviceFrom = opts.serviceFrom ?? null;
|
|
58256
58446
|
shared2.ctx.roomById = {};
|
|
58257
58447
|
for (const c of r.rooms) shared2.ctx.roomById[c.id] = c;
|
|
@@ -58403,6 +58593,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58403
58593
|
(k === "floor" || k === "building" ? root : house).add(g);
|
|
58404
58594
|
}
|
|
58405
58595
|
let currentConstructionLevel = CONSTRUCTION_LEVEL_MAX;
|
|
58596
|
+
let partStages = null, stageOptsNow = {}, piecesStaged = -1;
|
|
58597
|
+
const stageHeld = /* @__PURE__ */ new Set();
|
|
58406
58598
|
h.groups = gs;
|
|
58407
58599
|
h.root = root;
|
|
58408
58600
|
h.house = house;
|
|
@@ -58583,22 +58775,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58583
58775
|
return house.localToWorld(localCenter.clone());
|
|
58584
58776
|
};
|
|
58585
58777
|
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
58778
|
if (cs) {
|
|
58591
58779
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
58592
58780
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared2.ctx.wallBoxShifts)], shared2.ctx.blockLaid ?? []);
|
|
58593
58781
|
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 ?? [])])
|
|
58782
|
+
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) => {
|
|
58783
|
+
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 } : {} });
|
|
58784
|
+
});
|
|
58595
58785
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
58596
58786
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
58597
58787
|
gs[sg.name] = sg;
|
|
58598
58788
|
house.add(sg);
|
|
58599
58789
|
}
|
|
58600
|
-
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
58601
58790
|
}
|
|
58791
|
+
markGroups(r, root, parts2);
|
|
58792
|
+
const structure = assembleStructure(r0, root), destruction = createHouseDestruction(root, house, structure, parts2, colliders, water);
|
|
58793
|
+
h.destruction = destruction;
|
|
58794
|
+
destruction.breach.setLod(h.lodCurrent);
|
|
58795
|
+
if (cs) {
|
|
58796
|
+
currentConstructionLevel = applyConstructionLevel(house, opts.constructionLevel ?? CONSTRUCTION_LEVEL_MAX);
|
|
58797
|
+
partStages = partStagesOf(house);
|
|
58798
|
+
}
|
|
58799
|
+
const stagePieces = () => {
|
|
58800
|
+
const R = destruction.renderer;
|
|
58801
|
+
if (!partStages || !R?.pieces) return;
|
|
58802
|
+
const list2 = R.pieces();
|
|
58803
|
+
piecesStaged = list2.length;
|
|
58804
|
+
stageLoosePieces(list2, partStages, currentConstructionLevel, stageOptsNow, stageHeld);
|
|
58805
|
+
};
|
|
58602
58806
|
const strikePiece = (id, point, type, amount, d, before) => {
|
|
58603
58807
|
if (!destruction.world) return;
|
|
58604
58808
|
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 +58884,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58680
58884
|
// 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
58885
|
update(dt, time, focus) {
|
|
58682
58886
|
enter(h);
|
|
58887
|
+
if (partStages && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX && destruction.renderer?.pieces && destruction.renderer.pieces().length !== piecesStaged) stagePieces();
|
|
58683
58888
|
animateDoors(dt);
|
|
58684
58889
|
animateInteractive(dt);
|
|
58685
58890
|
water.step(dt);
|
|
@@ -58713,12 +58918,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58713
58918
|
g.visible = v;
|
|
58714
58919
|
}
|
|
58715
58920
|
if (cs && currentConstructionLevel < CONSTRUCTION_LEVEL_MAX) {
|
|
58716
|
-
|
|
58921
|
+
stageOptsNow = { roofLayer: !cut && sel < 0, lotLayer: o.lot !== false };
|
|
58922
|
+
applyConstructionLevel(house, currentConstructionLevel, stageOptsNow);
|
|
58923
|
+
stagePieces();
|
|
58717
58924
|
}
|
|
58718
58925
|
},
|
|
58719
58926
|
setConstructionLevel(level, stageOpts) {
|
|
58720
58927
|
enter(h);
|
|
58928
|
+
stageOptsNow = stageOpts ?? {};
|
|
58721
58929
|
currentConstructionLevel = applyConstructionLevel(house, level, stageOpts);
|
|
58930
|
+
stagePieces();
|
|
58722
58931
|
invalidateShadow();
|
|
58723
58932
|
return currentConstructionLevel;
|
|
58724
58933
|
},
|
|
@@ -59091,6 +59300,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59091
59300
|
}
|
|
59092
59301
|
var FLOOR_TOUCH2 = 5e-3;
|
|
59093
59302
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
59303
|
+
var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
|
|
59094
59304
|
var BASE_MATERIAL = {
|
|
59095
59305
|
wood: "wood_hard",
|
|
59096
59306
|
metal: "steel",
|
|
@@ -59202,7 +59412,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59202
59412
|
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
59203
59413
|
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
59204
59414
|
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;
|
|
59415
|
+
const fixed = wallMounted || sunk || rooted || PLANTED.has(name);
|
|
59206
59416
|
const all = drawn.reduce(
|
|
59207
59417
|
(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
59418
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|