@adatechnology/game-weapons-three 0.23.0 → 0.24.0
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/README.md +2 -0
- package/dist/{chunk-7BPQ2GZM.js → chunk-UUBO6H5O.js} +89 -7
- package/dist/chunk-UUBO6H5O.js.map +1 -0
- package/dist/index.d.ts +40 -2
- package/dist/index.global.js +453 -87
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +12 -11
- package/dist/chunk-7BPQ2GZM.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -38,6 +38,7 @@ var GameWeaponsThree = (() => {
|
|
|
38
38
|
GUNSHOT_PROFILES: () => GUNSHOT_PROFILES,
|
|
39
39
|
GUNSHOT_SAMPLE: () => GUNSHOT_SAMPLE,
|
|
40
40
|
GUNSHOT_SAMPLE_IDS: () => GUNSHOT_SAMPLE_IDS,
|
|
41
|
+
HOLSTER_PLACEMENT: () => HOLSTER_PLACEMENT,
|
|
41
42
|
LAUNCH_SAMPLE: () => LAUNCH_SAMPLE,
|
|
42
43
|
LAUNCH_SOUND_IDS: () => LAUNCH_SOUND_IDS,
|
|
43
44
|
MECHANICAL_SOUNDS: () => MECHANICAL_SOUNDS,
|
|
@@ -74,6 +75,7 @@ var GameWeaponsThree = (() => {
|
|
|
74
75
|
computeGunshot: () => computeGunshot,
|
|
75
76
|
computeShotSound: () => computeShotSound,
|
|
76
77
|
createExplosivesTestModule: () => createExplosivesTestModule,
|
|
78
|
+
createHolsteredWeapons: () => createHolsteredWeapons,
|
|
77
79
|
createWeaponAudio: () => createWeaponAudio,
|
|
78
80
|
createWeaponFx: () => createWeaponFx,
|
|
79
81
|
createWeaponProps: () => createWeaponProps,
|
|
@@ -87,6 +89,7 @@ var GameWeaponsThree = (() => {
|
|
|
87
89
|
hasExplosiveModel: () => hasExplosiveModel,
|
|
88
90
|
hasThrowableModel: () => hasThrowableModel,
|
|
89
91
|
hasWeaponModel: () => hasWeaponModel,
|
|
92
|
+
holsteredModel: () => holsteredModel,
|
|
90
93
|
itemModelOfWeapon: () => itemModelOfWeapon,
|
|
91
94
|
mechanicalSoundOf: () => mechanicalSoundOf,
|
|
92
95
|
modelKit: () => modelKit,
|
|
@@ -3455,7 +3458,8 @@ var GameWeaponsThree = (() => {
|
|
|
3455
3458
|
},
|
|
3456
3459
|
mass: 5.5,
|
|
3457
3460
|
tags: [
|
|
3458
|
-
"heavy"
|
|
3461
|
+
"heavy",
|
|
3462
|
+
"two_handed"
|
|
3459
3463
|
]
|
|
3460
3464
|
},
|
|
3461
3465
|
{
|
|
@@ -3539,7 +3543,10 @@ var GameWeaponsThree = (() => {
|
|
|
3539
3543
|
rpm: 45,
|
|
3540
3544
|
noise: 8
|
|
3541
3545
|
},
|
|
3542
|
-
mass: 1.6
|
|
3546
|
+
mass: 1.6,
|
|
3547
|
+
tags: [
|
|
3548
|
+
"two_handed"
|
|
3549
|
+
]
|
|
3543
3550
|
},
|
|
3544
3551
|
{
|
|
3545
3552
|
id: "knife",
|
|
@@ -14725,7 +14732,8 @@ var GameWeaponsThree = (() => {
|
|
|
14725
14732
|
},
|
|
14726
14733
|
mass: 2.8,
|
|
14727
14734
|
tags: [
|
|
14728
|
-
"heavy"
|
|
14735
|
+
"heavy",
|
|
14736
|
+
"two_handed"
|
|
14729
14737
|
]
|
|
14730
14738
|
},
|
|
14731
14739
|
{
|
|
@@ -14803,7 +14811,8 @@ var GameWeaponsThree = (() => {
|
|
|
14803
14811
|
},
|
|
14804
14812
|
mass: 6,
|
|
14805
14813
|
tags: [
|
|
14806
|
-
"heavy"
|
|
14814
|
+
"heavy",
|
|
14815
|
+
"two_handed"
|
|
14807
14816
|
]
|
|
14808
14817
|
},
|
|
14809
14818
|
{
|
|
@@ -15364,6 +15373,14 @@ var GameWeaponsThree = (() => {
|
|
|
15364
15373
|
// tucking a pistol in the belt and drawing it back is a short motion of one hand
|
|
15365
15374
|
stowSeconds: 0.45
|
|
15366
15375
|
},
|
|
15376
|
+
// as mãos de cada arma e onde ela vai quando as mãos são pedidas (decisão do dono, 2026-11-24): arma longa pede as duas mãos; a de cinto vai no coldre, a longa na bandoleira ou nas costas
|
|
15377
|
+
hands: {
|
|
15378
|
+
twoHanded: { categories: ["smg", "rifle", "carbine", "sniper", "dmr", "hunting", "machine_gun", "launcher", "shotgun", "bow", "crossbow", "extinguisher"], weapons: ["flamethrower"] },
|
|
15379
|
+
slots: { pistol: "hip", revolver: "hip", melee_blade: "hip", melee_blunt: "hip", tool: "hip", throwable: "hip", heat: "hip", smg: "back", rifle: "back", carbine: "back", sniper: "back", dmr: "back", hunting: "back", shotgun: "back", bow: "back", crossbow: "back", machine_gun: "back", launcher: "back" },
|
|
15380
|
+
// the long-handled tools and the long blade hang across the back; a chainsaw has no place on the body
|
|
15381
|
+
weaponSlots: { lighter: "hip", flamethrower: "back", axe: "back", sledgehammer: "back", pickaxe: "back", shovel: "back", katana: "back", chainsaw: null },
|
|
15382
|
+
bare: ["kick", "shove", "fists"]
|
|
15383
|
+
},
|
|
15367
15384
|
// Arsenal §08/§11: coronha retrátil saca mais rápido, mais recuo; os números são padrões aprovados pelo dono (2026-10-24)
|
|
15368
15385
|
stock: {
|
|
15369
15386
|
seconds: 0.6,
|
|
@@ -29813,6 +29830,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29813
29830
|
return j.st.progress;
|
|
29814
29831
|
}).value;
|
|
29815
29832
|
},
|
|
29833
|
+
take(objectId, partId) {
|
|
29834
|
+
if (impls.has(objectId)) return null;
|
|
29835
|
+
const o = getObj(objectId);
|
|
29836
|
+
const part = o.byId.get(partId);
|
|
29837
|
+
const hands = part?.spec.hands;
|
|
29838
|
+
if (!part || !hands || isLost(part)) return null;
|
|
29839
|
+
const holding = (o.byPart.get(partId) ?? []).filter((j) => !j.st.open);
|
|
29840
|
+
if (holding.length === 0 || holding.some((j) => !j.spec.tools.includes("hand"))) return null;
|
|
29841
|
+
run(() => {
|
|
29842
|
+
for (const j of holding) {
|
|
29843
|
+
j.st.progress = 1;
|
|
29844
|
+
j.st.open = true;
|
|
29845
|
+
j.st.openedBy = "tool";
|
|
29846
|
+
}
|
|
29847
|
+
loosened(o, holding, "tool");
|
|
29848
|
+
collapseCheck(o);
|
|
29849
|
+
});
|
|
29850
|
+
return hands;
|
|
29851
|
+
},
|
|
29816
29852
|
workableJoints(objectId, tool2) {
|
|
29817
29853
|
const im = impls.get(objectId);
|
|
29818
29854
|
if (im) {
|
|
@@ -30704,6 +30740,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30704
30740
|
outdoor_bin: TRASH,
|
|
30705
30741
|
china_cabinet: [entry("china_plates", 3, 6, "utensil", false, 3), entry("wine_glasses", 2, 5, "utensil", false, 2)]
|
|
30706
30742
|
};
|
|
30743
|
+
var NETWORK_POST = { h: 6, anchor: 5.7, half: 0.07, bracket: 0.06, conduitOff: 0.025 };
|
|
30707
30744
|
var DEFAULT_LAMP_TYPE = "bulb_e27";
|
|
30708
30745
|
var OUTBUILDING_ROOM_TYPE = { guest_room: "bedroom", office: "office", storage: "stockroom", gourmet: "living" };
|
|
30709
30746
|
var CEILING_LIGHT = 0.35;
|
|
@@ -30835,8 +30872,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30835
30872
|
const twoWay = Math.max(width, depth) < 2 * Math.min(width, depth) && Math.max(width, depth) <= options.twoWayMaxSpan + options.lineTolerance;
|
|
30836
30873
|
if (Math.min(width, depth) > options.maxSpan + options.lineTolerance && !twoWay) {
|
|
30837
30874
|
const longer = width >= depth ? "v" : "u";
|
|
30838
|
-
const
|
|
30839
|
-
const pool = candidates.filter((c) => c.coverage >= PARTIAL_WALL && (
|
|
30875
|
+
const square2 = Math.abs(width - depth) <= options.lineTolerance;
|
|
30876
|
+
const pool = candidates.filter((c) => c.coverage >= PARTIAL_WALL && (square2 || c.dir === longer));
|
|
30840
30877
|
if (pool.length) {
|
|
30841
30878
|
const best2 = pool.reduce((a, b) => b.coverage - 0.25 * b.skew > a.coverage - 0.25 * a.skew ? b : a);
|
|
30842
30879
|
return { dir: best2.dir, at: round(best2.at) };
|
|
@@ -32465,6 +32502,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32465
32502
|
});
|
|
32466
32503
|
}
|
|
32467
32504
|
var towerLocales = { en: { labels: en_default.labels }, "pt-BR": { labels: pt_BR_default.labels } };
|
|
32505
|
+
var MAST_PIPE_RADIUS = 0.021;
|
|
32506
|
+
var WEATHERHEAD = { bend: 0.08, capRadius: 0.032, capLength: 0.06, segments: 8 };
|
|
32507
|
+
var round32 = (value) => Math.round(value * 1e3) / 1e3;
|
|
32508
|
+
function mastPathOf(mast) {
|
|
32509
|
+
const { bend, segments } = WEATHERHEAD;
|
|
32510
|
+
const arc = Array.from({ length: segments }, (_, index) => {
|
|
32511
|
+
const angle = Math.PI * (index + 1) / segments;
|
|
32512
|
+
return [mast.u, round32(mast.v - bend + bend * Math.cos(angle)), round32(mast.y1 + bend * Math.sin(angle))];
|
|
32513
|
+
});
|
|
32514
|
+
return [[mast.u, mast.v, mast.y0], [mast.u, mast.v, mast.y1], ...arc];
|
|
32515
|
+
}
|
|
32468
32516
|
|
|
32469
32517
|
// ../game-items-goods/dist/index.js
|
|
32470
32518
|
var FLOORPLAN_POOL_KEYS = {
|
|
@@ -51029,6 +51077,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51029
51077
|
wall_switch: { body: { material: "plastic", joint: "screw" }, parts: [["rocker", { material: "plastic", joint: "clip", piece: "rocker" }]] },
|
|
51030
51078
|
service_entrance: { body: { material: "steel", joint: "bolt" }, parts: [["meter_door", door("steel")]] },
|
|
51031
51079
|
conduit_run: { body: { material: "plastic", joint: "clip" }, parts: [] },
|
|
51080
|
+
service_mast: { body: { material: "steel", joint: "clip" }, parts: [] },
|
|
51032
51081
|
electrical_panel: {
|
|
51033
51082
|
body: { material: "steel", joint: "screw" },
|
|
51034
51083
|
parts: [[/^breaker/, { material: "plastic", joint: "clip", piece: "breaker" }], ["door", door("steel")]]
|
|
@@ -51103,6 +51152,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51103
51152
|
"type.wall_socket": "Wall socket",
|
|
51104
51153
|
"type.wall_switch": "Light switch",
|
|
51105
51154
|
"type.service_entrance": "Service entrance pole",
|
|
51155
|
+
"type.service_mast": "Service mast (pontalete)",
|
|
51106
51156
|
"type.conduit_run": "Conduit run",
|
|
51107
51157
|
"type.tv": "Television",
|
|
51108
51158
|
"type.microwave": "Microwave",
|
|
@@ -51345,6 +51395,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51345
51395
|
"type.wall_socket": "Tomada",
|
|
51346
51396
|
"type.wall_switch": "Interruptor",
|
|
51347
51397
|
"type.service_entrance": "Poste de entrada de energia",
|
|
51398
|
+
"type.service_mast": "Pontalete de entrada de energia",
|
|
51348
51399
|
"type.conduit_run": "Eletroduto",
|
|
51349
51400
|
"type.tv": "Televis\xE3o",
|
|
51350
51401
|
"type.microwave": "Micro-ondas",
|
|
@@ -51845,6 +51896,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
51845
51896
|
solid: true,
|
|
51846
51897
|
massKg: 60
|
|
51847
51898
|
},
|
|
51899
|
+
{
|
|
51900
|
+
id: "service_mast",
|
|
51901
|
+
group: "electrical",
|
|
51902
|
+
w: 0.1,
|
|
51903
|
+
d: 0.25,
|
|
51904
|
+
h: 4.4,
|
|
51905
|
+
y: 0,
|
|
51906
|
+
solid: true,
|
|
51907
|
+
massKg: 14
|
|
51908
|
+
},
|
|
51848
51909
|
{
|
|
51849
51910
|
id: "electrical_panel",
|
|
51850
51911
|
group: "electrical",
|
|
@@ -53258,11 +53319,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53258
53319
|
house: [r3(K.x(end3[0]) - px), end3[2], r3(K.z(end3[1]) - pz)]
|
|
53259
53320
|
};
|
|
53260
53321
|
if (ee.tap || electrical.mode === "tap") item.variant = "gato";
|
|
53322
|
+
else if (ee.street === "network") item.variant = "network";
|
|
53261
53323
|
const e = entry2("service_entrance", "service_entrance", item, "service_entrance", -1);
|
|
53262
53324
|
push(e);
|
|
53263
53325
|
result2.serviceEntrance = e.id;
|
|
53264
53326
|
}
|
|
53265
|
-
if (ee && ee.
|
|
53327
|
+
if (ee && ee.mast && onFloor(-1, true)) {
|
|
53328
|
+
const path = mastPathOf(ee.mast);
|
|
53329
|
+
const x0 = K.x(ee.mast.u);
|
|
53330
|
+
const z0 = K.z(ee.mast.v);
|
|
53331
|
+
const item = { x: x0, z: z0, ry: 0, seed: seedOf2("service_mast"), points: path.map((p) => [r3(K.x(p[0]) - x0), p[2], r3(K.z(p[1]) - z0)]) };
|
|
53332
|
+
const e = entry2("service_mast", "service_mast", item, "service_mast", -1);
|
|
53333
|
+
e.floorY = o.base;
|
|
53334
|
+
push(e);
|
|
53335
|
+
result2.serviceMast = e.id;
|
|
53336
|
+
} else if (ee && ee.descent && ee.descent.length > 1 && onFloor(-1, true)) conduit("conduit_descent", ee.descent, -1);
|
|
53266
53337
|
const q = electrical.panel;
|
|
53267
53338
|
if (q && onFloor(q.floor, false)) {
|
|
53268
53339
|
const hdq = 0.06;
|
|
@@ -54773,7 +54844,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54773
54844
|
}
|
|
54774
54845
|
var residentialTower = residentialTowerTemplate();
|
|
54775
54846
|
|
|
54776
|
-
// ../game-floorplan-three/dist/chunk-
|
|
54847
|
+
// ../game-floorplan-three/dist/chunk-RQNZIQZ5.js
|
|
54777
54848
|
var __defProp4 = Object.defineProperty;
|
|
54778
54849
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
54779
54850
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -58193,7 +58264,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58193
58264
|
var FEED_EXIT_Y = -0.15;
|
|
58194
58265
|
var FEED_BOX_OFFSET = 0.25;
|
|
58195
58266
|
var BRICK_FACE_INSET = 0.014;
|
|
58267
|
+
var SLAB_MIDDLE = 0.065;
|
|
58268
|
+
var CEILING_SLAB = 0.5;
|
|
58269
|
+
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
58270
|
+
var SLAB_LIFT = { water: -0.02, conduit: 0.015 };
|
|
58196
58271
|
var OPENING_CLEARANCE = 0.12;
|
|
58272
|
+
var DEFAULT_END_CLEAR = 0.1;
|
|
58197
58273
|
var DEFAULT_THICKNESS = 0.15;
|
|
58198
58274
|
function atticFloor(plan) {
|
|
58199
58275
|
const top = plan.floors[plan.floors.length - 1];
|
|
@@ -58206,18 +58282,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58206
58282
|
return [Math.min(...walls.map((w) => w.u0)), Math.min(...walls.map((w) => w.v0)), Math.max(...walls.map((w) => w.u1)), Math.max(...walls.map((w) => w.v1))];
|
|
58207
58283
|
}
|
|
58208
58284
|
var inside2 = (box5, u, v, margin) => u >= box5[0] - margin && u <= box5[2] + margin && v >= box5[1] - margin && v <= box5[3] + margin;
|
|
58209
|
-
function
|
|
58285
|
+
function reaches(plan, opening, floor2) {
|
|
58286
|
+
if (opening.floor === floor2) return true;
|
|
58287
|
+
if (opening.floor > floor2 || opening.y1 === void 0) return false;
|
|
58288
|
+
return (plan.floors[opening.floor]?.y0 ?? 0) + opening.y1 > (plan.floors[floor2]?.y0 ?? 0);
|
|
58289
|
+
}
|
|
58290
|
+
function clearOfOpenings(plan, wall, along2, endClear = DEFAULT_END_CLEAR) {
|
|
58210
58291
|
const line = wall.axis === "u" ? wall.v0 : wall.u0;
|
|
58211
58292
|
const a0 = wall.axis === "u" ? wall.u0 : wall.v0, a1 = wall.axis === "u" ? wall.u1 : wall.v1;
|
|
58212
|
-
let at4 = along2;
|
|
58293
|
+
let at4 = endClear > DEFAULT_END_CLEAR ? Math.max(a0 + endClear, Math.min(a1 - endClear, along2)) : along2;
|
|
58213
58294
|
for (const o of plan.openings) {
|
|
58214
|
-
if (o.
|
|
58295
|
+
if (o.axis !== wall.axis || Math.abs(o.pos - line) > 0.05 || !reaches(plan, o, wall.floor)) continue;
|
|
58215
58296
|
const lo = o.at - o.width / 2 - OPENING_CLEARANCE, hi = o.at + o.width / 2 + OPENING_CLEARANCE;
|
|
58216
58297
|
if (at4 <= lo || at4 >= hi) continue;
|
|
58217
58298
|
const toLo = at4 - lo, toHi = hi - at4;
|
|
58218
58299
|
at4 = toLo <= toHi && lo >= a0 + 0.1 || hi > a1 - 0.1 ? lo : hi;
|
|
58219
58300
|
}
|
|
58220
|
-
return Math.max(a0 +
|
|
58301
|
+
return Math.max(a0 + DEFAULT_END_CLEAR, Math.min(a1 - DEFAULT_END_CLEAR, at4));
|
|
58221
58302
|
}
|
|
58222
58303
|
function wallDrop(plan, floor2, u, v, options = {}) {
|
|
58223
58304
|
let best = null;
|
|
@@ -58231,7 +58312,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58231
58312
|
if (!best) return null;
|
|
58232
58313
|
const { wall } = best;
|
|
58233
58314
|
const alongU = wall.axis === "u";
|
|
58234
|
-
const along2 = clearOfOpenings(plan, wall, best.along);
|
|
58315
|
+
const along2 = clearOfOpenings(plan, wall, best.along, options.endClear);
|
|
58235
58316
|
const line = alongU ? wall.v0 : wall.u0;
|
|
58236
58317
|
const [ru, rv] = options.toward ?? [u, v];
|
|
58237
58318
|
const across2 = alongU ? rv - line : ru - line;
|
|
@@ -58320,6 +58401,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58320
58401
|
}
|
|
58321
58402
|
return true;
|
|
58322
58403
|
}
|
|
58404
|
+
var DOOR_HEAD = 2.1;
|
|
58405
|
+
function crossesOpening(plan, a, b, y) {
|
|
58406
|
+
return plan.openings.some((o) => {
|
|
58407
|
+
const base = plan.floors[o.floor]?.y0 ?? 0;
|
|
58408
|
+
if (y <= base + (o.y0 ?? 0) || y >= base + (o.y1 ?? DOOR_HEAD)) return false;
|
|
58409
|
+
const [p0, p1, q0, q1] = o.axis === "u" ? [a[1], b[1], a[0], b[0]] : [a[0], b[0], a[1], b[1]];
|
|
58410
|
+
const across2 = Math.min(p0, p1) <= o.pos + 0.1 && Math.max(p0, p1) >= o.pos - 0.1;
|
|
58411
|
+
return across2 && Math.max(Math.min(q0, q1), o.at - o.width / 2) < Math.min(Math.max(q0, q1), o.at + o.width / 2);
|
|
58412
|
+
});
|
|
58413
|
+
}
|
|
58414
|
+
function slabPath(plan, from, to, y, first) {
|
|
58415
|
+
const clear = (path) => !path.slice(1).some((p, i) => crossesOpening(plan, [path[i][0], path[i][2]], [p[0], p[2]], y));
|
|
58416
|
+
for (const order2 of [first, first === "u" ? "v" : "u"]) {
|
|
58417
|
+
const path = atticPath(from, to, y, order2);
|
|
58418
|
+
if (clear(path)) return path;
|
|
58419
|
+
}
|
|
58420
|
+
const [cu, cv] = centreOf(houseFootprint(plan));
|
|
58421
|
+
const alongU = Math.abs(to[0] - from[0]) >= Math.abs(to[1] - from[1]);
|
|
58422
|
+
const step = alongU ? [0, Math.sign(cv - from[1]) * SLAB_DETOUR] : [Math.sign(cu - from[0]) * SLAB_DETOUR, 0];
|
|
58423
|
+
return [[from[0], y, from[1]], [from[0] + step[0], y, from[1] + step[1]], [to[0] + step[0], y, to[1] + step[1]], [to[0], y, to[1]]];
|
|
58424
|
+
}
|
|
58425
|
+
var SLAB_DETOUR = 0.6;
|
|
58426
|
+
function toMiddle(drop) {
|
|
58427
|
+
return drop.wall.axis === "u" ? { ...drop, v: drop.wall.v0 } : { ...drop, u: drop.wall.u0 };
|
|
58428
|
+
}
|
|
58323
58429
|
function atticPath(from, to, y, first) {
|
|
58324
58430
|
const corner = first === "u" ? [to[0], from[1]] : [from[0], to[1]];
|
|
58325
58431
|
const out = [[from[0], y, from[1]]];
|
|
@@ -58334,18 +58440,43 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58334
58440
|
const storey = plan.floors[floor2];
|
|
58335
58441
|
const y = (storey ? storey.y0 : 0) + target.y;
|
|
58336
58442
|
const footprint = houseFootprint(plan);
|
|
58337
|
-
if (inside2(footprint, target.u, target.v, 0.4)) {
|
|
58338
|
-
const drop = wallDrop(plan, floor2, target.u, target.v, options);
|
|
58339
|
-
if (!drop) return [];
|
|
58340
|
-
return [...atticPath(from, [drop.u, drop.v], attic, first), [drop.u, y, drop.v]];
|
|
58341
|
-
}
|
|
58443
|
+
if (inside2(footprint, target.u, target.v, 0.4)) return descend(plan, from, target, { ...options, attic, first, y });
|
|
58342
58444
|
const feed = feedTo(plan, target, y, options);
|
|
58343
58445
|
if (!feed) return [];
|
|
58344
58446
|
return [...atticPath(from, [feed.exit.u, feed.exit.v], attic, first), ...feed.route];
|
|
58345
58447
|
}
|
|
58448
|
+
function descend(plan, from, target, options) {
|
|
58449
|
+
const floor2 = Math.max(0, target.floor);
|
|
58450
|
+
const top = Math.max(floor2, plan.floors.length - 1);
|
|
58451
|
+
const route = [];
|
|
58452
|
+
let at4 = from;
|
|
58453
|
+
let height = options.attic;
|
|
58454
|
+
for (let storey = top; storey >= floor2; storey--) {
|
|
58455
|
+
const passing = storey !== floor2 || options.passing === true;
|
|
58456
|
+
const found = wallDrop(plan, storey, target.u, target.v, passing ? { ...options, surface: false, endClear: PASSING_END_CLEAR[options.kind] } : options);
|
|
58457
|
+
if (!found) return [];
|
|
58458
|
+
const drop = passing && options.kind === "conduit" ? toMiddle(found) : found;
|
|
58459
|
+
const path = slabPath(plan, at4, [drop.u, drop.v], height, options.first);
|
|
58460
|
+
route.push(...route.length ? path.slice(1) : path);
|
|
58461
|
+
at4 = [drop.u, drop.v];
|
|
58462
|
+
if (storey === floor2) break;
|
|
58463
|
+
height = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT[options.kind];
|
|
58464
|
+
route.push([drop.u, height, drop.v]);
|
|
58465
|
+
}
|
|
58466
|
+
route.push([at4[0], options.y, at4[1]]);
|
|
58467
|
+
return route.filter((p, i) => i === 0 || Math.hypot(p[0] - route[i - 1][0], p[1] - route[i - 1][1], p[2] - route[i - 1][2]) > 1e-4);
|
|
58468
|
+
}
|
|
58346
58469
|
function routeToCeiling(plan, from, u, v, ceilingY) {
|
|
58347
58470
|
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
58348
|
-
if (inside2(houseFootprint(plan), u, v, 0.4))
|
|
58471
|
+
if (inside2(houseFootprint(plan), u, v, 0.4)) {
|
|
58472
|
+
const over = plan.floors.findIndex((floor2, index) => index > 0 && floor2.y0 > ceilingY - CEILING_SLAB);
|
|
58473
|
+
if (over < 0) return [...atticPath(from, [u, v], attic, "v"), [u, ceilingY, v]];
|
|
58474
|
+
const slabY = (plan.floors[over]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
58475
|
+
const down2 = descend(plan, from, { u, v, y: 0, floor: over }, { kind: "conduit", attic, first: "v", y: slabY, passing: true });
|
|
58476
|
+
const foot = down2[down2.length - 1];
|
|
58477
|
+
if (!foot) return [];
|
|
58478
|
+
return [...down2, ...slabPath(plan, [foot[0], foot[2]], [u, v], slabY, "v").slice(1), [u, Math.min(ceilingY, slabY), v]];
|
|
58479
|
+
}
|
|
58349
58480
|
const feed = feedTo(plan, { u, v }, ceilingY + IN_SLAB, {});
|
|
58350
58481
|
if (!feed) return [];
|
|
58351
58482
|
const top = feed.route[feed.route.length - 1];
|
|
@@ -58363,6 +58494,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58363
58494
|
return { walls: plan.walls, openings: [...plan.doors, ...plan.windows], floors: plan.floors };
|
|
58364
58495
|
}
|
|
58365
58496
|
var toPlan = (route) => route.map((p) => [p[0], p[2], p[1]]);
|
|
58497
|
+
function homeRun(plan, run) {
|
|
58498
|
+
const { riser, floor: floor2, top, home, ceilingY } = run;
|
|
58499
|
+
const start = [riser.u, top, riser.v];
|
|
58500
|
+
const above2 = plan.floors[floor2 + 1];
|
|
58501
|
+
if (above2 && above2.y0 > ceilingY - CEILING_SLAB && inside2(houseFootprint(plan), home[0], home[1], 0.4)) {
|
|
58502
|
+
const slabY = above2.y0 - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
58503
|
+
return [start, [riser.u, slabY, riser.v], ...slabPath(plan, [riser.u, riser.v], home, slabY, "v").slice(1), [home[0], Math.min(ceilingY, slabY), home[1]]];
|
|
58504
|
+
}
|
|
58505
|
+
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
58506
|
+
const up = [...descend(plan, [riser.u, riser.v], { u: riser.u, v: riser.v, y: 0, floor: floor2 }, { kind: "conduit", attic, first: "v", y: top })].reverse();
|
|
58507
|
+
const route = [start, ...up.slice(1), ...routeToCeiling(plan, [riser.u, riser.v], home[0], home[1], ceilingY)];
|
|
58508
|
+
return route.filter((p, i) => i === 0 || Math.hypot(p[0] - route[i - 1][0], p[1] - route[i - 1][1], p[2] - route[i - 1][2]) > 1e-4);
|
|
58509
|
+
}
|
|
58366
58510
|
function routeConduits(plan, electrical, lamps) {
|
|
58367
58511
|
const Q = electrical.panel;
|
|
58368
58512
|
const terminals = /* @__PURE__ */ new Map();
|
|
@@ -58381,7 +58525,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58381
58525
|
const ceilingY = lamp ? lamp.y : storey ? storey.y0 + storey.ceiling : 2.8;
|
|
58382
58526
|
homes.set(c.circuit, [home[0], home[1], ceilingY]);
|
|
58383
58527
|
const top = (Q.y ?? 1.5) + (Q.h ?? 0.4) / 2;
|
|
58384
|
-
return { ...c, points:
|
|
58528
|
+
return { ...c, points: toPlan(homeRun(plan, { riser, floor: floor2, top, home, ceilingY })) };
|
|
58385
58529
|
}
|
|
58386
58530
|
const target = terminals.get(c.to);
|
|
58387
58531
|
const start = homes.get(c.from) ?? (home ? [home[0], home[1], atticFloor(plan)] : void 0);
|
|
@@ -58704,6 +58848,67 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58704
58848
|
group.userData.rain = { pieces: rainwater.pieces, trenches: [...rainwater.trenches, ...rainwater.boxes.map(pitOf)].map((t) => t.rect), boxes: rainwater.boxes };
|
|
58705
58849
|
return group;
|
|
58706
58850
|
}
|
|
58851
|
+
var SUBFLOOR_Y = -0.15;
|
|
58852
|
+
var RISER_CLEAR = 2e-3;
|
|
58853
|
+
var WALL_OUTLET_HEIGHT = { tap: 0.5, tub: 0.45, machine: 0.5 };
|
|
58854
|
+
var FLOOR_OUTLET_DROP = 3e-3;
|
|
58855
|
+
function square(a, b, y) {
|
|
58856
|
+
const corner = [b[0], y, a[1]];
|
|
58857
|
+
const out = [];
|
|
58858
|
+
if (Math.abs(b[0] - a[0]) > 1e-4 && Math.abs(b[1] - a[1]) > 1e-4) out.push(corner);
|
|
58859
|
+
out.push([b[0], y, b[1]]);
|
|
58860
|
+
return out;
|
|
58861
|
+
}
|
|
58862
|
+
var onCentre = (at4) => {
|
|
58863
|
+
if (at4.wall.axis === "u") return [at4.u, at4.wall.v0 + Math.sign(at4.v - at4.wall.v0) * STACK_OFF_CENTRE];
|
|
58864
|
+
return [at4.wall.u0 + Math.sign(at4.u - at4.wall.u0) * STACK_OFF_CENTRE, at4.v];
|
|
58865
|
+
};
|
|
58866
|
+
var STACK_OFF_CENTRE = 0.013;
|
|
58867
|
+
function drainRoute(plan, point) {
|
|
58868
|
+
const floor2 = point.floor;
|
|
58869
|
+
if (floor2 < 0) return null;
|
|
58870
|
+
const y0 = plan.floors[floor2]?.y0 ?? 0;
|
|
58871
|
+
const outlet = WALL_OUTLET_HEIGHT[point.kind];
|
|
58872
|
+
const points = [];
|
|
58873
|
+
let at4 = [point.u, point.v];
|
|
58874
|
+
let storey = floor2;
|
|
58875
|
+
if (outlet !== void 0) {
|
|
58876
|
+
const drop = wallDrop(plan, floor2, point.u, point.v);
|
|
58877
|
+
if (!drop) return null;
|
|
58878
|
+
at4 = onCentre(drop);
|
|
58879
|
+
points.push([at4[0], y0 + outlet, at4[1]]);
|
|
58880
|
+
} else {
|
|
58881
|
+
points.push([point.u, y0 - FLOOR_OUTLET_DROP, point.v]);
|
|
58882
|
+
if (floor2 > 0) {
|
|
58883
|
+
const slabY = y0 - SLAB_MIDDLE;
|
|
58884
|
+
points.push([point.u, slabY, point.v]);
|
|
58885
|
+
const below = wallDrop(plan, floor2 - 1, point.u, point.v);
|
|
58886
|
+
if (!below) return null;
|
|
58887
|
+
at4 = onCentre(below);
|
|
58888
|
+
points.push(...square([point.u, point.v], at4, slabY));
|
|
58889
|
+
storey = floor2 - 1;
|
|
58890
|
+
}
|
|
58891
|
+
}
|
|
58892
|
+
for (; storey > 0; storey--) {
|
|
58893
|
+
const slabY = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE;
|
|
58894
|
+
points.push([at4[0], slabY, at4[1]]);
|
|
58895
|
+
const below = wallDrop(plan, storey - 1, at4[0], at4[1]);
|
|
58896
|
+
if (!below) continue;
|
|
58897
|
+
const from = at4;
|
|
58898
|
+
at4 = onCentre(below);
|
|
58899
|
+
points.push(...square(from, at4, slabY));
|
|
58900
|
+
}
|
|
58901
|
+
if (Math.hypot(at4[0] - point.u, at4[1] - point.v) < 1e-3) return null;
|
|
58902
|
+
{
|
|
58903
|
+
points.push([at4[0], SUBFLOOR_Y, at4[1]]);
|
|
58904
|
+
const legs = square(at4, [point.u, point.v], SUBFLOOR_Y);
|
|
58905
|
+
const last = legs.length > 1 ? legs[legs.length - 2] : [at4[0], SUBFLOOR_Y, at4[1]];
|
|
58906
|
+
const run = Math.hypot(point.u - last[0], point.v - last[2]), stop = run > 0 ? Math.max(0, run - ((DRAIN_BORE[point.kind] ?? 0.05) / 2 + RISER_CLEAR)) / run : 0;
|
|
58907
|
+
legs[legs.length - 1] = [last[0] + (point.u - last[0]) * stop, SUBFLOOR_Y, last[2] + (point.v - last[2]) * stop];
|
|
58908
|
+
points.push(...legs);
|
|
58909
|
+
}
|
|
58910
|
+
return points.filter((p, i) => i === 0 || Math.hypot(p[0] - points[i - 1][0], p[1] - points[i - 1][1], p[2] - points[i - 1][2]) > 1e-4);
|
|
58911
|
+
}
|
|
58707
58912
|
var DEFAULT_SEGMENT_LIMITS = { wiring: 3, pipe: 2.5 };
|
|
58708
58913
|
var CUT_ROLES = /* @__PURE__ */ new Set(["slab", "wall", "partition"]);
|
|
58709
58914
|
var EPSILON2 = 1e-6;
|
|
@@ -58991,6 +59196,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58991
59196
|
}
|
|
58992
59197
|
function underSink(tr) {
|
|
58993
59198
|
const H = shared3.ctx.r.utilities?.plumbing, nA = shared3.ctx.r.floors.length, pt = H && H.points.find((p) => p.id === tr.to), pts = tr.points.map((p) => [p[0], p[2], p[1]]), d = tr.diameter || 0.025;
|
|
59199
|
+
const stage2 = cursor.stage;
|
|
59200
|
+
if (shared3.ctx.constructionStages) cursor.stage = "furniture";
|
|
58994
59201
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
58995
59202
|
cursor.pc = pieceRecord("pipe:" + tr.id, "plastic", null, { tags: ["pipe"] });
|
|
58996
59203
|
for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
|
|
@@ -58998,39 +59205,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58998
59205
|
cylBase("metal", p[0], p[1] - d * 0.9, p[2], d * 0.75, d * 1.8, 13158596);
|
|
58999
59206
|
}
|
|
59000
59207
|
cursor.pc = null;
|
|
59208
|
+
cursor.stage = stage2;
|
|
59001
59209
|
}
|
|
59002
59210
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
59003
59211
|
Object.assign(K, defined);
|
|
59004
59212
|
}
|
|
59005
59213
|
var SEWER_COLOR = 15262940;
|
|
59006
|
-
var MOUTH_HEIGHT = { flush: 0.18, shower: 0.03, tap: 0.5, tub: 0.45, machine: 0.5 };
|
|
59007
|
-
var SLAB_MIDDLE = 0.065;
|
|
59008
59214
|
var CLAMP_REACH = 0.3;
|
|
59009
59215
|
var CLAMP_DROP = 0.06;
|
|
59010
59216
|
var CLAMP_HEIGHT = 0.03;
|
|
59011
59217
|
var CLAMPED_ROLES = /* @__PURE__ */ new Set(["wall", "partition", "column"]);
|
|
59012
|
-
function drainRoute(plan, point) {
|
|
59013
|
-
const floor2 = point.floor;
|
|
59014
|
-
if (floor2 < 0) return null;
|
|
59015
|
-
const drop = wallDrop(plan, floor2, point.u, point.v);
|
|
59016
|
-
if (!drop) return null;
|
|
59017
|
-
const onCentre = (at23) => at23.wall.axis === "u" ? [at23.u, at23.wall.v0] : [at23.wall.u0, at23.v];
|
|
59018
|
-
const mouth = (plan.floors[floor2]?.y0 ?? 0) + (MOUTH_HEIGHT[point.kind] ?? 0.3);
|
|
59019
|
-
let at4 = onCentre(drop);
|
|
59020
|
-
const points = [[point.u, mouth, point.v], [at4[0], mouth, at4[1]]];
|
|
59021
|
-
for (let storey = floor2; storey > 0; storey--) {
|
|
59022
|
-
const slabY = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE;
|
|
59023
|
-
points.push([at4[0], slabY, at4[1]]);
|
|
59024
|
-
const below = wallDrop(plan, storey - 1, at4[0], at4[1]);
|
|
59025
|
-
if (!below) continue;
|
|
59026
|
-
at4 = onCentre(below);
|
|
59027
|
-
points.push([at4[0], slabY, at4[1]]);
|
|
59028
|
-
}
|
|
59029
|
-
points.push([at4[0], plan.floors[0]?.y0 ?? 0, at4[1]]);
|
|
59030
|
-
return points;
|
|
59031
|
-
}
|
|
59032
59218
|
function installUtilitiesDrains(K, shared3) {
|
|
59033
|
-
const { part, pipe, cylBase } = K;
|
|
59219
|
+
const { part, pipe, cylBase, cursor } = K;
|
|
59034
59220
|
const sh = (...a) => K.sh(...a);
|
|
59035
59221
|
function layRun(run) {
|
|
59036
59222
|
const spans = cutRun(run.points, run.limit, solidsOf(shared3.ctx.structureIndex));
|
|
@@ -59071,6 +59257,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59071
59257
|
}
|
|
59072
59258
|
function downpipes() {
|
|
59073
59259
|
const runs = shared3.ctx.gutterInfo?.runs ?? [];
|
|
59260
|
+
const stage2 = cursor.stage;
|
|
59261
|
+
if (shared3.ctx.constructionStages) cursor.stage = "roof";
|
|
59074
59262
|
runs.forEach((run, index) => {
|
|
59075
59263
|
const top = run.points[0];
|
|
59076
59264
|
const points = run.points.map((p) => [p[0], p[1], p[2]]);
|
|
@@ -59078,6 +59266,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59078
59266
|
const limit = Number.isFinite(shared3.ctx.segmentLimits.pipe) ? Math.min(shared3.ctx.segmentLimits.pipe, run.clampEvery) : Infinity;
|
|
59079
59267
|
layRun({ id: `downpipe_${index}`, points, diameter: run.radius * 2, color: run.color, group: `f${run.f}`, limit, ...clampedTo ? { clampedTo } : {}, clampEvery: run.clampEvery });
|
|
59080
59268
|
});
|
|
59269
|
+
cursor.stage = stage2;
|
|
59081
59270
|
}
|
|
59082
59271
|
function drainPipes() {
|
|
59083
59272
|
if (shared3.ctx.visorScene) return;
|
|
@@ -59310,11 +59499,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59310
59499
|
for (const x of [u0 + inset, u1 - inset]) for (const z of [v0 + inset, v1 - inset]) addStageBox(THREE, parent, x - r, yBase, z - r, x + r, yBase + height, z + r, rebarMat);
|
|
59311
59500
|
for (let y = yBase + 0.08; y < yBase + height - 0.03; y += 0.14) addStageBox(THREE, parent, u0 + inset, y, v0 + inset, u1 - inset, y + 6e-3, v1 - inset, rebarMat);
|
|
59312
59501
|
}
|
|
59502
|
+
var DIRT_BED_INSET = 0.03;
|
|
59313
59503
|
function createStageMaterials(THREE) {
|
|
59314
59504
|
return {
|
|
59315
59505
|
dirt: new THREE.MeshStandardMaterial({ color: 9073232, roughness: 0.96 }),
|
|
59316
59506
|
footing: new THREE.MeshStandardMaterial({ color: 8025710, roughness: 0.92 }),
|
|
59317
|
-
|
|
59507
|
+
// the ground beams are waterproofed (black bitumen on their top and sides) before the masonry goes up on them
|
|
59508
|
+
baldrame: new THREE.MeshStandardMaterial({ color: 2894375, roughness: 0.7 }),
|
|
59318
59509
|
slab0: new THREE.MeshStandardMaterial({ color: 10920600, roughness: 0.86 }),
|
|
59319
59510
|
// pillars, beams and slabs are cast in one concrete: where they meet, they are one surface
|
|
59320
59511
|
concrete: new THREE.MeshStandardMaterial({ color: 10262672, roughness: 0.82 }),
|
|
@@ -59552,11 +59743,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59552
59743
|
parts2.push(...ob.parts);
|
|
59553
59744
|
openings.push(...ob.openings);
|
|
59554
59745
|
}
|
|
59555
|
-
const footprint = rawStructure.parts.filter((p) => p.
|
|
59746
|
+
const footprint = rawStructure.parts.filter((p) => p.y0 <= 0.1);
|
|
59556
59747
|
if (footprint.length) {
|
|
59557
|
-
addStageBox(THREE, foundation, Math.min(...footprint.map((p) => p.aabb[0]))
|
|
59748
|
+
addStageBox(THREE, foundation, Math.min(...footprint.map((p) => p.aabb[0])) + DIRT_BED_INSET, -0.06, Math.min(...footprint.map((p) => p.aabb[1])) + DIRT_BED_INSET, Math.max(...footprint.map((p) => p.aabb[2])) - DIRT_BED_INSET, 6e-3, Math.max(...footprint.map((p) => p.aabb[3])) - DIRT_BED_INSET, mats.dirt, "foundation_dirt_bed");
|
|
59558
59749
|
}
|
|
59559
|
-
for (const e of outbuildings ?? []) addStageBox(THREE, foundation, e.aabb[0]
|
|
59750
|
+
for (const e of outbuildings ?? []) addStageBox(THREE, foundation, e.aabb[0] + DIRT_BED_INSET, -0.06, e.aabb[1] + DIRT_BED_INSET, e.aabb[2] - DIRT_BED_INSET, 6e-3, e.aabb[3] - DIRT_BED_INSET, mats.dirt, `${e.id}_dirt_bed`);
|
|
59560
59751
|
const seen = /* @__PURE__ */ new Set();
|
|
59561
59752
|
const foundations = parts2.filter(isFoundation).filter((p) => !seen.has(p.id) && !!seen.add(p.id)).map(foundationSolid);
|
|
59562
59753
|
for (const s of foundations) addStageBox(THREE, foundation, s.aabb[0], s.y0, s.aabb[1], s.aabb[2], s.y1, s.aabb[3], mats[s.kind], s.id);
|
|
@@ -59779,8 +59970,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59779
59970
|
wireL(span.a, span.b, radius);
|
|
59780
59971
|
});
|
|
59781
59972
|
};
|
|
59782
|
-
const wiringSpans = (P, drop) => {
|
|
59783
|
-
const poleId = (u) => "pole:" + u.toFixed(1),
|
|
59973
|
+
const wiringSpans = (P, drop, ownPole) => {
|
|
59974
|
+
const poleId = (u) => "pole:" + u.toFixed(1), piecePoles = ownPole ? [P.u - 22, P.u, P.u + 22] : [P.u - 22, P.u + 22], nearestPole = (x) => poleId(piecePoles.reduce((best, u) => Math.abs(u - x) < Math.abs(best - x) ? u : best));
|
|
59784
59975
|
if (!Number.isFinite(shared3.ctx.segmentLimits.wiring)) {
|
|
59785
59976
|
cursor.pc = pieceRecord("wiring:grid", "copper", null, { tags: ["wiring"] });
|
|
59786
59977
|
for (const dx of [-0.65, -0.2, 0.25, 0.7]) for (const k of [-1, 1]) wireL([P.u + dx, P.h - 0.5, P.v], [P.u + k * 22 + dx, P.h - 0.5, P.v], 7e-3);
|
|
@@ -59824,25 +60015,44 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59824
60015
|
for (let i = 0; i < n; i++) wireSpans(at4(i / n), at4((i + 1) / n), 9e-3, "wiring:service:" + i, "ground");
|
|
59825
60016
|
cursor.pc = null;
|
|
59826
60017
|
};
|
|
60018
|
+
const servicePost = (u, v, h) => {
|
|
60019
|
+
const half = NETWORK_POST.half, buried = postEmbedment(h), below = shared3.ctx.visorScene ? 0 : buried, face = v - half;
|
|
60020
|
+
cursor.group = lotGroup;
|
|
60021
|
+
cursor.pc = pieceRecord("pole:" + u.toFixed(1), "concrete", null, { tags: ["pole"], holder: "ground", holdJoint: footingJointOf("concrete"), embedment: { depth: buried, width: half * 2 } });
|
|
60022
|
+
bx("plain", u - half, -below, v - half, u + half, h, v + half, concreteColor);
|
|
60023
|
+
bx("metal", u - 0.02, NETWORK_POST.anchor - 0.06, face - NETWORK_POST.bracket, u + 0.02, NETWORK_POST.anchor + 0.04, face - 2e-3, iron);
|
|
60024
|
+
cursor.pc = null;
|
|
60025
|
+
};
|
|
60026
|
+
const serviceMast = (mast) => {
|
|
60027
|
+
const path = mastPathOf(mast).map((p) => [p[0], p[2], p[1]]), end3 = path[path.length - 1], galvanised = 11120307;
|
|
60028
|
+
cursor.group = lotGroup;
|
|
60029
|
+
cursor.pc = pieceRecord("mast:" + mast.u.toFixed(1), "steel", null, { tags: ["mast"], holdOn: "wall", holdJoint: "clip" });
|
|
60030
|
+
for (let i = 0; i + 1 < path.length; i++) pipe2(path[i], path[i + 1], MAST_PIPE_RADIUS * 2, galvanised);
|
|
60031
|
+
cylBase("metal", end3[0], end3[1] - WEATHERHEAD.capLength, end3[2], WEATHERHEAD.capRadius, WEATHERHEAD.capLength, galvanised);
|
|
60032
|
+
cursor.pc = null;
|
|
60033
|
+
};
|
|
59827
60034
|
if (en22) {
|
|
59828
60035
|
const P = en22.pole, from = shared3.ctx.serviceFrom, kitDraws = !!(KV && KV.serviceEntrance);
|
|
59829
60036
|
if (P) {
|
|
59830
|
-
if (!kitDraws)
|
|
60037
|
+
if (!kitDraws && en22.street === "network") servicePost(P.u, P.v, P.h);
|
|
60038
|
+
else if (!kitDraws) pole(P.u, P.v, P.h);
|
|
59831
60039
|
info.pole = { pos: [P.u, 0, P.v], h: P.h };
|
|
59832
60040
|
}
|
|
59833
|
-
const landing2 = en22.drop[0];
|
|
59834
|
-
if (from && landing2) {
|
|
59835
|
-
streetDrop(from, [landing2[0], landing2[2], landing2[1]]);
|
|
60041
|
+
const landing2 = en22.drop[0], network = en22.street === "network";
|
|
60042
|
+
if ((from || network) && landing2) {
|
|
60043
|
+
if (from && !network) streetDrop(from, [landing2[0], landing2[2], landing2[1]]);
|
|
59836
60044
|
const end3 = en22.drop[en22.drop.length - 1];
|
|
59837
60045
|
if (P && end3 && en22.drop.length > 1 && !kitDraws) {
|
|
59838
60046
|
wireSpans([landing2[0], landing2[2], landing2[1]], [end3[0], end3[2], end3[1]], 9e-3, "wiring:drop:0", "pole:" + P.u.toFixed(1));
|
|
59839
60047
|
cursor.pc = null;
|
|
59840
60048
|
}
|
|
59841
|
-
} else if (P) {
|
|
60049
|
+
} else if (P && !network) {
|
|
59842
60050
|
for (const k of [-1, 1]) pole(P.u + k * 22, P.v, P.h);
|
|
59843
|
-
wiringSpans(P, en22.drop && en22.drop.length > 1 && !kitDraws ? en22.drop : null);
|
|
60051
|
+
wiringSpans(P, en22.drop && en22.drop.length > 1 && !kitDraws ? en22.drop : null, !kitDraws);
|
|
59844
60052
|
}
|
|
59845
|
-
if (en22.
|
|
60053
|
+
if (en22.mast) {
|
|
60054
|
+
if (!(KV && KV.serviceMast)) serviceMast(en22.mast);
|
|
60055
|
+
} else if (en22.descent && en22.descent.length > 1 && !(KV && (KV.serviceEntrance || !P))) {
|
|
59846
60056
|
const d0 = en22.descent[0], d1 = en22.descent[en22.descent.length - 1];
|
|
59847
60057
|
cylBase("metal", d0[0], d1[2], d0[1], 0.02, d0[2] - d1[2] - (shared3.ctx.visorScene ? 0 : 0.01), 9080466);
|
|
59848
60058
|
const hw = shared3.ctx.visorScene ? 0.05 : 0.047;
|
|
@@ -60022,6 +60232,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60022
60232
|
return { w, au, L: au ? w.v0 : w.u0, a: Math.min(au ? w.u0 : w.v0, au ? w.u1 : w.v1), b: Math.max(au ? w.u0 : w.v0, au ? w.u1 : w.v1), th: w.thickness || 0.15 };
|
|
60023
60233
|
});
|
|
60024
60234
|
cursor.group = "f0";
|
|
60235
|
+
const stage2 = cursor.stage;
|
|
60236
|
+
if (shared3.ctx.constructionStages) cursor.stage = "exterior";
|
|
60025
60237
|
const junction = (A, e, sd) => {
|
|
60026
60238
|
let r = 0;
|
|
60027
60239
|
for (const B of ws) {
|
|
@@ -60073,6 +60285,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60073
60285
|
strip(W, y0, y0 + SIDEWALK_TOP, 0, W, "sidewalk", cal, A.w.id ? `sidewalk:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0, SIDEWALK_SLABS);
|
|
60074
60286
|
}
|
|
60075
60287
|
if (!shared3.ctx.baseboardBand) doorways(ws, W, y0, cal);
|
|
60288
|
+
cursor.stage = stage2;
|
|
60076
60289
|
}
|
|
60077
60290
|
function clearSpan({ a, b, au, across: across2, rise }) {
|
|
60078
60291
|
let from = a, to = b;
|
|
@@ -60101,11 +60314,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60101
60314
|
const slab = au ? [a, y0, lo, b, y0 + SIDEWALK_TOP, hi] : [lo, y0, a, hi, y0 + SIDEWALK_TOP, b];
|
|
60102
60315
|
bx("sidewalk", slab[0], slab[1], slab[2], slab[3], slab[4], slab[5], cal);
|
|
60103
60316
|
if (!shared3.ctx.visorScene) shared3.ctx.paving?.push(slab);
|
|
60317
|
+
const paving = cursor.stage;
|
|
60318
|
+
if (shared3.ctx.constructionStages) cursor.stage = "finishes";
|
|
60104
60319
|
const top = y0 + (shared3.ctx.constructionStages ? FLOOR_OVER_GROUND : 0) + 2e-3, t0 = d.pos - th / 2, t1 = d.pos + th / 2;
|
|
60105
60320
|
const [from, to] = clearSpan({ a: a + DOOR_JAMB_WIDTH, b: b - DOOR_JAMB_WIDTH, au, across: [t0, t1], rise: [y0, top] });
|
|
60106
60321
|
cursor.pc = pieceRecord(`threshold:${d.id}`, THRESHOLD.material, null, { floor: 0, mass: Math.round((to - from) * th * (top - y0) * THRESHOLD.density * 100) / 100, tags: ["threshold"], holdOn: "floor", holdJoint: footingJointOf(THRESHOLD.material) });
|
|
60107
60322
|
if (au) bx("plain", from, y0, t0, to, top, t1, THRESHOLD.color);
|
|
60108
60323
|
else bx("plain", t0, y0, from, t1, top, to, THRESHOLD.color);
|
|
60324
|
+
cursor.stage = paving;
|
|
60109
60325
|
}
|
|
60110
60326
|
cursor.pc = null;
|
|
60111
60327
|
}
|
|
@@ -60967,6 +61183,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60967
61183
|
mine("gas_cylinder", FURNITURE.gas_cylinder);
|
|
60968
61184
|
mine("cooking_gas_cylinder", FURNITURE.cooking_gas_cylinder);
|
|
60969
61185
|
mine("gas_shelter", FURNITURE.gas_shelter);
|
|
61186
|
+
mine("gas_hose", FURNITURE.gas_hose);
|
|
60970
61187
|
mine("outdoor_bin", FURNITURE.outdoor_bin);
|
|
60971
61188
|
mine("outdoor_pot", FURNITURE.outdoor_pot);
|
|
60972
61189
|
mine("planter_bed", FURNITURE.planter_bed);
|
|
@@ -61498,13 +61715,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61498
61715
|
const copper = 12088115;
|
|
61499
61716
|
for (let k = 0; k + 1 < shelter.route.length; k++) K2.t("metal", local2(shelter.route[k]), local2(shelter.route[k + 1]), 75e-4, copper);
|
|
61500
61717
|
if (shelter.hose.length > 1) {
|
|
61501
|
-
const valve = local2(shelter.hose[0])
|
|
61718
|
+
const valve = local2(shelter.hose[0]);
|
|
61502
61719
|
K2.b("metal", valve[0], valve[1] - 0.02, valve[2], 0.04, 0.04, 0.04, 13214282);
|
|
61503
|
-
const sag = [(valve[0] + stove[0]) / 2, Math.max(0.1, Math.min(valve[1], stove[1]) - 0.15), (valve[2] + stove[2]) / 2];
|
|
61504
|
-
K2.t("plain", [valve[0], valve[1] - 0.02, valve[2]], sag, 0.011, 12071454);
|
|
61505
|
-
K2.t("plain", sag, stove, 0.011, 12071454);
|
|
61506
61720
|
}
|
|
61507
61721
|
}
|
|
61722
|
+
const GAS_HOSE_COLOR = 14267452;
|
|
61723
|
+
FURNITURE.gas_hose = function(M, A) {
|
|
61724
|
+
const shelter = shelterOf(M);
|
|
61725
|
+
if (!shelter || shelter.hose.length < 2) return;
|
|
61726
|
+
const K2 = kit2(M, A);
|
|
61727
|
+
const local2 = (p) => [p[0] - M.x, p[2] - (typeof M.y === "number" ? M.y : 0), p[1] - M.z];
|
|
61728
|
+
const valve = local2(shelter.hose[0]), stove = local2(shelter.hose[shelter.hose.length - 1]);
|
|
61729
|
+
const sag = [(valve[0] + stove[0]) / 2, Math.max(0.1, Math.min(valve[1], stove[1]) - 0.15), (valve[2] + stove[2]) / 2];
|
|
61730
|
+
K2.t("plain", [valve[0], valve[1] - 0.02, valve[2]], sag, 0.011, GAS_HOSE_COLOR);
|
|
61731
|
+
K2.t("plain", sag, stove, 0.011, GAS_HOSE_COLOR);
|
|
61732
|
+
};
|
|
61508
61733
|
FURNITURE.mailbox = function(M, A) {
|
|
61509
61734
|
const K2 = kit2(M, A, 0), w = M.w || 0.3, d = M.d || 0.22, h = M.h || 0.3, y = M.y != null && M.y > 0 ? M.y : 1, structure = STYLE(), pc = structure === "high" ? 2763824 : structure === "mid" ? 13676640 : 13126202, rnd2 = rngString(SEED() + "|" + seedKey(M.seed) + "|correio");
|
|
61510
61735
|
if (M.pole !== false && !(M.y != null && M.y > 0)) {
|
|
@@ -61645,6 +61870,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61645
61870
|
cursor.stage = st;
|
|
61646
61871
|
}
|
|
61647
61872
|
}
|
|
61873
|
+
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_hose) {
|
|
61874
|
+
const st = cursor.stage;
|
|
61875
|
+
if (shared3.ctx.constructionStages) cursor.stage = "furniture";
|
|
61876
|
+
try {
|
|
61877
|
+
buildItem2(m, M, T2.gas_hose, api, cursor.group);
|
|
61878
|
+
} finally {
|
|
61879
|
+
cursor.stage = st;
|
|
61880
|
+
}
|
|
61881
|
+
}
|
|
61648
61882
|
if (shared3.ctx.iv && shared3.ctx.iv.replace.has(m.id)) {
|
|
61649
61883
|
registerCollision(m, M);
|
|
61650
61884
|
continue;
|
|
@@ -63845,6 +64079,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63845
64079
|
supports.push({ part: p.id, on: p.holder, joint: p.holdJoint ?? "clip", bears: false, extra: true, ...p.tears ? { tears: true } : {} });
|
|
63846
64080
|
continue;
|
|
63847
64081
|
}
|
|
64082
|
+
if (typeof p.holder === "string") {
|
|
64083
|
+
unheld.push(p.id);
|
|
64084
|
+
continue;
|
|
64085
|
+
}
|
|
63848
64086
|
if (p.holdOn) {
|
|
63849
64087
|
const on = p.holdOn === "floor" ? floorUnder(p) : wallBeside(p, p.holdReach ?? HOLD_REACH);
|
|
63850
64088
|
if (on) supports.push({ part: p.id, on: on.id, joint: p.holdJoint ?? "clip", bears: false, extra: true });
|
|
@@ -64299,9 +64537,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
64299
64537
|
if (q.id === part.id || q.role !== "wall" && q.role !== "partition" || !structure.meshesOf(q.id).some((it) => it.mesh)) continue;
|
|
64300
64538
|
if (Math.min(q.y1, part.y1) - Math.max(q.y0, part.y0) <= 0.5) continue;
|
|
64301
64539
|
const inside22 = cu >= q.aabb[0] - 1e-3 && cu <= q.aabb[2] + 1e-3 && cv >= q.aabb[1] - 1e-3 && cv <= q.aabb[3] + 1e-3;
|
|
64302
|
-
const
|
|
64540
|
+
const reaches2 = Math.min(q.aabb[2], part.aabb[2]) - Math.max(q.aabb[0], part.aabb[0]) > PILLAR_REACH2 && Math.min(q.aabb[3], part.aabb[3]) - Math.max(q.aabb[1], part.aabb[1]) > PILLAR_REACH2;
|
|
64303
64541
|
if (inside22) first.push(q.id);
|
|
64304
|
-
else if (
|
|
64542
|
+
else if (reaches2) other.push(q.id);
|
|
64305
64543
|
}
|
|
64306
64544
|
return [...first, ...other];
|
|
64307
64545
|
}
|
|
@@ -65612,20 +65850,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65612
65850
|
if (!Number.isFinite(level)) return CONSTRUCTION_LEVEL_MAX;
|
|
65613
65851
|
return Math.max(0, Math.min(CONSTRUCTION_LEVEL_MAX, Math.round(level)));
|
|
65614
65852
|
}
|
|
65853
|
+
var STAGE_LEVEL = { foundation: 1, frame: 2, masonry: 3, installations: 4, roofFraming: 5, roof: 6, finishes: 7, openings: 8, last: 8 };
|
|
65615
65854
|
function stageVisible(stage2, level, opts) {
|
|
65616
65855
|
switch (stage2) {
|
|
65617
65856
|
case "installations":
|
|
65618
|
-
return level >=
|
|
65857
|
+
return level >= STAGE_LEVEL.installations;
|
|
65619
65858
|
case "finishes":
|
|
65620
|
-
return level >=
|
|
65859
|
+
return level >= STAGE_LEVEL.finishes;
|
|
65621
65860
|
case "openings":
|
|
65622
|
-
return level >=
|
|
65861
|
+
return level >= STAGE_LEVEL.openings;
|
|
65623
65862
|
case "roof":
|
|
65624
|
-
return level >=
|
|
65863
|
+
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
65625
65864
|
case "furniture":
|
|
65626
|
-
return level >=
|
|
65865
|
+
return level >= STAGE_LEVEL.last;
|
|
65866
|
+
// the protective sidewalk round the house: the last of the work outside
|
|
65867
|
+
case "exterior":
|
|
65868
|
+
return level >= STAGE_LEVEL.last;
|
|
65627
65869
|
case "perimeter":
|
|
65628
|
-
return level >=
|
|
65870
|
+
return level >= STAGE_LEVEL.last && opts.lotLayer !== false;
|
|
65629
65871
|
default:
|
|
65630
65872
|
return true;
|
|
65631
65873
|
}
|
|
@@ -65633,17 +65875,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65633
65875
|
var EMBEDDED = /* @__PURE__ */ new Set(["wall_pipe", "wall_conduit", "electrical_box"]);
|
|
65634
65876
|
function groupVisible(name, level, opts) {
|
|
65635
65877
|
const roofOn = opts.roofLayer !== false;
|
|
65878
|
+
const bare = level < STAGE_LEVEL.finishes;
|
|
65636
65879
|
if (name === "stage:0:blueprint") return level <= 1;
|
|
65637
|
-
if (name === "stage:1:foundation") return level >=
|
|
65638
|
-
if (name === "stage:1:starter_bars") return level ===
|
|
65639
|
-
if (name === "stage:2:frame") return level >=
|
|
65640
|
-
if (name === "stage:3:masonry") return level >=
|
|
65641
|
-
if (name === "stage:4:installations") return level ===
|
|
65642
|
-
if (name === "stage:4:sewer_boxes") return level >=
|
|
65643
|
-
if (name === "stage:7:roof_framing") return level >=
|
|
65644
|
-
if (name === "roof") return level >=
|
|
65645
|
-
if (name === "attic_tank") return level >=
|
|
65646
|
-
if (/^t\d+$/.test(name)) return level >=
|
|
65880
|
+
if (name === "stage:1:foundation") return level >= STAGE_LEVEL.foundation && bare;
|
|
65881
|
+
if (name === "stage:1:starter_bars") return level === STAGE_LEVEL.foundation;
|
|
65882
|
+
if (name === "stage:2:frame") return level >= STAGE_LEVEL.frame && bare;
|
|
65883
|
+
if (name === "stage:3:masonry") return level >= STAGE_LEVEL.masonry && bare;
|
|
65884
|
+
if (name === "stage:4:installations") return level === STAGE_LEVEL.installations || level >= STAGE_LEVEL.installations && opts.waterLayer === true;
|
|
65885
|
+
if (name === "stage:4:sewer_boxes") return level >= STAGE_LEVEL.installations;
|
|
65886
|
+
if (name === "stage:7:roof_framing") return level >= STAGE_LEVEL.roofFraming && roofOn;
|
|
65887
|
+
if (name === "roof") return level >= STAGE_LEVEL.roof && roofOn;
|
|
65888
|
+
if (name === "attic_tank") return level >= STAGE_LEVEL.installations;
|
|
65889
|
+
if (/^t\d+$/.test(name)) return level >= STAGE_LEVEL.finishes;
|
|
65647
65890
|
return null;
|
|
65648
65891
|
}
|
|
65649
65892
|
function applyConstructionLevel(houseGroup, rawLevel, opts = {}) {
|
|
@@ -65657,7 +65900,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65657
65900
|
const lines = name === "stage:0:blueprint" ? child.getObjectByName(BLUEPRINT_LINES) : void 0;
|
|
65658
65901
|
if (lines) lines.visible = level === 0;
|
|
65659
65902
|
const heap = name === "stage:4:installations" ? child.getObjectByName(SPOIL_HEAP) : void 0;
|
|
65660
|
-
if (heap) heap.visible = level ===
|
|
65903
|
+
if (heap) heap.visible = level === STAGE_LEVEL.installations;
|
|
65904
|
+
if (name === "roof") {
|
|
65905
|
+
for (const mesh3 of child.children) if (/\/plaster$/.test(mesh3.name)) mesh3.visible = level >= STAGE_LEVEL.finishes;
|
|
65906
|
+
}
|
|
65661
65907
|
continue;
|
|
65662
65908
|
}
|
|
65663
65909
|
if (name === "lot") child.visible = level >= 4 && lotOn;
|
|
@@ -65667,7 +65913,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65667
65913
|
const ud = obj.userData;
|
|
65668
65914
|
if (!ud) return;
|
|
65669
65915
|
if (ud.part === "lamp_holder" || ud.part === "lamp_bulb") {
|
|
65670
|
-
obj.visible = typeof ud.id !== "string" || (ud.mount === "slab" ? level
|
|
65916
|
+
obj.visible = typeof ud.id !== "string" || (ud.mount === "slab" ? level >= STAGE_LEVEL.installations && level < STAGE_LEVEL.finishes : level >= STAGE_LEVEL.finishes && level < STAGE_LEVEL.last);
|
|
65671
65917
|
return;
|
|
65672
65918
|
}
|
|
65673
65919
|
if (typeof ud.part === "string" && EMBEDDED.has(ud.part)) {
|
|
@@ -65803,6 +66049,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65803
66049
|
}
|
|
65804
66050
|
return t;
|
|
65805
66051
|
}
|
|
66052
|
+
function battenClearOfSolids(slope, s, [a, b], solids2) {
|
|
66053
|
+
const { batten } = TIMBER;
|
|
66054
|
+
const p0 = down(slope.point(s, a), batten.top), p1 = down(slope.point(s, b), batten.top);
|
|
66055
|
+
const axis2 = Math.abs(p1[0] - p0[0]) < 1e-6 ? 0 : 2;
|
|
66056
|
+
const other = axis2 === 0 ? 2 : 0;
|
|
66057
|
+
const rise = Math.abs(slope.point(1, a)[axis2] - slope.point(0, a)[axis2]);
|
|
66058
|
+
if (rise < 1e-6) return s;
|
|
66059
|
+
const lo = Math.min(p0[other], p1[other]), hi = Math.max(p0[other], p1[other]);
|
|
66060
|
+
const y0 = Math.min(p0[1], p1[1]) - batten.height, y1 = Math.max(p0[1], p1[1]);
|
|
66061
|
+
for (const box5 of solids2) {
|
|
66062
|
+
if (box5[other] > hi || box5[other + 3] < lo || box5[1] > y1 || box5[4] < y0) continue;
|
|
66063
|
+
for (const face of [box5[axis2], box5[axis2 + 3]]) for (const side of [p0[axis2] - batten.width / 2, p0[axis2] + batten.width / 2]) if (Math.abs(face - side) < BATTEN_SIDE_CLEAR) return s + SIDE_STEP * 2 / rise;
|
|
66064
|
+
}
|
|
66065
|
+
return s;
|
|
66066
|
+
}
|
|
65806
66067
|
function spanAt(slope, s) {
|
|
65807
66068
|
return slope.hipped ? [slope.t0 + s + EDGE2, slope.t1 - s - EDGE2] : [slope.t0 + EDGE2, slope.t1 - EDGE2];
|
|
65808
66069
|
}
|
|
@@ -65810,8 +66071,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65810
66071
|
const { batten, rafter, purlin } = TIMBER;
|
|
65811
66072
|
for (let s = batten.spacing / 2; s < slope.run - 0.12; s += batten.spacing) {
|
|
65812
66073
|
const [a0, b0] = spanAt(slope, s);
|
|
65813
|
-
const a = a0 +
|
|
65814
|
-
if (b - a
|
|
66074
|
+
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
66075
|
+
if (b - a <= 0.05) continue;
|
|
66076
|
+
const at4 = battenClearOfSolids(slope, s, [a, b], solids2);
|
|
66077
|
+
addTimberAround(batches.battens, down(slope.point(at4, a), batten.top), down(slope.point(at4, b), batten.top), batten.width, batten.height, keepOut);
|
|
65815
66078
|
}
|
|
65816
66079
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
65817
66080
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -65831,7 +66094,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65831
66094
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
65832
66095
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
65833
66096
|
if (depth < 0.02) return;
|
|
65834
|
-
addTimberAround(batches.timber, p0, p1, purlin.width, depth, keepOut, k === 0 ? void 0 : (end3) => addPost(batches.timber, end3[0], end3[2], slabTop, end3[1] - purlin.height));
|
|
66097
|
+
addTimberAround(batches.timber, p0, p1, k === 0 ? purlin.width - PLATE_NARROWER : purlin.width, depth, keepOut, k === 0 ? void 0 : (end3) => addPost(batches.timber, end3[0], end3[2], slabTop, end3[1] - purlin.height));
|
|
65835
66098
|
if (k === 0) return;
|
|
65836
66099
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
65837
66100
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -65840,6 +66103,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65840
66103
|
}
|
|
65841
66104
|
});
|
|
65842
66105
|
}
|
|
66106
|
+
var BATTEN_SHORT = 0.0185;
|
|
66107
|
+
var BATTEN_SIDE_CLEAR = 35e-4;
|
|
66108
|
+
var PLATE_NARROWER = 8e-3;
|
|
66109
|
+
var BOX_VERTICES = 24;
|
|
66110
|
+
function bareBoxesOf(THREE, groups) {
|
|
66111
|
+
const out = [];
|
|
66112
|
+
const v = new THREE.Vector3();
|
|
66113
|
+
for (const group of groups) {
|
|
66114
|
+
group.updateMatrixWorld(true);
|
|
66115
|
+
group.traverse((o) => {
|
|
66116
|
+
const mesh3 = o;
|
|
66117
|
+
if (!mesh3.isMesh) return;
|
|
66118
|
+
const position = mesh3.geometry.getAttribute("position");
|
|
66119
|
+
const step = position.count > BOX_VERTICES && position.count % BOX_VERTICES === 0 ? BOX_VERTICES : position.count;
|
|
66120
|
+
for (let i = 0; i + step <= position.count; i += step) {
|
|
66121
|
+
const box5 = new THREE.Box3();
|
|
66122
|
+
for (let k = i; k < i + step; k++) box5.expandByPoint(v.fromBufferAttribute(position, k).applyMatrix4(mesh3.matrixWorld));
|
|
66123
|
+
out.push([box5.min.x, box5.min.y, box5.min.z, box5.max.x, box5.max.y, box5.max.z]);
|
|
66124
|
+
}
|
|
66125
|
+
});
|
|
66126
|
+
}
|
|
66127
|
+
return out;
|
|
66128
|
+
}
|
|
65843
66129
|
function buildRoofFramingStage(THREE, roofRects, material, solids2 = [], keepOut = []) {
|
|
65844
66130
|
const group = new THREE.Group();
|
|
65845
66131
|
group.name = "stage:7:roof_framing";
|
|
@@ -66330,7 +66616,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66330
66616
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
66331
66617
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared3.ctx.wallBoxShifts)], shared3.ctx.blockLaid ?? []);
|
|
66332
66618
|
const instGroup = buildInstallationsStage(THREE, r, shared3.ctx.gutterInfo?.drains ?? [], shared3.ctx.paving ?? []);
|
|
66333
|
-
const roofFraming = buildRoofFramingStage(THREE, shared3.ctx.roofRects || [], void 0, shared3.ctx.occupied, [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared3.ctx.gutterInfo?.gutters ?? [])]);
|
|
66619
|
+
const roofFraming = buildRoofFramingStage(THREE, shared3.ctx.roofRects || [], void 0, [...shared3.ctx.occupied ?? [], ...bareBoxesOf(THREE, [stGroups.frame, stGroups.masonry])], [...atticKeepOut(THREE, house, Object.values(parts2)), ...gutterKeepOut(shared3.ctx.gutterInfo?.gutters ?? [])]);
|
|
66334
66620
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
66335
66621
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
66336
66622
|
gs[sg.name] = sg;
|
|
@@ -66826,6 +67112,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66826
67112
|
const part = { id: p.id, material, shape: p.shape, position: p.position };
|
|
66827
67113
|
if (p.rotation) part.rotation = p.rotation;
|
|
66828
67114
|
if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH) part.anchored = true;
|
|
67115
|
+
if (opts.carcass && LOOSE.has(material)) {
|
|
67116
|
+
part.hands = 1;
|
|
67117
|
+
part.tags = ["book"];
|
|
67118
|
+
}
|
|
66829
67119
|
return part;
|
|
66830
67120
|
});
|
|
66831
67121
|
const byId = new Map(drawn.map((p) => [p.id, p]));
|
|
@@ -100484,7 +100774,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100484
100774
|
};
|
|
100485
100775
|
var handleHand = (pair, event, tool2) => {
|
|
100486
100776
|
const { box: box5, model } = pair;
|
|
100487
|
-
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
100777
|
+
if (event.type === "explosion" || event.type === "player" || event.type === "footfall" || event.type === "holster") return;
|
|
100488
100778
|
if (event.type === "tool") {
|
|
100489
100779
|
if (hasWeaponModel(event.weapon)) box5.unequip();
|
|
100490
100780
|
else model.unequip();
|
|
@@ -100514,7 +100804,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100514
100804
|
};
|
|
100515
100805
|
return {
|
|
100516
100806
|
handle(event, tool2) {
|
|
100517
|
-
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
100807
|
+
if (event.type === "explosion" || event.type === "player" || event.type === "footfall" || event.type === "holster") return;
|
|
100518
100808
|
if (event.hand !== "L") {
|
|
100519
100809
|
handleHand(right, event, tool2);
|
|
100520
100810
|
return;
|
|
@@ -100636,6 +100926,72 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100636
100926
|
return { name, parts: [{ id: MODEL_BODY, material: "steel", shape: { kind: "box", size }, position: [0, size[1] / 2, 0], mass: def.mass }], joints: [], tags: ["weapon"] };
|
|
100637
100927
|
}
|
|
100638
100928
|
|
|
100929
|
+
// src/fx/holstered.ts
|
|
100930
|
+
var HOLSTER_PLACEMENT = {
|
|
100931
|
+
hip: { muzzle: [0, -1, 0], out: [-1, 0, 0] },
|
|
100932
|
+
back: { muzzle: [0.55, 0.835, 0], out: [0, 0, -1] }
|
|
100933
|
+
};
|
|
100934
|
+
var holsteredModel = (THREE, weapon2, slot, items) => {
|
|
100935
|
+
const place = HOLSTER_PLACEMENT[slot];
|
|
100936
|
+
const model = place ? buildModeledProp(THREE, { id: weapon2 }, weapon2, void 0, items) : void 0;
|
|
100937
|
+
if (!place || !model) return void 0;
|
|
100938
|
+
const [, height, thickness] = model.userData.footprint ?? [0, 0, 0];
|
|
100939
|
+
const muzzle2 = new THREE.Vector3(...place.muzzle).normalize();
|
|
100940
|
+
const out = new THREE.Vector3(...place.out).normalize();
|
|
100941
|
+
const top = new THREE.Vector3().crossVectors(out, muzzle2).normalize();
|
|
100942
|
+
model.quaternion.setFromRotationMatrix(new THREE.Matrix4().makeBasis(muzzle2, top, out));
|
|
100943
|
+
model.position.copy(top.multiplyScalar(-height / 2)).addScaledVector(out, thickness / 2);
|
|
100944
|
+
const holder = new THREE.Group();
|
|
100945
|
+
holder.name = `holstered_${weapon2}`;
|
|
100946
|
+
holder.add(model);
|
|
100947
|
+
return holder;
|
|
100948
|
+
};
|
|
100949
|
+
var createHolsteredWeapons = (options) => {
|
|
100950
|
+
const { THREE } = options;
|
|
100951
|
+
const models = /* @__PURE__ */ new Map();
|
|
100952
|
+
const away = /* @__PURE__ */ new Map();
|
|
100953
|
+
const place = (weapon2, slot) => {
|
|
100954
|
+
const holder = models.get(`${weapon2}@${slot}`);
|
|
100955
|
+
const pose = options.bodySlot(slot);
|
|
100956
|
+
if (!holder) return;
|
|
100957
|
+
holder.visible = pose !== null;
|
|
100958
|
+
if (!pose) return;
|
|
100959
|
+
holder.position.set(pose.position[0], pose.position[1], pose.position[2]);
|
|
100960
|
+
holder.quaternion.set(pose.quaternion[0], pose.quaternion[1], pose.quaternion[2], pose.quaternion[3]);
|
|
100961
|
+
};
|
|
100962
|
+
return {
|
|
100963
|
+
handle(event) {
|
|
100964
|
+
const key2 = `${event.weapon}@${event.slot}`;
|
|
100965
|
+
if (!event.on) {
|
|
100966
|
+
away.delete(event.weapon);
|
|
100967
|
+
const holder = models.get(key2);
|
|
100968
|
+
if (holder) holder.visible = false;
|
|
100969
|
+
return;
|
|
100970
|
+
}
|
|
100971
|
+
if (!options.arsenal.weapons.has(event.weapon)) return;
|
|
100972
|
+
if (!models.has(key2)) {
|
|
100973
|
+
const holder = holsteredModel(THREE, event.weapon, event.slot, options.items);
|
|
100974
|
+
if (!holder) return;
|
|
100975
|
+
options.scene.add(holder);
|
|
100976
|
+
models.set(key2, holder);
|
|
100977
|
+
}
|
|
100978
|
+
away.set(event.weapon, event.slot);
|
|
100979
|
+
place(event.weapon, event.slot);
|
|
100980
|
+
},
|
|
100981
|
+
update() {
|
|
100982
|
+
for (const [weapon2, slot] of away) place(weapon2, slot);
|
|
100983
|
+
},
|
|
100984
|
+
get drawn() {
|
|
100985
|
+
return [...away.keys()];
|
|
100986
|
+
},
|
|
100987
|
+
dispose() {
|
|
100988
|
+
discardObject3D([...models.values()]);
|
|
100989
|
+
models.clear();
|
|
100990
|
+
away.clear();
|
|
100991
|
+
}
|
|
100992
|
+
};
|
|
100993
|
+
};
|
|
100994
|
+
|
|
100639
100995
|
// assets/weapon-svg/manifest.json
|
|
100640
100996
|
var manifest_default = {
|
|
100641
100997
|
version: 1,
|
|
@@ -102095,8 +102451,14 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102095
102451
|
else if (change.kind === "control" && change.id === "fuse_length" && typeof change.value === "number") lent.configureTool?.({ fuse_length: String(change.value) });
|
|
102096
102452
|
});
|
|
102097
102453
|
const worldEffects = createWorldEffects({ arsenal });
|
|
102454
|
+
const bodySlot = lent.bodySlot?.bind(lent);
|
|
102455
|
+
const holstered = bodySlot ? createHolsteredWeapons({ THREE: lent.THREE, scene: lent.scene, arsenal, ...options.items ? { items: options.items } : {}, bodySlot }) : null;
|
|
102098
102456
|
const offEvents = lent.on((event) => {
|
|
102099
102457
|
worldEffects.handle(event, lent.effects);
|
|
102458
|
+
if (event.type === "holster") {
|
|
102459
|
+
holstered?.handle(event);
|
|
102460
|
+
return;
|
|
102461
|
+
}
|
|
102100
102462
|
if (event.type === "explosion") {
|
|
102101
102463
|
if (lentEngine) return;
|
|
102102
102464
|
const away = Math.hypot(event.point[0] - camera2.position.x, event.point[1] - camera2.position.y, event.point[2] - camera2.position.z);
|
|
@@ -102114,7 +102476,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102114
102476
|
}
|
|
102115
102477
|
if (event.type === "reload") lent.log(fill2(event.phase === "start" ? text.reloadStart : text.reloadEnd, { weapon: arsenal.name(event.weapon), ammo: tool2.ammo, capacity: tool2.capacity }), { weapon: event.weapon, phase: event.phase });
|
|
102116
102478
|
});
|
|
102117
|
-
const offFrame = lent.onFrame((dt) =>
|
|
102479
|
+
const offFrame = lent.onFrame((dt) => {
|
|
102480
|
+
created.update(dt);
|
|
102481
|
+
holstered?.update();
|
|
102482
|
+
});
|
|
102118
102483
|
const offHands = lent.setHandTargets?.(() => created.handTargets());
|
|
102119
102484
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
102120
102485
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
@@ -102128,6 +102493,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102128
102493
|
offHands?.();
|
|
102129
102494
|
offMuzzle?.();
|
|
102130
102495
|
created.dispose();
|
|
102496
|
+
holstered?.dispose();
|
|
102131
102497
|
audio?.dispose();
|
|
102132
102498
|
fx = null;
|
|
102133
102499
|
host = null;
|