@adatechnology/game-weapons-three 0.23.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +745 -220
- 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 +10 -9
- 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,
|
|
@@ -26151,7 +26168,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26151
26168
|
const dz = Math.max(box5.min[2] - loss.z, 0, loss.z - box5.max[2]);
|
|
26152
26169
|
return Math.hypot(dx, dz) < loss.radius + loss.depth * groundCfg.spread;
|
|
26153
26170
|
};
|
|
26154
|
-
const
|
|
26171
|
+
const footprintOf2 = (o, b, loss) => {
|
|
26155
26172
|
const box5 = aabbOf(b.p.spec.shape, b.p.pos, b.p.q);
|
|
26156
26173
|
const long = box5.max[0] - box5.min[0] >= box5.max[2] - box5.min[2] ? 0 : 2;
|
|
26157
26174
|
const across2 = long === 0 ? 2 : 0;
|
|
@@ -26594,7 +26611,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26594
26611
|
const opened = [];
|
|
26595
26612
|
const settled = [];
|
|
26596
26613
|
let lost = false;
|
|
26597
|
-
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp:
|
|
26614
|
+
const touched = bearersOf(o).filter((b) => nearLoss(o, b.p, loss)).map((b) => ({ b, fp: footprintOf2(o, b, loss) })).filter(({ fp }) => fp.share > 0 || fp.drop >= SUBSIDE_MIN);
|
|
26598
26615
|
const bearers = bearersOf(o);
|
|
26599
26616
|
const pillarFirst = (b) => b.p.spec.structure?.role === "column" ? 0 : 1;
|
|
26600
26617
|
const order2 = [...touched].sort((x, y) => pillarFirst(x.b) - pillarFirst(y.b));
|
|
@@ -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,17 @@ 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
|
+
fixed: true
|
|
51909
|
+
},
|
|
51848
51910
|
{
|
|
51849
51911
|
id: "electrical_panel",
|
|
51850
51912
|
group: "electrical",
|
|
@@ -52698,6 +52760,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
52698
52760
|
// was `maquina`
|
|
52699
52761
|
});
|
|
52700
52762
|
var OWN_TYPES = Object.freeze({ lamp: true, gas_piped: true });
|
|
52763
|
+
var KITCHEN_SINK_WORKTOP = 0.9;
|
|
52701
52764
|
var sourceOf = (result2) => result2;
|
|
52702
52765
|
var ADAPTER_VERSION = "0.3.0";
|
|
52703
52766
|
var r3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
@@ -53088,7 +53151,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53088
53151
|
list2.push(sink);
|
|
53089
53152
|
let cabinet2 = null;
|
|
53090
53153
|
if (rest2 >= 0.35) {
|
|
53091
|
-
cabinet2 = part(m.id + "#cabinet", "kitchen_cabinet_base", rest2, m.d, m.h, 0, left ? width / 2 - rest2 / 2 : -(width / 2) + rest2 / 2, 0);
|
|
53154
|
+
cabinet2 = part(m.id + "#cabinet", "kitchen_cabinet_base", rest2, m.d, opts.visor ? m.h : KITCHEN_SINK_WORKTOP, 0, left ? width / 2 - rest2 / 2 : -(width / 2) + rest2 / 2, 0);
|
|
53092
53155
|
list2.push(cabinet2);
|
|
53093
53156
|
}
|
|
53094
53157
|
if (contents[m.id]) store(cabinet2 ? [["kitchen_cabinet_base", cabinet2.item], ["sink_kitchen", sink.item]] : [["sink_kitchen", sink.item]], contents[m.id]);
|
|
@@ -53258,11 +53321,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53258
53321
|
house: [r3(K.x(end3[0]) - px), end3[2], r3(K.z(end3[1]) - pz)]
|
|
53259
53322
|
};
|
|
53260
53323
|
if (ee.tap || electrical.mode === "tap") item.variant = "gato";
|
|
53324
|
+
else if (ee.street === "network") item.variant = "network";
|
|
53261
53325
|
const e = entry2("service_entrance", "service_entrance", item, "service_entrance", -1);
|
|
53262
53326
|
push(e);
|
|
53263
53327
|
result2.serviceEntrance = e.id;
|
|
53264
53328
|
}
|
|
53265
|
-
if (ee && ee.
|
|
53329
|
+
if (ee && ee.mast && onFloor(-1, true)) {
|
|
53330
|
+
const path = mastPathOf(ee.mast);
|
|
53331
|
+
const x0 = K.x(ee.mast.u);
|
|
53332
|
+
const z0 = K.z(ee.mast.v);
|
|
53333
|
+
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)]) };
|
|
53334
|
+
const e = entry2("service_mast", "service_mast", item, "service_mast", -1);
|
|
53335
|
+
e.floorY = o.base;
|
|
53336
|
+
push(e);
|
|
53337
|
+
result2.serviceMast = e.id;
|
|
53338
|
+
} else if (ee && ee.descent && ee.descent.length > 1 && onFloor(-1, true)) conduit("conduit_descent", ee.descent, -1);
|
|
53266
53339
|
const q = electrical.panel;
|
|
53267
53340
|
if (q && onFloor(q.floor, false)) {
|
|
53268
53341
|
const hdq = 0.06;
|
|
@@ -53592,9 +53665,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53592
53665
|
{ type: "sofa_3seat", category: "sofa", w: 2.1, d: 0.9, h: 0.85, color: { role: "fabric_main" } },
|
|
53593
53666
|
{ type: "sofa_2seat", category: "sofa", w: 1.6, d: 0.85, h: 0.85, color: { role: "fabric_main" } },
|
|
53594
53667
|
{ type: "sofa_l", category: "sofa", w: 2.4, d: 0.95, h: 0.85, color: { role: "fabric_main" } },
|
|
53595
|
-
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55 },
|
|
53596
|
-
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5 },
|
|
53597
|
-
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6 },
|
|
53668
|
+
{ type: "tv_unit", category: "tv_unit", w: 1.6, d: 0.45, h: 0.55, opening: 0.4 },
|
|
53669
|
+
{ type: "tv_unit_small", category: "tv_unit", w: 1.2, d: 0.4, h: 0.5, opening: 0.4 },
|
|
53670
|
+
{ type: "tv_unit_large", category: "tv_unit", w: 1.9, d: 0.45, h: 0.6, opening: 0.4 },
|
|
53598
53671
|
{ type: "tv", category: "tv", w: 0.9, d: 0.1, h: 0.55 },
|
|
53599
53672
|
{ type: "tv_large", category: "tv", w: 1.2, d: 0.1, h: 0.7 },
|
|
53600
53673
|
{ type: "coffee_table", category: "coffee_table", w: 0.9, d: 0.55, h: 0.42 },
|
|
@@ -53606,33 +53679,33 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53606
53679
|
{ type: "shelf_unit", category: "shelf_unit", w: 1.4, d: 0.4, h: 1.8 },
|
|
53607
53680
|
{ type: "shelf_unit_small", category: "shelf_unit", w: 1, d: 0.35, h: 1.5 },
|
|
53608
53681
|
{ type: "floor_lamp", category: "lamp", w: 0.3, d: 0.3, h: 1.5 },
|
|
53609
|
-
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85 },
|
|
53682
|
+
{ type: "sideboard", category: "sideboard", w: 1.2, d: 0.4, h: 0.85, opening: 0.4 },
|
|
53610
53683
|
{ type: "console_table", category: "console_table", w: 0.9, d: 0.3, h: 0.85 },
|
|
53611
53684
|
{ type: "bench", category: "bench", w: 1, d: 0.35, h: 0.45 },
|
|
53612
53685
|
{ type: "workbench", category: "workbench", w: 1.2, d: 0.6, h: 0.95 },
|
|
53613
53686
|
{ type: "floor_mirror", category: "mirror", w: 0.5, d: 0.12, h: 1.8 },
|
|
53614
|
-
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, color: { role: "metal" } },
|
|
53615
|
-
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, color: { role: "metal" } },
|
|
53616
|
-
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
53617
|
-
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, color: { role: "metal" } },
|
|
53618
|
-
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
53619
|
-
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
53620
|
-
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, color: { role: "metal" } },
|
|
53687
|
+
{ type: "fridge", category: "fridge", w: 0.7, d: 0.68, h: 1.8, opening: 0.6, color: { role: "metal" } },
|
|
53688
|
+
{ type: "fridge_large", category: "fridge", w: 0.8, d: 0.72, h: 1.85, opening: 0.6, color: { role: "metal" } },
|
|
53689
|
+
{ type: "stove", category: "stove", w: 0.62, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
53690
|
+
{ type: "stove_4burner", category: "stove", w: 0.7, d: 0.62, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
53691
|
+
{ type: "kitchen_cabinet", category: "kitchen_cabinet", overhead: true, w: 1.6, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
53692
|
+
{ type: "kitchen_cabinet_large", category: "kitchen_cabinet", overhead: true, w: 2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
53693
|
+
{ type: "kitchen_cabinet_small", category: "kitchen_cabinet", overhead: true, w: 1.2, d: 0.6, h: 0.95, opening: 0.5, color: { role: "metal" } },
|
|
53621
53694
|
{ type: "dining_table", category: "dining_table", w: 1.1, d: 0.8, h: 0.78 },
|
|
53622
53695
|
{ type: "dining_table_small", category: "dining_table", w: 0.9, d: 0.7, h: 0.75 },
|
|
53623
53696
|
{ type: "dining_table_round", category: "dining_table", w: 0.9, d: 0.9, h: 0.75 },
|
|
53624
53697
|
{ type: "microwave", category: "appliance", w: 0.5, d: 0.4, h: 0.3, color: { role: "metal" } },
|
|
53625
53698
|
{ type: "trash_bin", category: "trash_bin", w: 0.3, d: 0.3, h: 0.6 },
|
|
53626
|
-
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2 },
|
|
53699
|
+
{ type: "pantry", category: "pantry", w: 1.2, d: 0.4, h: 2, opening: 0.5 },
|
|
53627
53700
|
{ type: "double_bed", category: "bed", w: 1.6, d: 2.05, h: 0.62, color: { role: "fabric_main" } },
|
|
53628
53701
|
{ type: "queen_bed", category: "bed", w: 1.8, d: 2.1, h: 0.62, color: { role: "fabric_main" } },
|
|
53629
53702
|
{ type: "single_bed", category: "bed", w: 0.95, d: 2, h: 0.55, color: { role: "fabric_main" } },
|
|
53630
53703
|
{ type: "king_bed", category: "bed_king", w: 2, d: 2.15, h: 0.65, color: { role: "fabric_main" } },
|
|
53631
|
-
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6 },
|
|
53632
|
-
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2 },
|
|
53633
|
-
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9 },
|
|
53634
|
-
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1 },
|
|
53635
|
-
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85 },
|
|
53704
|
+
{ type: "nightstand", category: "nightstand", w: 0.45, d: 0.42, h: 0.6, opening: 0.45 },
|
|
53705
|
+
{ type: "wardrobe", category: "wardrobe", w: 1.6, d: 0.6, h: 2, opening: 0.5 },
|
|
53706
|
+
{ type: "wardrobe_small", category: "wardrobe", w: 1, d: 0.55, h: 1.9, opening: 0.5 },
|
|
53707
|
+
{ type: "wardrobe_large", category: "wardrobe_large", w: 2.4, d: 0.65, h: 2.1, opening: 0.5 },
|
|
53708
|
+
{ type: "dresser", category: "dresser", w: 1, d: 0.45, h: 0.85, opening: 0.5 },
|
|
53636
53709
|
{ type: "desk", category: "desk", w: 1.1, d: 0.6, h: 0.75 },
|
|
53637
53710
|
{ type: "vanity_table", category: "vanity_table", w: 1, d: 0.5, h: 0.8 },
|
|
53638
53711
|
{ type: "toilet", category: "toilet", w: 0.4, d: 0.62, h: 0.75, color: { role: "ceiling" } },
|
|
@@ -53642,8 +53715,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53642
53715
|
{ type: "shower_large", category: "shower", windowHeight: 1.95, w: 1.1, d: 1.1, h: 0.1, color: { role: "ceiling" } },
|
|
53643
53716
|
{ type: "hamper", category: "hamper", w: 0.35, d: 0.3, h: 0.5 },
|
|
53644
53717
|
{ type: "laundry_tub", category: "laundry_tub", w: 0.6, d: 0.55, h: 0.9, color: { role: "metal" } },
|
|
53645
|
-
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, color: { role: "metal" } },
|
|
53646
|
-
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8 },
|
|
53718
|
+
{ type: "washing_machine", category: "washing_machine", w: 0.6, d: 0.65, h: 0.9, opening: 0.5, color: { role: "metal" } },
|
|
53719
|
+
{ type: "laundry_cabinet", category: "laundry_cabinet", w: 0.8, d: 0.4, h: 1.8, opening: 0.45 },
|
|
53647
53720
|
{ type: "laundry_shelf", category: "laundry_shelf", w: 1, d: 0.35, h: 1.6 },
|
|
53648
53721
|
{ type: "car", category: "car", w: 1.85, d: 4.3, h: 1.5, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
53649
53722
|
{ type: "car_small", category: "car", w: 1.7, d: 3.8, h: 1.45, color: { pick: [1842206, 15263974, 10132897, 8003359, 2046559, 4016698, 12103834] } },
|
|
@@ -53653,10 +53726,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53653
53726
|
{ type: "office_desk", category: "office_desk", w: 1.4, d: 0.7, h: 0.75 },
|
|
53654
53727
|
{ type: "office_desk_large", category: "office_desk", w: 1.6, d: 0.8, h: 0.75 },
|
|
53655
53728
|
{ type: "bookcase", category: "bookcase", w: 1.2, d: 0.35, h: 2 },
|
|
53656
|
-
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3 },
|
|
53729
|
+
{ type: "filing_cabinet", category: "filing_cabinet", w: 0.5, d: 0.6, h: 1.3, opening: 0.5 },
|
|
53657
53730
|
{ type: "dining_table_large", category: "dining_table_large", w: 2.4, d: 1.1, h: 0.78 },
|
|
53658
|
-
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9 },
|
|
53659
|
-
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2 },
|
|
53731
|
+
{ type: "buffet", category: "buffet", w: 1.6, d: 0.5, h: 0.9, opening: 0.45 },
|
|
53732
|
+
{ type: "china_cabinet", category: "china_cabinet", w: 1.2, d: 0.45, h: 2, opening: 0.45 },
|
|
53660
53733
|
{ type: "stairs", category: "stairs", w: 1, d: 3.2, h: 2.8 },
|
|
53661
53734
|
{ type: "planter_bed", category: "planter_bed", w: 3, d: 0.7, h: 0.4, color: { role: "dirt" } },
|
|
53662
53735
|
{ type: "planter_bed_small", category: "planter_bed", w: 1.8, d: 0.6, h: 0.4, color: { role: "dirt" } },
|
|
@@ -53696,7 +53769,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53696
53769
|
{ type: "breakfast_bar", category: "breakfast_bar", w: 2, d: 0.55, h: 1, window: true },
|
|
53697
53770
|
{ type: "sauna", category: "sauna", w: 2, d: 2, h: 2.1 },
|
|
53698
53771
|
{ type: "soaking_tub", category: "soaking_tub", w: 1.6, d: 1.6, h: 0.8 },
|
|
53699
|
-
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2 },
|
|
53772
|
+
{ type: "closet_wardrobe", category: "wardrobe_large", w: 2, d: 0.6, h: 2.2, opening: 0.5 },
|
|
53700
53773
|
{ type: "sofa_xl", category: "sofa", w: 3, d: 1, h: 0.85, color: { role: "fabric_main" } },
|
|
53701
53774
|
{ type: "gourmet_counter", category: "gourmet", w: 3, d: 0.7, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
53702
53775
|
{ type: "gourmet_counter_small", category: "gourmet", w: 1.8, d: 0.65, h: 1, window: true, equip: ["bbq_grill", "kitchen_cabinet"] },
|
|
@@ -54773,7 +54846,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54773
54846
|
}
|
|
54774
54847
|
var residentialTower = residentialTowerTemplate();
|
|
54775
54848
|
|
|
54776
|
-
// ../game-floorplan-three/dist/chunk-
|
|
54849
|
+
// ../game-floorplan-three/dist/chunk-6GFCK5NZ.js
|
|
54777
54850
|
var __defProp4 = Object.defineProperty;
|
|
54778
54851
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
54779
54852
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -56522,10 +56595,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56522
56595
|
}
|
|
56523
56596
|
function floorLamp(M, A) {
|
|
56524
56597
|
const K2 = kit2(M, A, M.y || 0), color2 = colorTemperature(M), id = "lamp_pe_" + M.seed, h = Math.min(1.6, M.h || 1.5), meta = { id, room: M.room, on: !!M.on, color: color2, lightType: "floor", hidden: !M.on };
|
|
56525
|
-
|
|
56598
|
+
const shade3 = M.visorScene ? 0.17 : Math.min(0.17, Math.min(M.w || 0.34, M.d || 0.34) / 2 - 6e-3);
|
|
56599
|
+
K2.c("metal", 0, 0, 0, Math.min(0.13, shade3), 0.025, 2763308);
|
|
56526
56600
|
K2.c("metal", 0, 0.025, 0, 0.011, h - 0.3, 2763308);
|
|
56527
|
-
K2.c("plain", 0, h - 0.28, 0,
|
|
56528
|
-
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0,
|
|
56601
|
+
K2.c("plain", 0, h - 0.28, 0, shade3, 0.26, 15656656);
|
|
56602
|
+
K2.part("lamp", 0, h - 0.28, 0, () => K2.c("emissive", 0, h - 0.28, 0, shade3 + 3e-3, 0.262, color2), meta);
|
|
56529
56603
|
if (M.on && A.light) A.light(Object.assign({}, M, { lampId: id }), 0, h - 0.15, 0, color2, 5, "floor");
|
|
56530
56604
|
}
|
|
56531
56605
|
function sconce(M, A) {
|
|
@@ -58193,7 +58267,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58193
58267
|
var FEED_EXIT_Y = -0.15;
|
|
58194
58268
|
var FEED_BOX_OFFSET = 0.25;
|
|
58195
58269
|
var BRICK_FACE_INSET = 0.014;
|
|
58270
|
+
var SLAB_MIDDLE = 0.065;
|
|
58271
|
+
var CEILING_SLAB = 0.5;
|
|
58272
|
+
var PASSING_END_CLEAR = { water: 0.335, conduit: 0.485 };
|
|
58273
|
+
var SLAB_LIFT = { water: -0.02, conduit: 0.015 };
|
|
58196
58274
|
var OPENING_CLEARANCE = 0.12;
|
|
58275
|
+
var DEFAULT_END_CLEAR = 0.1;
|
|
58197
58276
|
var DEFAULT_THICKNESS = 0.15;
|
|
58198
58277
|
function atticFloor(plan) {
|
|
58199
58278
|
const top = plan.floors[plan.floors.length - 1];
|
|
@@ -58206,18 +58285,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58206
58285
|
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
58286
|
}
|
|
58208
58287
|
var inside2 = (box5, u, v, margin) => u >= box5[0] - margin && u <= box5[2] + margin && v >= box5[1] - margin && v <= box5[3] + margin;
|
|
58209
|
-
function
|
|
58288
|
+
function reaches(plan, opening, floor2) {
|
|
58289
|
+
if (opening.floor === floor2) return true;
|
|
58290
|
+
if (opening.floor > floor2 || opening.y1 === void 0) return false;
|
|
58291
|
+
return (plan.floors[opening.floor]?.y0 ?? 0) + opening.y1 > (plan.floors[floor2]?.y0 ?? 0);
|
|
58292
|
+
}
|
|
58293
|
+
function clearOfOpenings(plan, wall, along2, endClear = DEFAULT_END_CLEAR) {
|
|
58210
58294
|
const line = wall.axis === "u" ? wall.v0 : wall.u0;
|
|
58211
58295
|
const a0 = wall.axis === "u" ? wall.u0 : wall.v0, a1 = wall.axis === "u" ? wall.u1 : wall.v1;
|
|
58212
|
-
let at4 = along2;
|
|
58296
|
+
let at4 = endClear > DEFAULT_END_CLEAR ? Math.max(a0 + endClear, Math.min(a1 - endClear, along2)) : along2;
|
|
58213
58297
|
for (const o of plan.openings) {
|
|
58214
|
-
if (o.
|
|
58298
|
+
if (o.axis !== wall.axis || Math.abs(o.pos - line) > 0.05 || !reaches(plan, o, wall.floor)) continue;
|
|
58215
58299
|
const lo = o.at - o.width / 2 - OPENING_CLEARANCE, hi = o.at + o.width / 2 + OPENING_CLEARANCE;
|
|
58216
58300
|
if (at4 <= lo || at4 >= hi) continue;
|
|
58217
58301
|
const toLo = at4 - lo, toHi = hi - at4;
|
|
58218
58302
|
at4 = toLo <= toHi && lo >= a0 + 0.1 || hi > a1 - 0.1 ? lo : hi;
|
|
58219
58303
|
}
|
|
58220
|
-
return Math.max(a0 +
|
|
58304
|
+
return Math.max(a0 + DEFAULT_END_CLEAR, Math.min(a1 - DEFAULT_END_CLEAR, at4));
|
|
58221
58305
|
}
|
|
58222
58306
|
function wallDrop(plan, floor2, u, v, options = {}) {
|
|
58223
58307
|
let best = null;
|
|
@@ -58231,7 +58315,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58231
58315
|
if (!best) return null;
|
|
58232
58316
|
const { wall } = best;
|
|
58233
58317
|
const alongU = wall.axis === "u";
|
|
58234
|
-
const along2 = clearOfOpenings(plan, wall, best.along);
|
|
58318
|
+
const along2 = clearOfOpenings(plan, wall, best.along, options.endClear);
|
|
58235
58319
|
const line = alongU ? wall.v0 : wall.u0;
|
|
58236
58320
|
const [ru, rv] = options.toward ?? [u, v];
|
|
58237
58321
|
const across2 = alongU ? rv - line : ru - line;
|
|
@@ -58320,6 +58404,31 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58320
58404
|
}
|
|
58321
58405
|
return true;
|
|
58322
58406
|
}
|
|
58407
|
+
var DOOR_HEAD = 2.1;
|
|
58408
|
+
function crossesOpening(plan, a, b, y) {
|
|
58409
|
+
return plan.openings.some((o) => {
|
|
58410
|
+
const base = plan.floors[o.floor]?.y0 ?? 0;
|
|
58411
|
+
if (y <= base + (o.y0 ?? 0) || y >= base + (o.y1 ?? DOOR_HEAD)) return false;
|
|
58412
|
+
const [p0, p1, q0, q1] = o.axis === "u" ? [a[1], b[1], a[0], b[0]] : [a[0], b[0], a[1], b[1]];
|
|
58413
|
+
const across2 = Math.min(p0, p1) <= o.pos + 0.1 && Math.max(p0, p1) >= o.pos - 0.1;
|
|
58414
|
+
return across2 && Math.max(Math.min(q0, q1), o.at - o.width / 2) < Math.min(Math.max(q0, q1), o.at + o.width / 2);
|
|
58415
|
+
});
|
|
58416
|
+
}
|
|
58417
|
+
function slabPath(plan, from, to, y, first) {
|
|
58418
|
+
const clear = (path) => !path.slice(1).some((p, i) => crossesOpening(plan, [path[i][0], path[i][2]], [p[0], p[2]], y));
|
|
58419
|
+
for (const order2 of [first, first === "u" ? "v" : "u"]) {
|
|
58420
|
+
const path = atticPath(from, to, y, order2);
|
|
58421
|
+
if (clear(path)) return path;
|
|
58422
|
+
}
|
|
58423
|
+
const [cu, cv] = centreOf(houseFootprint(plan));
|
|
58424
|
+
const alongU = Math.abs(to[0] - from[0]) >= Math.abs(to[1] - from[1]);
|
|
58425
|
+
const step = alongU ? [0, Math.sign(cv - from[1]) * SLAB_DETOUR] : [Math.sign(cu - from[0]) * SLAB_DETOUR, 0];
|
|
58426
|
+
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]]];
|
|
58427
|
+
}
|
|
58428
|
+
var SLAB_DETOUR = 0.6;
|
|
58429
|
+
function toMiddle(drop) {
|
|
58430
|
+
return drop.wall.axis === "u" ? { ...drop, v: drop.wall.v0 } : { ...drop, u: drop.wall.u0 };
|
|
58431
|
+
}
|
|
58323
58432
|
function atticPath(from, to, y, first) {
|
|
58324
58433
|
const corner = first === "u" ? [to[0], from[1]] : [from[0], to[1]];
|
|
58325
58434
|
const out = [[from[0], y, from[1]]];
|
|
@@ -58334,18 +58443,43 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58334
58443
|
const storey = plan.floors[floor2];
|
|
58335
58444
|
const y = (storey ? storey.y0 : 0) + target.y;
|
|
58336
58445
|
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
|
-
}
|
|
58446
|
+
if (inside2(footprint, target.u, target.v, 0.4)) return descend(plan, from, target, { ...options, attic, first, y });
|
|
58342
58447
|
const feed = feedTo(plan, target, y, options);
|
|
58343
58448
|
if (!feed) return [];
|
|
58344
58449
|
return [...atticPath(from, [feed.exit.u, feed.exit.v], attic, first), ...feed.route];
|
|
58345
58450
|
}
|
|
58451
|
+
function descend(plan, from, target, options) {
|
|
58452
|
+
const floor2 = Math.max(0, target.floor);
|
|
58453
|
+
const top = Math.max(floor2, plan.floors.length - 1);
|
|
58454
|
+
const route = [];
|
|
58455
|
+
let at4 = from;
|
|
58456
|
+
let height = options.attic;
|
|
58457
|
+
for (let storey = top; storey >= floor2; storey--) {
|
|
58458
|
+
const passing = storey !== floor2 || options.passing === true;
|
|
58459
|
+
const found = wallDrop(plan, storey, target.u, target.v, passing ? { ...options, surface: false, endClear: PASSING_END_CLEAR[options.kind] } : options);
|
|
58460
|
+
if (!found) return [];
|
|
58461
|
+
const drop = passing && options.kind === "conduit" ? toMiddle(found) : found;
|
|
58462
|
+
const path = slabPath(plan, at4, [drop.u, drop.v], height, options.first);
|
|
58463
|
+
route.push(...route.length ? path.slice(1) : path);
|
|
58464
|
+
at4 = [drop.u, drop.v];
|
|
58465
|
+
if (storey === floor2) break;
|
|
58466
|
+
height = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT[options.kind];
|
|
58467
|
+
route.push([drop.u, height, drop.v]);
|
|
58468
|
+
}
|
|
58469
|
+
route.push([at4[0], options.y, at4[1]]);
|
|
58470
|
+
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);
|
|
58471
|
+
}
|
|
58346
58472
|
function routeToCeiling(plan, from, u, v, ceilingY) {
|
|
58347
58473
|
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
58348
|
-
if (inside2(houseFootprint(plan), u, v, 0.4))
|
|
58474
|
+
if (inside2(houseFootprint(plan), u, v, 0.4)) {
|
|
58475
|
+
const over = plan.floors.findIndex((floor2, index) => index > 0 && floor2.y0 > ceilingY - CEILING_SLAB);
|
|
58476
|
+
if (over < 0) return [...atticPath(from, [u, v], attic, "v"), [u, ceilingY, v]];
|
|
58477
|
+
const slabY = (plan.floors[over]?.y0 ?? 0) - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
58478
|
+
const down2 = descend(plan, from, { u, v, y: 0, floor: over }, { kind: "conduit", attic, first: "v", y: slabY, passing: true });
|
|
58479
|
+
const foot = down2[down2.length - 1];
|
|
58480
|
+
if (!foot) return [];
|
|
58481
|
+
return [...down2, ...slabPath(plan, [foot[0], foot[2]], [u, v], slabY, "v").slice(1), [u, Math.min(ceilingY, slabY), v]];
|
|
58482
|
+
}
|
|
58349
58483
|
const feed = feedTo(plan, { u, v }, ceilingY + IN_SLAB, {});
|
|
58350
58484
|
if (!feed) return [];
|
|
58351
58485
|
const top = feed.route[feed.route.length - 1];
|
|
@@ -58363,6 +58497,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58363
58497
|
return { walls: plan.walls, openings: [...plan.doors, ...plan.windows], floors: plan.floors };
|
|
58364
58498
|
}
|
|
58365
58499
|
var toPlan = (route) => route.map((p) => [p[0], p[2], p[1]]);
|
|
58500
|
+
function homeRun(plan, run) {
|
|
58501
|
+
const { riser, floor: floor2, top, home, ceilingY } = run;
|
|
58502
|
+
const start = [riser.u, top, riser.v];
|
|
58503
|
+
const above2 = plan.floors[floor2 + 1];
|
|
58504
|
+
if (above2 && above2.y0 > ceilingY - CEILING_SLAB && inside2(houseFootprint(plan), home[0], home[1], 0.4)) {
|
|
58505
|
+
const slabY = above2.y0 - SLAB_MIDDLE + SLAB_LIFT.conduit;
|
|
58506
|
+
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]]];
|
|
58507
|
+
}
|
|
58508
|
+
const attic = atticFloor(plan) + ATTIC_LIFT.conduit;
|
|
58509
|
+
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();
|
|
58510
|
+
const route = [start, ...up.slice(1), ...routeToCeiling(plan, [riser.u, riser.v], home[0], home[1], ceilingY)];
|
|
58511
|
+
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);
|
|
58512
|
+
}
|
|
58366
58513
|
function routeConduits(plan, electrical, lamps) {
|
|
58367
58514
|
const Q = electrical.panel;
|
|
58368
58515
|
const terminals = /* @__PURE__ */ new Map();
|
|
@@ -58381,7 +58528,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58381
58528
|
const ceilingY = lamp ? lamp.y : storey ? storey.y0 + storey.ceiling : 2.8;
|
|
58382
58529
|
homes.set(c.circuit, [home[0], home[1], ceilingY]);
|
|
58383
58530
|
const top = (Q.y ?? 1.5) + (Q.h ?? 0.4) / 2;
|
|
58384
|
-
return { ...c, points:
|
|
58531
|
+
return { ...c, points: toPlan(homeRun(plan, { riser, floor: floor2, top, home, ceilingY })) };
|
|
58385
58532
|
}
|
|
58386
58533
|
const target = terminals.get(c.to);
|
|
58387
58534
|
const start = homes.get(c.from) ?? (home ? [home[0], home[1], atticFloor(plan)] : void 0);
|
|
@@ -58704,6 +58851,67 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58704
58851
|
group.userData.rain = { pieces: rainwater.pieces, trenches: [...rainwater.trenches, ...rainwater.boxes.map(pitOf)].map((t) => t.rect), boxes: rainwater.boxes };
|
|
58705
58852
|
return group;
|
|
58706
58853
|
}
|
|
58854
|
+
var SUBFLOOR_Y = -0.15;
|
|
58855
|
+
var RISER_CLEAR = 2e-3;
|
|
58856
|
+
var WALL_OUTLET_HEIGHT = { tap: 0.5, tub: 0.45, machine: 0.5 };
|
|
58857
|
+
var FLOOR_OUTLET_DROP = 3e-3;
|
|
58858
|
+
function square(a, b, y) {
|
|
58859
|
+
const corner = [b[0], y, a[1]];
|
|
58860
|
+
const out = [];
|
|
58861
|
+
if (Math.abs(b[0] - a[0]) > 1e-4 && Math.abs(b[1] - a[1]) > 1e-4) out.push(corner);
|
|
58862
|
+
out.push([b[0], y, b[1]]);
|
|
58863
|
+
return out;
|
|
58864
|
+
}
|
|
58865
|
+
var onCentre = (at4) => {
|
|
58866
|
+
if (at4.wall.axis === "u") return [at4.u, at4.wall.v0 + Math.sign(at4.v - at4.wall.v0) * STACK_OFF_CENTRE];
|
|
58867
|
+
return [at4.wall.u0 + Math.sign(at4.u - at4.wall.u0) * STACK_OFF_CENTRE, at4.v];
|
|
58868
|
+
};
|
|
58869
|
+
var STACK_OFF_CENTRE = 0.013;
|
|
58870
|
+
function drainRoute(plan, point) {
|
|
58871
|
+
const floor2 = point.floor;
|
|
58872
|
+
if (floor2 < 0) return null;
|
|
58873
|
+
const y0 = plan.floors[floor2]?.y0 ?? 0;
|
|
58874
|
+
const outlet = WALL_OUTLET_HEIGHT[point.kind];
|
|
58875
|
+
const points = [];
|
|
58876
|
+
let at4 = [point.u, point.v];
|
|
58877
|
+
let storey = floor2;
|
|
58878
|
+
if (outlet !== void 0) {
|
|
58879
|
+
const drop = wallDrop(plan, floor2, point.u, point.v);
|
|
58880
|
+
if (!drop) return null;
|
|
58881
|
+
at4 = onCentre(drop);
|
|
58882
|
+
points.push([at4[0], y0 + outlet, at4[1]]);
|
|
58883
|
+
} else {
|
|
58884
|
+
points.push([point.u, y0 - FLOOR_OUTLET_DROP, point.v]);
|
|
58885
|
+
if (floor2 > 0) {
|
|
58886
|
+
const slabY = y0 - SLAB_MIDDLE;
|
|
58887
|
+
points.push([point.u, slabY, point.v]);
|
|
58888
|
+
const below = wallDrop(plan, floor2 - 1, point.u, point.v);
|
|
58889
|
+
if (!below) return null;
|
|
58890
|
+
at4 = onCentre(below);
|
|
58891
|
+
points.push(...square([point.u, point.v], at4, slabY));
|
|
58892
|
+
storey = floor2 - 1;
|
|
58893
|
+
}
|
|
58894
|
+
}
|
|
58895
|
+
for (; storey > 0; storey--) {
|
|
58896
|
+
const slabY = (plan.floors[storey]?.y0 ?? 0) - SLAB_MIDDLE;
|
|
58897
|
+
points.push([at4[0], slabY, at4[1]]);
|
|
58898
|
+
const below = wallDrop(plan, storey - 1, at4[0], at4[1]);
|
|
58899
|
+
if (!below) continue;
|
|
58900
|
+
const from = at4;
|
|
58901
|
+
at4 = onCentre(below);
|
|
58902
|
+
points.push(...square(from, at4, slabY));
|
|
58903
|
+
}
|
|
58904
|
+
if (Math.hypot(at4[0] - point.u, at4[1] - point.v) < 1e-3) return null;
|
|
58905
|
+
{
|
|
58906
|
+
points.push([at4[0], SUBFLOOR_Y, at4[1]]);
|
|
58907
|
+
const legs = square(at4, [point.u, point.v], SUBFLOOR_Y);
|
|
58908
|
+
const last = legs.length > 1 ? legs[legs.length - 2] : [at4[0], SUBFLOOR_Y, at4[1]];
|
|
58909
|
+
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;
|
|
58910
|
+
legs[legs.length - 1] = [last[0] + (point.u - last[0]) * stop, SUBFLOOR_Y, last[2] + (point.v - last[2]) * stop];
|
|
58911
|
+
points.push(...legs);
|
|
58912
|
+
}
|
|
58913
|
+
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);
|
|
58914
|
+
}
|
|
58707
58915
|
var DEFAULT_SEGMENT_LIMITS = { wiring: 3, pipe: 2.5 };
|
|
58708
58916
|
var CUT_ROLES = /* @__PURE__ */ new Set(["slab", "wall", "partition"]);
|
|
58709
58917
|
var EPSILON2 = 1e-6;
|
|
@@ -58991,6 +59199,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58991
59199
|
}
|
|
58992
59200
|
function underSink(tr) {
|
|
58993
59201
|
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;
|
|
59202
|
+
const stage2 = cursor.stage;
|
|
59203
|
+
if (shared3.ctx.constructionStages) cursor.stage = "furniture";
|
|
58994
59204
|
cursor.group = pt && pt.floor >= 0 ? "f" + Math.min(pt.floor, nA - 1) : "lot";
|
|
58995
59205
|
cursor.pc = pieceRecord("pipe:" + tr.id, "plastic", null, { tags: ["pipe"] });
|
|
58996
59206
|
for (let i = 0; i + 1 < pts.length; i++) pipe(pts[i], pts[i + 1], d, PIPE_COLOR);
|
|
@@ -58998,39 +59208,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
58998
59208
|
cylBase("metal", p[0], p[1] - d * 0.9, p[2], d * 0.75, d * 1.8, 13158596);
|
|
58999
59209
|
}
|
|
59000
59210
|
cursor.pc = null;
|
|
59211
|
+
cursor.stage = stage2;
|
|
59001
59212
|
}
|
|
59002
59213
|
const defined = { createWater, PIPE_COLOR, pipe, _v3, waterPipes };
|
|
59003
59214
|
Object.assign(K, defined);
|
|
59004
59215
|
}
|
|
59005
59216
|
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
59217
|
var CLAMP_REACH = 0.3;
|
|
59009
59218
|
var CLAMP_DROP = 0.06;
|
|
59010
59219
|
var CLAMP_HEIGHT = 0.03;
|
|
59011
59220
|
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
59221
|
function installUtilitiesDrains(K, shared3) {
|
|
59033
|
-
const { part, pipe, cylBase } = K;
|
|
59222
|
+
const { part, pipe, cylBase, cursor } = K;
|
|
59034
59223
|
const sh = (...a) => K.sh(...a);
|
|
59035
59224
|
function layRun(run) {
|
|
59036
59225
|
const spans = cutRun(run.points, run.limit, solidsOf(shared3.ctx.structureIndex));
|
|
@@ -59071,6 +59260,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59071
59260
|
}
|
|
59072
59261
|
function downpipes() {
|
|
59073
59262
|
const runs = shared3.ctx.gutterInfo?.runs ?? [];
|
|
59263
|
+
const stage2 = cursor.stage;
|
|
59264
|
+
if (shared3.ctx.constructionStages) cursor.stage = "roof";
|
|
59074
59265
|
runs.forEach((run, index) => {
|
|
59075
59266
|
const top = run.points[0];
|
|
59076
59267
|
const points = run.points.map((p) => [p[0], p[1], p[2]]);
|
|
@@ -59078,6 +59269,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59078
59269
|
const limit = Number.isFinite(shared3.ctx.segmentLimits.pipe) ? Math.min(shared3.ctx.segmentLimits.pipe, run.clampEvery) : Infinity;
|
|
59079
59270
|
layRun({ id: `downpipe_${index}`, points, diameter: run.radius * 2, color: run.color, group: `f${run.f}`, limit, ...clampedTo ? { clampedTo } : {}, clampEvery: run.clampEvery });
|
|
59080
59271
|
});
|
|
59272
|
+
cursor.stage = stage2;
|
|
59081
59273
|
}
|
|
59082
59274
|
function drainPipes() {
|
|
59083
59275
|
if (shared3.ctx.visorScene) return;
|
|
@@ -59310,11 +59502,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59310
59502
|
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
59503
|
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
59504
|
}
|
|
59505
|
+
var DIRT_BED_INSET = 0.03;
|
|
59313
59506
|
function createStageMaterials(THREE) {
|
|
59314
59507
|
return {
|
|
59315
59508
|
dirt: new THREE.MeshStandardMaterial({ color: 9073232, roughness: 0.96 }),
|
|
59316
59509
|
footing: new THREE.MeshStandardMaterial({ color: 8025710, roughness: 0.92 }),
|
|
59317
|
-
|
|
59510
|
+
// the ground beams are waterproofed (black bitumen on their top and sides) before the masonry goes up on them
|
|
59511
|
+
baldrame: new THREE.MeshStandardMaterial({ color: 2894375, roughness: 0.7 }),
|
|
59318
59512
|
slab0: new THREE.MeshStandardMaterial({ color: 10920600, roughness: 0.86 }),
|
|
59319
59513
|
// pillars, beams and slabs are cast in one concrete: where they meet, they are one surface
|
|
59320
59514
|
concrete: new THREE.MeshStandardMaterial({ color: 10262672, roughness: 0.82 }),
|
|
@@ -59552,11 +59746,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59552
59746
|
parts2.push(...ob.parts);
|
|
59553
59747
|
openings.push(...ob.openings);
|
|
59554
59748
|
}
|
|
59555
|
-
const footprint = rawStructure.parts.filter((p) => p.
|
|
59749
|
+
const footprint = rawStructure.parts.filter((p) => p.y0 <= 0.1);
|
|
59556
59750
|
if (footprint.length) {
|
|
59557
|
-
addStageBox(THREE, foundation, Math.min(...footprint.map((p) => p.aabb[0]))
|
|
59751
|
+
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
59752
|
}
|
|
59559
|
-
for (const e of outbuildings ?? []) addStageBox(THREE, foundation, e.aabb[0]
|
|
59753
|
+
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
59754
|
const seen = /* @__PURE__ */ new Set();
|
|
59561
59755
|
const foundations = parts2.filter(isFoundation).filter((p) => !seen.has(p.id) && !!seen.add(p.id)).map(foundationSolid);
|
|
59562
59756
|
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 +59973,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59779
59973
|
wireL(span.a, span.b, radius);
|
|
59780
59974
|
});
|
|
59781
59975
|
};
|
|
59782
|
-
const wiringSpans = (P, drop) => {
|
|
59783
|
-
const poleId = (u) => "pole:" + u.toFixed(1),
|
|
59976
|
+
const wiringSpans = (P, drop, ownPole) => {
|
|
59977
|
+
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
59978
|
if (!Number.isFinite(shared3.ctx.segmentLimits.wiring)) {
|
|
59785
59979
|
cursor.pc = pieceRecord("wiring:grid", "copper", null, { tags: ["wiring"] });
|
|
59786
59980
|
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 +60018,44 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
59824
60018
|
for (let i = 0; i < n; i++) wireSpans(at4(i / n), at4((i + 1) / n), 9e-3, "wiring:service:" + i, "ground");
|
|
59825
60019
|
cursor.pc = null;
|
|
59826
60020
|
};
|
|
60021
|
+
const servicePost = (u, v, h) => {
|
|
60022
|
+
const half = NETWORK_POST.half, buried = postEmbedment(h), below = shared3.ctx.visorScene ? 0 : buried, face = v - half;
|
|
60023
|
+
cursor.group = lotGroup;
|
|
60024
|
+
cursor.pc = pieceRecord("pole:" + u.toFixed(1), "concrete", null, { tags: ["pole"], holder: "ground", holdJoint: footingJointOf("concrete"), embedment: { depth: buried, width: half * 2 } });
|
|
60025
|
+
bx("plain", u - half, -below, v - half, u + half, h, v + half, concreteColor);
|
|
60026
|
+
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);
|
|
60027
|
+
cursor.pc = null;
|
|
60028
|
+
};
|
|
60029
|
+
const serviceMast = (mast) => {
|
|
60030
|
+
const path = mastPathOf(mast).map((p) => [p[0], p[2], p[1]]), end3 = path[path.length - 1], galvanised = 11120307;
|
|
60031
|
+
cursor.group = lotGroup;
|
|
60032
|
+
cursor.pc = pieceRecord("mast:" + mast.u.toFixed(1), "steel", null, { tags: ["mast"], holdOn: "wall", holdJoint: "clip" });
|
|
60033
|
+
for (let i = 0; i + 1 < path.length; i++) pipe2(path[i], path[i + 1], MAST_PIPE_RADIUS * 2, galvanised);
|
|
60034
|
+
cylBase("metal", end3[0], end3[1] - WEATHERHEAD.capLength, end3[2], WEATHERHEAD.capRadius, WEATHERHEAD.capLength, galvanised);
|
|
60035
|
+
cursor.pc = null;
|
|
60036
|
+
};
|
|
59827
60037
|
if (en22) {
|
|
59828
60038
|
const P = en22.pole, from = shared3.ctx.serviceFrom, kitDraws = !!(KV && KV.serviceEntrance);
|
|
59829
60039
|
if (P) {
|
|
59830
|
-
if (!kitDraws)
|
|
60040
|
+
if (!kitDraws && en22.street === "network") servicePost(P.u, P.v, P.h);
|
|
60041
|
+
else if (!kitDraws) pole(P.u, P.v, P.h);
|
|
59831
60042
|
info.pole = { pos: [P.u, 0, P.v], h: P.h };
|
|
59832
60043
|
}
|
|
59833
|
-
const landing2 = en22.drop[0];
|
|
59834
|
-
if (from && landing2) {
|
|
59835
|
-
streetDrop(from, [landing2[0], landing2[2], landing2[1]]);
|
|
60044
|
+
const landing2 = en22.drop[0], network = en22.street === "network";
|
|
60045
|
+
if ((from || network) && landing2) {
|
|
60046
|
+
if (from && !network) streetDrop(from, [landing2[0], landing2[2], landing2[1]]);
|
|
59836
60047
|
const end3 = en22.drop[en22.drop.length - 1];
|
|
59837
60048
|
if (P && end3 && en22.drop.length > 1 && !kitDraws) {
|
|
59838
60049
|
wireSpans([landing2[0], landing2[2], landing2[1]], [end3[0], end3[2], end3[1]], 9e-3, "wiring:drop:0", "pole:" + P.u.toFixed(1));
|
|
59839
60050
|
cursor.pc = null;
|
|
59840
60051
|
}
|
|
59841
|
-
} else if (P) {
|
|
60052
|
+
} else if (P && !network) {
|
|
59842
60053
|
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);
|
|
60054
|
+
wiringSpans(P, en22.drop && en22.drop.length > 1 && !kitDraws ? en22.drop : null, !kitDraws);
|
|
59844
60055
|
}
|
|
59845
|
-
if (en22.
|
|
60056
|
+
if (en22.mast) {
|
|
60057
|
+
if (!(KV && KV.serviceMast)) serviceMast(en22.mast);
|
|
60058
|
+
} else if (en22.descent && en22.descent.length > 1 && !(KV && (KV.serviceEntrance || !P))) {
|
|
59846
60059
|
const d0 = en22.descent[0], d1 = en22.descent[en22.descent.length - 1];
|
|
59847
60060
|
cylBase("metal", d0[0], d1[2], d0[1], 0.02, d0[2] - d1[2] - (shared3.ctx.visorScene ? 0 : 0.01), 9080466);
|
|
59848
60061
|
const hw = shared3.ctx.visorScene ? 0.05 : 0.047;
|
|
@@ -60022,6 +60235,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60022
60235
|
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
60236
|
});
|
|
60024
60237
|
cursor.group = "f0";
|
|
60238
|
+
const stage2 = cursor.stage;
|
|
60239
|
+
if (shared3.ctx.constructionStages) cursor.stage = "exterior";
|
|
60025
60240
|
const junction = (A, e, sd) => {
|
|
60026
60241
|
let r = 0;
|
|
60027
60242
|
for (const B of ws) {
|
|
@@ -60073,6 +60288,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60073
60288
|
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
60289
|
}
|
|
60075
60290
|
if (!shared3.ctx.baseboardBand) doorways(ws, W, y0, cal);
|
|
60291
|
+
cursor.stage = stage2;
|
|
60076
60292
|
}
|
|
60077
60293
|
function clearSpan({ a, b, au, across: across2, rise }) {
|
|
60078
60294
|
let from = a, to = b;
|
|
@@ -60101,11 +60317,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60101
60317
|
const slab = au ? [a, y0, lo, b, y0 + SIDEWALK_TOP, hi] : [lo, y0, a, hi, y0 + SIDEWALK_TOP, b];
|
|
60102
60318
|
bx("sidewalk", slab[0], slab[1], slab[2], slab[3], slab[4], slab[5], cal);
|
|
60103
60319
|
if (!shared3.ctx.visorScene) shared3.ctx.paving?.push(slab);
|
|
60320
|
+
const paving = cursor.stage;
|
|
60321
|
+
if (shared3.ctx.constructionStages) cursor.stage = "finishes";
|
|
60104
60322
|
const top = y0 + (shared3.ctx.constructionStages ? FLOOR_OVER_GROUND : 0) + 2e-3, t0 = d.pos - th / 2, t1 = d.pos + th / 2;
|
|
60105
60323
|
const [from, to] = clearSpan({ a: a + DOOR_JAMB_WIDTH, b: b - DOOR_JAMB_WIDTH, au, across: [t0, t1], rise: [y0, top] });
|
|
60106
60324
|
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
60325
|
if (au) bx("plain", from, y0, t0, to, top, t1, THRESHOLD.color);
|
|
60108
60326
|
else bx("plain", t0, y0, from, t1, top, to, THRESHOLD.color);
|
|
60327
|
+
cursor.stage = paving;
|
|
60109
60328
|
}
|
|
60110
60329
|
cursor.pc = null;
|
|
60111
60330
|
}
|
|
@@ -60357,7 +60576,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60357
60576
|
dresser(M, A) {
|
|
60358
60577
|
const { b: lb, c: lc } = kk(M, A), w = M.w, d = M.d, h = M.h, wood = paletteColor(M, "wood", 6965812), ng = h > 0.7 ? 3 : 2, gh = (h - 0.12) / ng;
|
|
60359
60578
|
lb("wood", 0, 0.04, 0, w, h - 0.08, d, wood);
|
|
60360
|
-
lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
60579
|
+
if (M.visorScene) lb("wood", 0, h - 0.04, 0, w + 0.03, 0.04, d + 0.03, sh(wood, 1.15));
|
|
60580
|
+
else lb("wood", 0, h - 0.04, 75e-4, w, 0.04, d + 0.015, sh(wood, 1.15));
|
|
60361
60581
|
for (const sx of [-1, 1]) for (const sz of [-1, 1]) lb("wood", sx * (w / 2 - 0.04), 0, sz * (d / 2 - 0.04), 0.04, 0.04, 0.04, sh(wood, 0.4));
|
|
60362
60582
|
for (let k = 0; k < ng; k++) {
|
|
60363
60583
|
lb("wood", 0, 0.08 + k * gh, d / 2 + 5e-3, w - 0.06, gh - 0.03, 0.012, sh(wood, 1.12));
|
|
@@ -60622,10 +60842,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60622
60842
|
lb("plain", 0, h - 0.18, d / 2 + 5e-3, w - 0.1, 0.1, 0.01, 3816e3);
|
|
60623
60843
|
},
|
|
60624
60844
|
hamper(M, A) {
|
|
60625
|
-
const { c: lc } = kk(M, A);
|
|
60626
|
-
lc("plain", 0, 0, 0,
|
|
60627
|
-
lc("plain", 0, M.h - 0.01, 0,
|
|
60845
|
+
const { c: lc } = kk(M, A), r = M.visorScene ? M.w / 2 : Math.min(M.w, M.d) / 2;
|
|
60846
|
+
lc("plain", 0, 0, 0, r, M.h, paletteColor(M, "fabric_accent", 10127978));
|
|
60847
|
+
lc("plain", 0, M.h - 0.01, 0, r - 0.03, 0.02, 2763306);
|
|
60628
60848
|
},
|
|
60849
|
+
// (outside the Visor's scene the round basket fits its footprint's narrow side: it stood 2.5 cm in the wall behind it)
|
|
60629
60850
|
trash_bin(M, A) {
|
|
60630
60851
|
const { c: lc } = kk(M, A);
|
|
60631
60852
|
lc("plain", 0, 0, 0, M.w / 2, M.h, 6974574);
|
|
@@ -60967,6 +61188,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
60967
61188
|
mine("gas_cylinder", FURNITURE.gas_cylinder);
|
|
60968
61189
|
mine("cooking_gas_cylinder", FURNITURE.cooking_gas_cylinder);
|
|
60969
61190
|
mine("gas_shelter", FURNITURE.gas_shelter);
|
|
61191
|
+
mine("gas_hose", FURNITURE.gas_hose);
|
|
60970
61192
|
mine("outdoor_bin", FURNITURE.outdoor_bin);
|
|
60971
61193
|
mine("outdoor_pot", FURNITURE.outdoor_pot);
|
|
60972
61194
|
mine("planter_bed", FURNITURE.planter_bed);
|
|
@@ -61166,6 +61388,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61166
61388
|
return (r * r + r0 * r0 - d * d) / (2 * r * r0) > BLOB_CROSSING;
|
|
61167
61389
|
});
|
|
61168
61390
|
}
|
|
61391
|
+
var FICUS_SPREAD = 1.32;
|
|
61169
61392
|
function installFurniturePlants(K, shared3) {
|
|
61170
61393
|
const seedKey = (id) => K.seedKey(id);
|
|
61171
61394
|
const { SEED, kit2, rngString, sh } = K;
|
|
@@ -61262,19 +61485,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61262
61485
|
}
|
|
61263
61486
|
function potPlant(M, A, o = {}) {
|
|
61264
61487
|
const K2 = kit2(M, A), rnd2 = rngString(SEED() + "|" + seedKey(M.seed) + "|vaso"), h = M.h || 0.9, r = Math.min(0.26, Math.min(M.w || 0.4, M.d || 0.4) * 0.42), pot2 = M.color != null ? M.color : [11886652, 11034686, 15262420, 4868684, 8030860][rnd2() * 5 | 0];
|
|
61265
|
-
const
|
|
61488
|
+
const reach2 = M.visorScene || M.reach == null ? Number.POSITIVE_INFINITY : M.reach, rp = Math.min(r, reach2 / 1.1);
|
|
61489
|
+
const ph = Math.min(0.34, h * 0.38), top = potModel(K2, 0, 0, 0, rp, ph, pot2), green2 = M.palette && M.palette.plant != null ? M.palette.plant : GREENS2[rnd2() * 5 | 0], type = o.type || ["ficus", "dracena", "samambaia"][rnd2() * 3 | 0];
|
|
61266
61490
|
if (type === "ficus") {
|
|
61267
61491
|
K2.t("wood", [0, top, 0], [0.02, top + (h - ph) * 0.45, 0], 0.014, 6965808);
|
|
61268
|
-
blobs(K2, 0, top + (h - ph) * 0.35, 0, Math.max(0.2, (h - ph) * 0.4), 9, green2, rnd2);
|
|
61492
|
+
blobs(K2, 0, top + (h - ph) * 0.35, 0, Math.min(Math.max(0.2, (h - ph) * 0.4), reach2 / FICUS_SPREAD), 9, green2, rnd2);
|
|
61269
61493
|
} else if (type === "dracena") {
|
|
61270
61494
|
for (let i = 0; i < 3; i++) {
|
|
61271
61495
|
const a = i * 2.1, hh = (h - ph) * (0.5 + 0.2 * i / 2);
|
|
61272
61496
|
const foot = M.visorScene ? 0 : 0.02;
|
|
61273
61497
|
K2.t("wood", [Math.cos(a) * foot, top, Math.sin(a) * foot], [Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04], 0.012, 8022600);
|
|
61274
|
-
for (let k = 0; k < 7; k++) arcLeaf(K2, Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04, k * 0.9 + a, 0.22 + rnd2() * 0.08, 0.35 - k % 3 * 0.1, 0.3, 0.028, sh(green2, 0.85 + rnd2() * 0.3), false, 4);
|
|
61498
|
+
for (let k = 0; k < 7; k++) arcLeaf(K2, Math.cos(a) * 0.04, top + hh, Math.sin(a) * 0.04, k * 0.9 + a, (0.22 + rnd2() * 0.08) * Math.min(1, (reach2 - 0.04) / 0.3), 0.35 - k % 3 * 0.1, 0.3, 0.028, sh(green2, 0.85 + rnd2() * 0.3), false, 4);
|
|
61275
61499
|
}
|
|
61276
61500
|
} else {
|
|
61277
|
-
for (let k = 0; k < 11; k++) arcLeaf(K2, 0, top, 0, k * 0.6 + rnd2() * 0.3, (h - ph) * (0.7 + rnd2() * 0.4), 0.9 - k % 3 * 0.25, 1.2, 0.05, sh(green2, 0.8 + rnd2() * 0.35), true, 6);
|
|
61501
|
+
for (let k = 0; k < 11; k++) arcLeaf(K2, 0, top, 0, k * 0.6 + rnd2() * 0.3, (h - ph) * (0.7 + rnd2() * 0.4) * Math.min(1, reach2 / ((h - ph) * 1.1)), 0.9 - k % 3 * 0.25, 1.2, 0.05, sh(green2, 0.8 + rnd2() * 0.35), true, 6);
|
|
61278
61502
|
}
|
|
61279
61503
|
}
|
|
61280
61504
|
function tablePot(M, A) {
|
|
@@ -61498,13 +61722,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61498
61722
|
const copper = 12088115;
|
|
61499
61723
|
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
61724
|
if (shelter.hose.length > 1) {
|
|
61501
|
-
const valve = local2(shelter.hose[0])
|
|
61725
|
+
const valve = local2(shelter.hose[0]);
|
|
61502
61726
|
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
61727
|
}
|
|
61507
61728
|
}
|
|
61729
|
+
const GAS_HOSE_COLOR = 14267452;
|
|
61730
|
+
FURNITURE.gas_hose = function(M, A) {
|
|
61731
|
+
const shelter = shelterOf(M);
|
|
61732
|
+
if (!shelter || shelter.hose.length < 2) return;
|
|
61733
|
+
const K2 = kit2(M, A);
|
|
61734
|
+
const local2 = (p) => [p[0] - M.x, p[2] - (typeof M.y === "number" ? M.y : 0), p[1] - M.z];
|
|
61735
|
+
const valve = local2(shelter.hose[0]), stove = local2(shelter.hose[shelter.hose.length - 1]);
|
|
61736
|
+
const sag = [(valve[0] + stove[0]) / 2, Math.max(0.1, Math.min(valve[1], stove[1]) - 0.15), (valve[2] + stove[2]) / 2];
|
|
61737
|
+
K2.t("plain", [valve[0], valve[1] - 0.02, valve[2]], sag, 0.011, GAS_HOSE_COLOR);
|
|
61738
|
+
K2.t("plain", sag, stove, 0.011, GAS_HOSE_COLOR);
|
|
61739
|
+
};
|
|
61508
61740
|
FURNITURE.mailbox = function(M, A) {
|
|
61509
61741
|
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
61742
|
if (M.pole !== false && !(M.y != null && M.y > 0)) {
|
|
@@ -61589,6 +61821,57 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61589
61821
|
const defined = { extraTypes };
|
|
61590
61822
|
Object.assign(K, defined);
|
|
61591
61823
|
}
|
|
61824
|
+
var POTTED_PLANT_TYPES = /* @__PURE__ */ new Set(["floor_plant", "floor_plant_tall", "floor_plant_low", "plant_tall", "plant_short", "outdoor_pot", "table_plant"]);
|
|
61825
|
+
var PLANT_CLEAR = 0.04;
|
|
61826
|
+
var PLANT_MIN_REACH = 0.14;
|
|
61827
|
+
var PLANT_SPAN = [0.03, 2.4];
|
|
61828
|
+
function footprintOf(m) {
|
|
61829
|
+
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, hz2 = ((m.w || 0) * s + (m.d || 0) * c) / 2;
|
|
61830
|
+
return [m.x - hx, m.z - hz2, m.x + hx, m.z + hz2];
|
|
61831
|
+
}
|
|
61832
|
+
var reachTo = (x, z, x0, z0, x1, z1) => Math.hypot(Math.max(x0 - x, 0, x - x1), Math.max(z0 - z, 0, z - z1));
|
|
61833
|
+
function freeReachOf(p) {
|
|
61834
|
+
const y0 = p.y + PLANT_SPAN[0], y1 = p.y + PLANT_SPAN[1];
|
|
61835
|
+
let reach2 = Number.POSITIVE_INFINITY;
|
|
61836
|
+
for (const b of p.boxes) if (b[1] < y1 && b[4] > y0) reach2 = Math.min(reach2, reachTo(p.x, p.z, b[0], b[2], b[3], b[5]));
|
|
61837
|
+
for (const m of p.items) {
|
|
61838
|
+
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;
|
|
61839
|
+
const bottom = p.base + (m.y || 0), top = bottom + (m.h || 0);
|
|
61840
|
+
if (bottom >= y1 || top <= y0) continue;
|
|
61841
|
+
const r = footprintOf(m);
|
|
61842
|
+
reach2 = Math.min(reach2, reachTo(p.x, p.z, r[0], r[1], r[2], r[3]));
|
|
61843
|
+
}
|
|
61844
|
+
return reach2 - PLANT_CLEAR;
|
|
61845
|
+
}
|
|
61846
|
+
function vertexMark(accs) {
|
|
61847
|
+
const mark = /* @__PURE__ */ new Map();
|
|
61848
|
+
for (const a of accs.values()) mark.set(a, a.nv);
|
|
61849
|
+
return mark;
|
|
61850
|
+
}
|
|
61851
|
+
function partToHouse(parts2, group, p) {
|
|
61852
|
+
let at4 = p, name = group;
|
|
61853
|
+
for (let part = parts2.get(name); part; part = parts2.get(name)) {
|
|
61854
|
+
const c = Math.cos(part.ry), s = Math.sin(part.ry);
|
|
61855
|
+
at4 = [at4[0] * c + at4[2] * s + (part.pos[0] ?? 0), at4[1] + (part.pos[1] ?? 0), -at4[0] * s + at4[2] * c + (part.pos[2] ?? 0)];
|
|
61856
|
+
name = part.parent;
|
|
61857
|
+
}
|
|
61858
|
+
return at4;
|
|
61859
|
+
}
|
|
61860
|
+
function boundsSince(accs, mark, parts2) {
|
|
61861
|
+
const byName = new Map(parts2.map((p) => [p.name, p]));
|
|
61862
|
+
const box5 = [Infinity, Infinity, Infinity, -Infinity, -Infinity, -Infinity];
|
|
61863
|
+
for (const a of accs.values()) {
|
|
61864
|
+
for (let v = mark.get(a) ?? 0; v < a.nv; v++) {
|
|
61865
|
+
const local2 = [a.p[v * 3], a.p[v * 3 + 1], a.p[v * 3 + 2]];
|
|
61866
|
+
const p = a.group.startsWith("part:") ? partToHouse(byName, a.group, local2) : local2;
|
|
61867
|
+
for (let k = 0; k < 3; k++) {
|
|
61868
|
+
box5[k] = Math.min(box5[k], p[k]);
|
|
61869
|
+
box5[k + 3] = Math.max(box5[k + 3], p[k]);
|
|
61870
|
+
}
|
|
61871
|
+
}
|
|
61872
|
+
}
|
|
61873
|
+
return box5[0] <= box5[3] ? box5 : null;
|
|
61874
|
+
}
|
|
61592
61875
|
var COVER_STEP = 3e-3;
|
|
61593
61876
|
var PANEL_CLEAR = 0.05;
|
|
61594
61877
|
function installFurniturePlaceItems(K, shared3) {
|
|
@@ -61635,6 +61918,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61635
61918
|
M.base += COVER_STEP * under;
|
|
61636
61919
|
covers.push(own);
|
|
61637
61920
|
}
|
|
61921
|
+
if (!shared3.ctx.visorScene && POTTED_PLANT_TYPES.has(m.type)) {
|
|
61922
|
+
const reach2 = freeReachOf({ x: M.x, z: M.z, y: M.base + (M.y ?? 0), boxes: (exterior ? shared3.ctx.occupied : keepOut).concat((drawn.get(cursor.group) ?? []).flat()), items: list2, self: m, base: M.base });
|
|
61923
|
+
if (reach2 < PLANT_MIN_REACH) continue;
|
|
61924
|
+
M.reach = reach2;
|
|
61925
|
+
}
|
|
61638
61926
|
if (shared3.ctx.veg && vegItem(m, M, exterior ? "lot" : "f" + f)) continue;
|
|
61639
61927
|
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_shelter) {
|
|
61640
61928
|
const st = cursor.stage;
|
|
@@ -61645,6 +61933,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61645
61933
|
cursor.stage = st;
|
|
61646
61934
|
}
|
|
61647
61935
|
}
|
|
61936
|
+
if (m.type === "cooking_gas_cylinder" && m.shelter && T2.gas_hose) {
|
|
61937
|
+
const st = cursor.stage;
|
|
61938
|
+
if (shared3.ctx.constructionStages) cursor.stage = "furniture";
|
|
61939
|
+
try {
|
|
61940
|
+
buildItem2(m, M, T2.gas_hose, api, cursor.group);
|
|
61941
|
+
} finally {
|
|
61942
|
+
cursor.stage = st;
|
|
61943
|
+
}
|
|
61944
|
+
}
|
|
61648
61945
|
if (shared3.ctx.iv && shared3.ctx.iv.replace.has(m.id)) {
|
|
61649
61946
|
registerCollision(m, M);
|
|
61650
61947
|
continue;
|
|
@@ -61677,8 +61974,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61677
61974
|
}
|
|
61678
61975
|
const mine = shared3.ctx.itemBoxes;
|
|
61679
61976
|
if (mine) drawn.set(cursor.group, (drawn.get(cursor.group) ?? []).concat([mine]));
|
|
61977
|
+
const mark = shared3.ctx.itemBounds ? vertexMark(cursor.accs) : null;
|
|
61680
61978
|
try {
|
|
61681
61979
|
buildItem2(m, M, ent, api, cursor.group);
|
|
61980
|
+
if (mark) recordBounds(m, mark);
|
|
61682
61981
|
} catch (e) {
|
|
61683
61982
|
cursor.group = exterior ? "lot" : "f" + f;
|
|
61684
61983
|
console.warn("builder", m.type, e);
|
|
@@ -61707,6 +62006,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61707
62006
|
}
|
|
61708
62007
|
return noModel;
|
|
61709
62008
|
}
|
|
62009
|
+
function recordBounds(m, mark) {
|
|
62010
|
+
const box5 = boundsSince(cursor.accs, mark, K.PARTS);
|
|
62011
|
+
if (box5) shared3.ctx.itemBounds?.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "furniture", box: box5 });
|
|
62012
|
+
}
|
|
61710
62013
|
const ROOF_CLEAR = 0.06;
|
|
61711
62014
|
function overRoof(m, M, f) {
|
|
61712
62015
|
const R = shared3.ctx.r, inside22 = (rooms) => rooms.find((c) => rectsOf2(c).some((r) => r[0] < m.x && m.x < r[2] && r[1] < m.z && m.z < r[3]));
|
|
@@ -61822,6 +62125,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61822
62125
|
const defined = { houseItems, waterTankOfHouse, hashColor, labeledBox };
|
|
61823
62126
|
Object.assign(K, defined);
|
|
61824
62127
|
}
|
|
62128
|
+
var PLANT_RADIUS_MARGIN = 1.08;
|
|
62129
|
+
var PLANT_MIN_SCALE = 0.4;
|
|
61825
62130
|
function installVegetationBridge(K, shared3) {
|
|
61826
62131
|
const seedKey = (id) => K.seedKey(id);
|
|
61827
62132
|
const { THREE, SEED, rngString } = K;
|
|
@@ -61836,7 +62141,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61836
62141
|
floor_plant_tall: VEG_POT,
|
|
61837
62142
|
floor_plant: VEG_POT,
|
|
61838
62143
|
outdoor_pot: VEG_POT,
|
|
61839
|
-
toilet: VEG_POT,
|
|
61840
62144
|
floor_plant_low: ["potted_succulents", "potted_cactus"],
|
|
61841
62145
|
table_plant: ["potted_succulents", "potted_cactus"],
|
|
61842
62146
|
clump: ["lawn_tuft"],
|
|
@@ -61885,9 +62189,41 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61885
62189
|
}
|
|
61886
62190
|
return true;
|
|
61887
62191
|
}
|
|
61888
|
-
|
|
62192
|
+
if (M.reach != null) {
|
|
62193
|
+
const fit = fitted(V3, lst, pick3(lst), sd, M.reach);
|
|
62194
|
+
if (!fit) return true;
|
|
62195
|
+
G.pl.push({ species: fit.species, x: M.x, z: M.z, ry: M.ry || 0, scale: fit.scale, seed: sd });
|
|
62196
|
+
const r = fit.radius * fit.scale;
|
|
62197
|
+
shared3.ctx.itemBounds?.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "vegetation", box: [M.x - r, y, M.z - r, M.x + r, y + fit.height * fit.scale, M.z + r] });
|
|
62198
|
+
return true;
|
|
62199
|
+
}
|
|
62200
|
+
const species = pick3(lst);
|
|
62201
|
+
G.pl.push({ species, x: M.x, z: M.z, ry: M.ry || 0, scale: 1, seed: sd });
|
|
62202
|
+
if (shared3.ctx.itemBounds) {
|
|
62203
|
+
const size = speciesSize(V3, species, sd);
|
|
62204
|
+
shared3.ctx.itemBounds.push({ id: m.id, type: m.type, category: m.category ?? null, room: m.room ?? null, floor: m.floor, by: "vegetation", box: [M.x - size.radius, y, M.z - size.radius, M.x + size.radius, y + size.height, M.z + size.radius] });
|
|
62205
|
+
}
|
|
61889
62206
|
return true;
|
|
61890
62207
|
}
|
|
62208
|
+
function speciesSize(V3, id, seed) {
|
|
62209
|
+
const key2 = id + "|" + seed;
|
|
62210
|
+
let r = V3.sizes.get(key2);
|
|
62211
|
+
if (!r) {
|
|
62212
|
+
r = V3.G.generate ? V3.G.generate(V3.S.toSpec(id), { seed }).bounds : { radius: 0, height: 0 };
|
|
62213
|
+
V3.sizes.set(key2, r);
|
|
62214
|
+
}
|
|
62215
|
+
return r;
|
|
62216
|
+
}
|
|
62217
|
+
function fitted(V3, species, first, seed, reach2) {
|
|
62218
|
+
const sizeOf2 = (id) => speciesSize(V3, id, seed);
|
|
62219
|
+
let best = null;
|
|
62220
|
+
for (const id of [first, ...species.filter((s) => s !== first)]) {
|
|
62221
|
+
const size = sizeOf2(id), r = size.radius * PLANT_RADIUS_MARGIN, scale = r > reach2 ? reach2 / r : 1;
|
|
62222
|
+
if (scale === 1) return { species: id, scale, ...size };
|
|
62223
|
+
if (!best || scale > best.scale) best = { species: id, scale, ...size };
|
|
62224
|
+
}
|
|
62225
|
+
return best && best.scale >= PLANT_MIN_SCALE ? best : null;
|
|
62226
|
+
}
|
|
61891
62227
|
function assembleVegetation(groups) {
|
|
61892
62228
|
const V3 = shared3.ctx.veg;
|
|
61893
62229
|
if (!V3) return;
|
|
@@ -61924,7 +62260,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61924
62260
|
shared3.partState = /* @__PURE__ */ new Map();
|
|
61925
62261
|
const newInteractiveState = () => ({ defs: /* @__PURE__ */ new Map(), items: [], pieces: [], lights: /* @__PURE__ */ new Map(), litRooms: /* @__PURE__ */ new Set(), objs: [], anim: /* @__PURE__ */ new Set(), msg: null, target: null });
|
|
61926
62262
|
shared3.inter = newInteractiveState();
|
|
61927
|
-
const MESSAGE_MS = 2200;
|
|
62263
|
+
const MESSAGE_MS = 2200, LAMP_OFF_COLOR = 15658214, LAMP_DIFFUSER_MATERIAL = "glass";
|
|
61928
62264
|
UV_SCALE.doorWood = 1;
|
|
61929
62265
|
UV_SCALE.doorPaint = 1;
|
|
61930
62266
|
function createInteractiveMaterials(mats) {
|
|
@@ -61975,6 +62311,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
61975
62311
|
mats.doorWood = new THREE.MeshLambertMaterial({ vertexColors: true, map: wood });
|
|
61976
62312
|
mats.doorPaint = new THREE.MeshLambertMaterial({ vertexColors: true, map: paint2 });
|
|
61977
62313
|
mats.off = new THREE.MeshBasicMaterial({ vertexColors: true, color: 9078656 });
|
|
62314
|
+
mats.lampOff = new THREE.MeshPhongMaterial({ color: LAMP_OFF_COLOR, shininess: 70, specular: 6710886, transparent: true, opacity: 0.9 });
|
|
61978
62315
|
}
|
|
61979
62316
|
const _EY = new THREE.Vector3(0, 1, 0), _UM3 = new THREE.Vector3(1, 1, 1);
|
|
61980
62317
|
const hudMessage = (text) => {
|
|
@@ -62015,6 +62352,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62015
62352
|
o.geometry.applyMatrix4(inv);
|
|
62016
62353
|
o.userData.piece = def;
|
|
62017
62354
|
def.meshes.push(o);
|
|
62355
|
+
if (def.roomId && o.name.endsWith("/emissive")) o.userData.destructionMaterial = LAMP_DIFFUSER_MATERIAL;
|
|
62018
62356
|
}
|
|
62019
62357
|
});
|
|
62020
62358
|
outer.add(g);
|
|
@@ -62101,7 +62439,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62101
62439
|
};
|
|
62102
62440
|
function applyLight(roomId) {
|
|
62103
62441
|
const on = lightOn(roomId), inter = I(), mats = shared3.mats;
|
|
62104
|
-
for (const d of inter.lights.get(roomId) || []) for (const m of d.meshes) if (m.name.endsWith("/emissive")) m.material = on ? mats.emissive : mats.off;
|
|
62442
|
+
for (const d of inter.lights.get(roomId) || []) for (const m of d.meshes) if (m.name.endsWith("/emissive")) m.material = on ? mats.emissive : shared3.ctx.visorScene ? mats.off : mats.lampOff;
|
|
62105
62443
|
const sw = inter.defs.get("ix:int:" + roomId);
|
|
62106
62444
|
if (sw) {
|
|
62107
62445
|
sw.target = on ? 1 : 0;
|
|
@@ -62606,7 +62944,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62606
62944
|
Object.assign(K, defined);
|
|
62607
62945
|
}
|
|
62608
62946
|
function installInteractablesBridge(K, shared3) {
|
|
62609
|
-
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord,
|
|
62947
|
+
const { t, THREE, invalidate, invalidateShadow, cfg, DOC, LIGHT_TYPES, _Y, _q, _v3, accFor, applyLight, cursor, hashString, hudMessage, lightBase, pieceRecord, rgbOf, wallBlocks } = K;
|
|
62610
62948
|
const enter = (...a) => K.enter(...a);
|
|
62611
62949
|
const roomLightMask = (...a) => K.roomLightMask(...a);
|
|
62612
62950
|
const IV_MATERIAL = { plain: "plain", metal: "metal", wood: "wood", glass: "glass", fabric: "fabric", plant: "plant", water: "water", emissive: "emissive", atlas_picture: "picture", atlas_floor: "floor" };
|
|
@@ -62660,7 +62998,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62660
62998
|
void world0;
|
|
62661
62999
|
const source = r;
|
|
62662
63000
|
const plane2 = A.plan(source, { seed: r.seed });
|
|
62663
|
-
const IV = { k: ik, plane: plane2, world: null, water, entries: /* @__PURE__ */ new Map(), roots: [], replace: /* @__PURE__ */ new Set(), roomStates: /* @__PURE__ */ new Map(), lampRoom: /* @__PURE__ */ new Map(), anim: /* @__PURE__ */ new Map(), screens: /* @__PURE__ */ new Map(), efx: null,
|
|
63001
|
+
const IV = { k: ik, plane: plane2, world: null, water, entries: /* @__PURE__ */ new Map(), roots: [], replace: /* @__PURE__ */ new Set(), roomStates: /* @__PURE__ */ new Map(), lampRoom: /* @__PURE__ */ new Map(), anim: /* @__PURE__ */ new Map(), screens: /* @__PURE__ */ new Map(), efx: null, contents: /* @__PURE__ */ new Map(), itemsDirty: true, itemsT: 0, dirty: true, list: null, listT: 0, t: 0, circuits: [], switchRooms: /* @__PURE__ */ new Set(), warnings: [], tBuild: 0 };
|
|
62664
63002
|
h.IV = IV;
|
|
62665
63003
|
const t0 = performance.now();
|
|
62666
63004
|
const lamps = new Set(plane2.items.filter((e) => e.type === "lamp").map((e) => e.id));
|
|
@@ -62830,20 +63168,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62830
63168
|
if (!d.plug) continue;
|
|
62831
63169
|
const wire = (spec.wires || []).find((x) => x.id === d.id + "_cord"), pts = (wire ? wire.points : [d.plug]).map((p) => wl(o, p));
|
|
62832
63170
|
const sid = w.power.pluggedInto(E.id, d.id);
|
|
62833
|
-
|
|
62834
|
-
|
|
62835
|
-
|
|
62836
|
-
|
|
62837
|
-
|
|
62838
|
-
|
|
62839
|
-
|
|
62840
|
-
|
|
62841
|
-
|
|
62842
|
-
|
|
62843
|
-
for (const p of hang) pts.push(p);
|
|
62844
|
-
}
|
|
62845
|
-
}
|
|
63171
|
+
const cut = sid ? sid.indexOf(":") : -1, so = sid ? w.get(sid.slice(0, cut)) : void 0, sk = sid && so ? (so.spec.sockets || []).find((s) => s.id === sid.slice(cut + 1)) : void 0;
|
|
63172
|
+
if (!so || !sk) continue;
|
|
63173
|
+
const sp = wl(so, sk.pos), dir = [Math.sin(so.transform.ry), Math.cos(so.transform.ry)], last = pts[pts.length - 1];
|
|
63174
|
+
if (last[1] < 0.3 + E.pos[1]) {
|
|
63175
|
+
const foot = [sp[0] + dir[0] * 0.035, E.pos[1] + 0.012, sp[2] + dir[1] * 0.035];
|
|
63176
|
+
pts.push([last[0] + (foot[0] - last[0]) * 0.4, E.pos[1] + 0.012, last[2] + (foot[2] - last[2]) * 0.4], [last[0] + (foot[0] - last[0]) * 0.75, E.pos[1] + 0.012, 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]);
|
|
63177
|
+
} else {
|
|
63178
|
+
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);
|
|
63179
|
+
hang.shift();
|
|
63180
|
+
for (const p of hang) pts.push(p);
|
|
62846
63181
|
}
|
|
63182
|
+
shared3.ctx.cordPaths?.push({ object: E.id, device: d.id, points: pts.map((p) => [p[0], p[1], p[2]]) });
|
|
62847
63183
|
tube2(pts, 6e-3, IV_WIRE.cord, 0, 0, 0, 0);
|
|
62848
63184
|
}
|
|
62849
63185
|
}
|
|
@@ -62879,12 +63215,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62879
63215
|
}
|
|
62880
63216
|
IV.dirty = true;
|
|
62881
63217
|
switch (e.type) {
|
|
62882
|
-
case "part":
|
|
63218
|
+
case "part": {
|
|
62883
63219
|
if (e.part === "_x") break;
|
|
62884
63220
|
IV.anim.set(e.object + "|" + e.part, { object: e.object, part: e.part, target: e.target, t0: IV.t });
|
|
62885
63221
|
IV.itemsDirty = true;
|
|
63222
|
+
const E = e.target > 0 ? IV.entries.get(e.object) : void 0;
|
|
63223
|
+
if (E) ivContents(IV, E)?.sync();
|
|
62886
63224
|
invalidate();
|
|
62887
63225
|
break;
|
|
63226
|
+
}
|
|
63227
|
+
// the contents are drawn before the part moves, so they ride it from its first frame
|
|
62888
63228
|
case "device": {
|
|
62889
63229
|
const roomId = IV.lampRoom.get(e.object);
|
|
62890
63230
|
if (roomId) shared3.partState.set("light:" + roomId, !!e.on);
|
|
@@ -62895,6 +63235,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62895
63235
|
hudMessage(e.text);
|
|
62896
63236
|
break;
|
|
62897
63237
|
case "pickup":
|
|
63238
|
+
IV.contents.get(e.object)?.sync();
|
|
62898
63239
|
IV.itemsDirty = true;
|
|
62899
63240
|
if (e.actor === "player" && e.stack) {
|
|
62900
63241
|
const d = IV.world.t("item." + e.stack.type);
|
|
@@ -62939,6 +63280,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62939
63280
|
for (const [k, a] of IV.anim) {
|
|
62940
63281
|
const E = IV.entries.get(a.object);
|
|
62941
63282
|
if (E && E.parts) ik.gfx.syncObject(w, a.object, E.parts, { time: IV.t });
|
|
63283
|
+
IV.contents.get(a.object)?.sync();
|
|
62942
63284
|
if (w.partT(a.object, a.part) === a.target || IV.t - a.t0 > 4) IV.anim.delete(k);
|
|
62943
63285
|
}
|
|
62944
63286
|
invalidateShadow();
|
|
@@ -62978,28 +63320,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
62978
63320
|
invalidate();
|
|
62979
63321
|
}
|
|
62980
63322
|
}
|
|
62981
|
-
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1
|
|
62982
|
-
}
|
|
62983
|
-
|
|
62984
|
-
|
|
62985
|
-
|
|
62986
|
-
|
|
62987
|
-
|
|
62988
|
-
|
|
62989
|
-
|
|
62990
|
-
|
|
62991
|
-
|
|
62992
|
-
|
|
62993
|
-
|
|
62994
|
-
cloth: [["box", 1, 1, 1, 0, 1]],
|
|
62995
|
-
paper: [["box", 1, 1, 1, 0, 1]],
|
|
62996
|
-
tool: [["box", 1, 1, 1, 0, 1]],
|
|
62997
|
-
shoe: [["box", 1, 0.7, 1, 0, 1]]
|
|
62998
|
-
};
|
|
63323
|
+
if (ivk.items && IV.itemsDirty && IV.t - IV.itemsT > 0.1) ivItems(IV, h);
|
|
63324
|
+
}
|
|
63325
|
+
function ivContents(IV, E) {
|
|
63326
|
+
const had = IV.contents.get(E.id);
|
|
63327
|
+
if (had) return had;
|
|
63328
|
+
const ik = IV.k, make3 = ik.GT.createContentsView;
|
|
63329
|
+
if (!ik.items || !ik.itemModel || !make3 || !(E.spec.containers || []).length) return null;
|
|
63330
|
+
const view = make3(THREE, { world: IV.world, objectId: E.id, root: E.root, buildItem: ik.itemModel });
|
|
63331
|
+
IV.contents.set(E.id, view);
|
|
63332
|
+
view.sync();
|
|
63333
|
+
invalidateShadow();
|
|
63334
|
+
return view;
|
|
63335
|
+
}
|
|
62999
63336
|
function ivItems(IV, h) {
|
|
63000
63337
|
IV.itemsDirty = false;
|
|
63001
63338
|
IV.itemsT = IV.t;
|
|
63002
|
-
const w = IV.world,
|
|
63339
|
+
const w = IV.world, f = IV.focus;
|
|
63003
63340
|
let fl = null;
|
|
63004
63341
|
if (f) {
|
|
63005
63342
|
h.houseGroup.updateWorldMatrix(true, false);
|
|
@@ -63007,56 +63344,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63007
63344
|
h.houseGroup.worldToLocal(fl);
|
|
63008
63345
|
}
|
|
63009
63346
|
for (const E of IV.entries.values()) {
|
|
63347
|
+
const view = IV.contents.get(E.id);
|
|
63348
|
+
if (view) {
|
|
63349
|
+
view.sync();
|
|
63350
|
+
continue;
|
|
63351
|
+
}
|
|
63010
63352
|
if (fl && E.floor >= 0 && Math.hypot(E.pos[0] - fl.x, E.pos[2] - fl.z) > 14) continue;
|
|
63011
63353
|
for (const c of E.spec.containers || []) {
|
|
63012
|
-
if (
|
|
63013
|
-
if (
|
|
63014
|
-
|
|
63015
|
-
|
|
63016
|
-
const stack = st[i];
|
|
63017
|
-
if (stack && items[stack.type]) list2.push([E, c.id, i, items[stack.type]]);
|
|
63018
|
-
}
|
|
63019
|
-
}
|
|
63020
|
-
}
|
|
63021
|
-
if (!list2.length) {
|
|
63022
|
-
if (IV.items) IV.items.visible = false;
|
|
63023
|
-
return;
|
|
63024
|
-
}
|
|
63025
|
-
cursor.group = "iv-items";
|
|
63026
|
-
try {
|
|
63027
|
-
for (const [E, cid, slot, def] of list2) {
|
|
63028
|
-
const p = w.slotPosition(E.id, cid, slot), form = IV_SHAPE[def.shape] || IV_SHAPE.box;
|
|
63029
|
-
for (const [geo, fx, fy, fz, y0, tone] of form) {
|
|
63030
|
-
const sx = def.size[0] * fx, sy = def.size[1] * fy, sz = def.size[2] * fz;
|
|
63031
|
-
_q.setFromAxisAngle(_Y, E.ry);
|
|
63032
|
-
const color2 = def.color == null ? 13421772 : def.color;
|
|
63033
|
-
put("plain", geo, p[0], p[1] + def.size[1] * y0 + sy / 2, p[2], _q, sx, sy, sz, tone === 1 ? color2 : sh(color2, tone));
|
|
63354
|
+
if (c.access && w.partT(E.id, c.access) <= 0) continue;
|
|
63355
|
+
if (w.contents(E.id, c.id).some((st) => st !== null)) {
|
|
63356
|
+
ivContents(IV, E);
|
|
63357
|
+
break;
|
|
63034
63358
|
}
|
|
63035
63359
|
}
|
|
63036
|
-
const A = cursor.accs.get("iv-items|plain");
|
|
63037
|
-
cursor.accs.delete("iv-items|plain");
|
|
63038
|
-
const gm = new THREE.BufferGeometry();
|
|
63039
|
-
gm.setAttribute("position", new THREE.BufferAttribute(A.p.slice(0, A.nv * 3), 3));
|
|
63040
|
-
gm.setAttribute("normal", new THREE.BufferAttribute(A.n.slice(0, A.nv * 3), 3));
|
|
63041
|
-
gm.setAttribute("color", new THREE.BufferAttribute(A.c.slice(0, A.nv * 3), 3));
|
|
63042
|
-
gm.setAttribute("uv", new THREE.BufferAttribute(A.u.slice(0, A.nv * 2), 2));
|
|
63043
|
-
gm.setIndex(new THREE.BufferAttribute(A.i.slice(0, A.ni), 1));
|
|
63044
|
-
gm.computeBoundingSphere();
|
|
63045
|
-
if (!IV.items) {
|
|
63046
|
-
const mesh3 = new THREE.Mesh(gm, shared3.mats.plain);
|
|
63047
|
-
IV.items = mesh3;
|
|
63048
|
-
mesh3.name = "iv-items";
|
|
63049
|
-
mesh3.castShadow = false;
|
|
63050
|
-
mesh3.receiveShadow = true;
|
|
63051
|
-
mesh3.frustumCulled = false;
|
|
63052
|
-
h.houseGroup.add(mesh3);
|
|
63053
|
-
} else {
|
|
63054
|
-
IV.items.geometry.dispose();
|
|
63055
|
-
IV.items.geometry = gm;
|
|
63056
|
-
}
|
|
63057
|
-
IV.items.visible = true;
|
|
63058
|
-
} finally {
|
|
63059
|
-
cursor.group = g0;
|
|
63060
63360
|
}
|
|
63061
63361
|
invalidateShadow();
|
|
63062
63362
|
}
|
|
@@ -63116,7 +63416,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63116
63416
|
}
|
|
63117
63417
|
}
|
|
63118
63418
|
for (const sc of IV.screens.values()) sc.dispose();
|
|
63119
|
-
|
|
63419
|
+
for (const view of IV.contents.values()) view.dispose();
|
|
63420
|
+
IV.contents.clear();
|
|
63120
63421
|
}
|
|
63121
63422
|
function ivPublish(h) {
|
|
63122
63423
|
const IV = h.IV, w = IV.world, ik = IV.k, com = (fn) => (...a) => {
|
|
@@ -63183,7 +63484,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63183
63484
|
};
|
|
63184
63485
|
return IV.pub;
|
|
63185
63486
|
}
|
|
63186
|
-
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate,
|
|
63487
|
+
const defined = { IV_MATERIAL, IV_WIRE, IV_DOOR, ivGroup, ivAccumulate, ivBuild, ivRoomEffective, ivDraw, ivCords, ivAssemble, ivScreen, ivEvent, ivSeat, ivUpdate, ivItems, ivContents, ivTarget, ivRoomLight, ivParts, ivDispose, ivPublish };
|
|
63187
63488
|
Object.assign(K, defined);
|
|
63188
63489
|
}
|
|
63189
63490
|
function installAnimationClotheslines(K, shared3) {
|
|
@@ -63246,7 +63547,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63246
63547
|
return null;
|
|
63247
63548
|
}
|
|
63248
63549
|
const A = AD.plan ? AD : AD.create({ ...o.adapterOptions || {}, GameInteractables: GI, GameInteractablesHousehold: HH, locale: o.locale || cfg.locale, region: o.region, ...cfg.seedKey ? { seedKey: cfg.seedKey } : {} });
|
|
63249
|
-
return { GI, HH, GT, A, gfx: GT.createThreeAdapter(THREE, { document: DOC, Reflector }), items: o.items !== false, effects: o.effects !== false, effectSink: o.effectSink || null, camera: o.camera || null, onEvent: o.onEvent || null, onSeat: o.onSeat || null };
|
|
63550
|
+
return { GI, HH, GT, A, gfx: GT.createThreeAdapter(THREE, { document: DOC, Reflector }), items: o.items !== false, itemModel: o.itemModel || null, effects: o.effects !== false, effectSink: o.effectSink || null, camera: o.camera || null, onEvent: o.onEvent || null, onSeat: o.onSeat || null };
|
|
63250
63551
|
})();
|
|
63251
63552
|
const VEG = (() => {
|
|
63252
63553
|
const l = cfg.vegetation || null, G = l && (l.GameVegetation || (l.buildLot ? l : null)), S = l && (l.GameVegetationSpecies || (l.toSpec ? l : null));
|
|
@@ -63804,14 +64105,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63804
64105
|
}
|
|
63805
64106
|
return best;
|
|
63806
64107
|
};
|
|
63807
|
-
const
|
|
64108
|
+
const gapOf2 = (p, q) => Math.hypot(Math.max(0, q.aabb[0] - p.aabb[2], p.aabb[0] - q.aabb[2]), Math.max(0, q.y0 - p.y1, p.y0 - q.y1), Math.max(0, q.aabb[1] - p.aabb[3], p.aabb[1] - q.aabb[3]));
|
|
63808
64109
|
const centreGapOf = (p, q) => Math.hypot((p.aabb[0] + p.aabb[2] - q.aabb[0] - q.aabb[2]) / 2, (p.y0 + p.y1 - q.y0 - q.y1) / 2, (p.aabb[1] + p.aabb[3] - q.aabb[1] - q.aabb[3]) / 2);
|
|
63809
64110
|
const wallBeside = (p, reach2) => {
|
|
63810
64111
|
for (const roles of [WALL_ROLES, SPAN_ROLES]) {
|
|
63811
64112
|
let best = null, bd = Infinity, bc = Infinity;
|
|
63812
64113
|
for (const q of parts2) {
|
|
63813
64114
|
if (q === p || !(q.extra ? roles === WALL_ROLES && Array.isArray(q.tags) && q.tags.includes("wall") : roles.has(q.role))) continue;
|
|
63814
|
-
const d =
|
|
64115
|
+
const d = gapOf2(p, q);
|
|
63815
64116
|
if (d > reach2) continue;
|
|
63816
64117
|
const c = centreGapOf(p, q);
|
|
63817
64118
|
if (d < bd || d === bd && (c < bc || c === bc && best !== null && q.id < best.id)) {
|
|
@@ -63845,6 +64146,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
63845
64146
|
supports.push({ part: p.id, on: p.holder, joint: p.holdJoint ?? "clip", bears: false, extra: true, ...p.tears ? { tears: true } : {} });
|
|
63846
64147
|
continue;
|
|
63847
64148
|
}
|
|
64149
|
+
if (typeof p.holder === "string") {
|
|
64150
|
+
unheld.push(p.id);
|
|
64151
|
+
continue;
|
|
64152
|
+
}
|
|
63848
64153
|
if (p.holdOn) {
|
|
63849
64154
|
const on = p.holdOn === "floor" ? floorUnder(p) : wallBeside(p, p.holdReach ?? HOLD_REACH);
|
|
63850
64155
|
if (on) supports.push({ part: p.id, on: on.id, joint: p.holdJoint ?? "clip", bears: false, extra: true });
|
|
@@ -64299,9 +64604,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
64299
64604
|
if (q.id === part.id || q.role !== "wall" && q.role !== "partition" || !structure.meshesOf(q.id).some((it) => it.mesh)) continue;
|
|
64300
64605
|
if (Math.min(q.y1, part.y1) - Math.max(q.y0, part.y0) <= 0.5) continue;
|
|
64301
64606
|
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
|
|
64607
|
+
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
64608
|
if (inside22) first.push(q.id);
|
|
64304
|
-
else if (
|
|
64609
|
+
else if (reaches2) other.push(q.id);
|
|
64305
64610
|
}
|
|
64306
64611
|
return [...first, ...other];
|
|
64307
64612
|
}
|
|
@@ -65612,20 +65917,24 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65612
65917
|
if (!Number.isFinite(level)) return CONSTRUCTION_LEVEL_MAX;
|
|
65613
65918
|
return Math.max(0, Math.min(CONSTRUCTION_LEVEL_MAX, Math.round(level)));
|
|
65614
65919
|
}
|
|
65920
|
+
var STAGE_LEVEL = { foundation: 1, frame: 2, masonry: 3, installations: 4, roofFraming: 5, roof: 6, finishes: 7, openings: 8, last: 8 };
|
|
65615
65921
|
function stageVisible(stage2, level, opts) {
|
|
65616
65922
|
switch (stage2) {
|
|
65617
65923
|
case "installations":
|
|
65618
|
-
return level >=
|
|
65924
|
+
return level >= STAGE_LEVEL.installations;
|
|
65619
65925
|
case "finishes":
|
|
65620
|
-
return level >=
|
|
65926
|
+
return level >= STAGE_LEVEL.finishes;
|
|
65621
65927
|
case "openings":
|
|
65622
|
-
return level >=
|
|
65928
|
+
return level >= STAGE_LEVEL.openings;
|
|
65623
65929
|
case "roof":
|
|
65624
|
-
return level >=
|
|
65930
|
+
return level >= STAGE_LEVEL.roof && opts.roofLayer !== false;
|
|
65625
65931
|
case "furniture":
|
|
65626
|
-
return level >=
|
|
65932
|
+
return level >= STAGE_LEVEL.last;
|
|
65933
|
+
// the protective sidewalk round the house: the last of the work outside
|
|
65934
|
+
case "exterior":
|
|
65935
|
+
return level >= STAGE_LEVEL.last;
|
|
65627
65936
|
case "perimeter":
|
|
65628
|
-
return level >=
|
|
65937
|
+
return level >= STAGE_LEVEL.last && opts.lotLayer !== false;
|
|
65629
65938
|
default:
|
|
65630
65939
|
return true;
|
|
65631
65940
|
}
|
|
@@ -65633,17 +65942,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65633
65942
|
var EMBEDDED = /* @__PURE__ */ new Set(["wall_pipe", "wall_conduit", "electrical_box"]);
|
|
65634
65943
|
function groupVisible(name, level, opts) {
|
|
65635
65944
|
const roofOn = opts.roofLayer !== false;
|
|
65945
|
+
const bare = level < STAGE_LEVEL.finishes;
|
|
65636
65946
|
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 >=
|
|
65947
|
+
if (name === "stage:1:foundation") return level >= STAGE_LEVEL.foundation && bare;
|
|
65948
|
+
if (name === "stage:1:starter_bars") return level === STAGE_LEVEL.foundation;
|
|
65949
|
+
if (name === "stage:2:frame") return level >= STAGE_LEVEL.frame && bare;
|
|
65950
|
+
if (name === "stage:3:masonry") return level >= STAGE_LEVEL.masonry && bare;
|
|
65951
|
+
if (name === "stage:4:installations") return level === STAGE_LEVEL.installations || level >= STAGE_LEVEL.installations && opts.waterLayer === true;
|
|
65952
|
+
if (name === "stage:4:sewer_boxes") return level >= STAGE_LEVEL.installations;
|
|
65953
|
+
if (name === "stage:7:roof_framing") return level >= STAGE_LEVEL.roofFraming && roofOn;
|
|
65954
|
+
if (name === "roof") return level >= STAGE_LEVEL.roof && roofOn;
|
|
65955
|
+
if (name === "attic_tank") return level >= STAGE_LEVEL.installations;
|
|
65956
|
+
if (/^t\d+$/.test(name)) return level >= STAGE_LEVEL.finishes;
|
|
65647
65957
|
return null;
|
|
65648
65958
|
}
|
|
65649
65959
|
function applyConstructionLevel(houseGroup, rawLevel, opts = {}) {
|
|
@@ -65657,7 +65967,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65657
65967
|
const lines = name === "stage:0:blueprint" ? child.getObjectByName(BLUEPRINT_LINES) : void 0;
|
|
65658
65968
|
if (lines) lines.visible = level === 0;
|
|
65659
65969
|
const heap = name === "stage:4:installations" ? child.getObjectByName(SPOIL_HEAP) : void 0;
|
|
65660
|
-
if (heap) heap.visible = level ===
|
|
65970
|
+
if (heap) heap.visible = level === STAGE_LEVEL.installations;
|
|
65971
|
+
if (name === "roof") {
|
|
65972
|
+
for (const mesh3 of child.children) if (/\/plaster$/.test(mesh3.name)) mesh3.visible = level >= STAGE_LEVEL.finishes;
|
|
65973
|
+
}
|
|
65661
65974
|
continue;
|
|
65662
65975
|
}
|
|
65663
65976
|
if (name === "lot") child.visible = level >= 4 && lotOn;
|
|
@@ -65667,7 +65980,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65667
65980
|
const ud = obj.userData;
|
|
65668
65981
|
if (!ud) return;
|
|
65669
65982
|
if (ud.part === "lamp_holder" || ud.part === "lamp_bulb") {
|
|
65670
|
-
obj.visible = typeof ud.id !== "string" || (ud.mount === "slab" ? level
|
|
65983
|
+
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
65984
|
return;
|
|
65672
65985
|
}
|
|
65673
65986
|
if (typeof ud.part === "string" && EMBEDDED.has(ud.part)) {
|
|
@@ -65803,6 +66116,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65803
66116
|
}
|
|
65804
66117
|
return t;
|
|
65805
66118
|
}
|
|
66119
|
+
function battenClearOfSolids(slope, s, [a, b], solids2) {
|
|
66120
|
+
const { batten } = TIMBER;
|
|
66121
|
+
const p0 = down(slope.point(s, a), batten.top), p1 = down(slope.point(s, b), batten.top);
|
|
66122
|
+
const axis2 = Math.abs(p1[0] - p0[0]) < 1e-6 ? 0 : 2;
|
|
66123
|
+
const other = axis2 === 0 ? 2 : 0;
|
|
66124
|
+
const rise = Math.abs(slope.point(1, a)[axis2] - slope.point(0, a)[axis2]);
|
|
66125
|
+
if (rise < 1e-6) return s;
|
|
66126
|
+
const lo = Math.min(p0[other], p1[other]), hi = Math.max(p0[other], p1[other]);
|
|
66127
|
+
const y0 = Math.min(p0[1], p1[1]) - batten.height, y1 = Math.max(p0[1], p1[1]);
|
|
66128
|
+
for (const box5 of solids2) {
|
|
66129
|
+
if (box5[other] > hi || box5[other + 3] < lo || box5[1] > y1 || box5[4] < y0) continue;
|
|
66130
|
+
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;
|
|
66131
|
+
}
|
|
66132
|
+
return s;
|
|
66133
|
+
}
|
|
65806
66134
|
function spanAt(slope, s) {
|
|
65807
66135
|
return slope.hipped ? [slope.t0 + s + EDGE2, slope.t1 - s - EDGE2] : [slope.t0 + EDGE2, slope.t1 - EDGE2];
|
|
65808
66136
|
}
|
|
@@ -65810,8 +66138,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65810
66138
|
const { batten, rafter, purlin } = TIMBER;
|
|
65811
66139
|
for (let s = batten.spacing / 2; s < slope.run - 0.12; s += batten.spacing) {
|
|
65812
66140
|
const [a0, b0] = spanAt(slope, s);
|
|
65813
|
-
const a = a0 +
|
|
65814
|
-
if (b - a
|
|
66141
|
+
const a = a0 + BATTEN_SHORT, b = b0 - BATTEN_SHORT;
|
|
66142
|
+
if (b - a <= 0.05) continue;
|
|
66143
|
+
const at4 = battenClearOfSolids(slope, s, [a, b], solids2);
|
|
66144
|
+
addTimberAround(batches.battens, down(slope.point(at4, a), batten.top), down(slope.point(at4, b), batten.top), batten.width, batten.height, keepOut);
|
|
65815
66145
|
}
|
|
65816
66146
|
const t0 = slope.t0 + EDGE2, t1 = slope.t1 - EDGE2;
|
|
65817
66147
|
const count = Math.max(1, Math.round((t1 - t0) / rafter.spacing));
|
|
@@ -65831,7 +66161,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65831
66161
|
const p0 = down(slope.point(s, a), top), p1 = down(slope.point(s, b), top);
|
|
65832
66162
|
const depth = Math.min(purlin.height, p0[1] - slabTop - 3e-3);
|
|
65833
66163
|
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));
|
|
66164
|
+
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
66165
|
if (k === 0) return;
|
|
65836
66166
|
const posts = Math.max(1, Math.ceil((b - a) / TIMBER.post.spacing));
|
|
65837
66167
|
for (let j = 0; j <= posts; j++) {
|
|
@@ -65840,6 +66170,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
65840
66170
|
}
|
|
65841
66171
|
});
|
|
65842
66172
|
}
|
|
66173
|
+
var BATTEN_SHORT = 0.0185;
|
|
66174
|
+
var BATTEN_SIDE_CLEAR = 35e-4;
|
|
66175
|
+
var PLATE_NARROWER = 8e-3;
|
|
66176
|
+
var BOX_VERTICES = 24;
|
|
66177
|
+
function bareBoxesOf(THREE, groups) {
|
|
66178
|
+
const out = [];
|
|
66179
|
+
const v = new THREE.Vector3();
|
|
66180
|
+
for (const group of groups) {
|
|
66181
|
+
group.updateMatrixWorld(true);
|
|
66182
|
+
group.traverse((o) => {
|
|
66183
|
+
const mesh3 = o;
|
|
66184
|
+
if (!mesh3.isMesh) return;
|
|
66185
|
+
const position = mesh3.geometry.getAttribute("position");
|
|
66186
|
+
const step = position.count > BOX_VERTICES && position.count % BOX_VERTICES === 0 ? BOX_VERTICES : position.count;
|
|
66187
|
+
for (let i = 0; i + step <= position.count; i += step) {
|
|
66188
|
+
const box5 = new THREE.Box3();
|
|
66189
|
+
for (let k = i; k < i + step; k++) box5.expandByPoint(v.fromBufferAttribute(position, k).applyMatrix4(mesh3.matrixWorld));
|
|
66190
|
+
out.push([box5.min.x, box5.min.y, box5.min.z, box5.max.x, box5.max.y, box5.max.z]);
|
|
66191
|
+
}
|
|
66192
|
+
});
|
|
66193
|
+
}
|
|
66194
|
+
return out;
|
|
66195
|
+
}
|
|
65843
66196
|
function buildRoofFramingStage(THREE, roofRects, material, solids2 = [], keepOut = []) {
|
|
65844
66197
|
const group = new THREE.Group();
|
|
65845
66198
|
group.name = "stage:7:roof_framing";
|
|
@@ -66040,8 +66393,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66040
66393
|
shared3.ctx.pu = Math.max(0, pr.unit != null ? pr.unit : 0);
|
|
66041
66394
|
shared3.ctx.showBuilding = shared3.ctx.apartment && (pr.showIt == null ? true : !!pr.showIt);
|
|
66042
66395
|
shared3.ctx.limits = { x0: -2, z0: -2, x1: r.w + 2, z1: r.d + 2 };
|
|
66043
|
-
shared3.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), opts: shared3.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
|
|
66396
|
+
shared3.ctx.veg = VEG ? { G: VEG.G, S: VEG.S, mats: vegMaterials, groups: /* @__PURE__ */ new Map(), ok: /* @__PURE__ */ new Map(), sizes: /* @__PURE__ */ new Map(), opts: shared3.quality === "game" ? { quality: "game" } : { quality: "high", lod: 0, triangleBudget: 6e4 } } : null;
|
|
66044
66397
|
shared3.ctx.vegInfo = null;
|
|
66398
|
+
shared3.ctx.itemBounds = opts.itemBounds ? [] : void 0;
|
|
66399
|
+
shared3.ctx.cordPaths = opts.itemBounds ? [] : void 0;
|
|
66045
66400
|
const cs = !!(opts.constructionStages || opts.constructionLevel != null);
|
|
66046
66401
|
shared3.ctx.constructionStages = cs;
|
|
66047
66402
|
if (Y0(0) > 0 && !shared3.ctx.visorScene) shared3.ctx.unitGround = Y0(0);
|
|
@@ -66330,7 +66685,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66330
66685
|
const bp = buildBlueprintStage(THREE, K.DOC, r, rectsOf2);
|
|
66331
66686
|
const stGroups = buildStructuralStageGroups(THREE, r0.structure, r.outbuildings || [], [...embeddedRunsOf(house), ...wallBoxRunsOf(r, shared3.ctx.wallBoxShifts)], shared3.ctx.blockLaid ?? []);
|
|
66332
66687
|
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 ?? [])]);
|
|
66688
|
+
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
66689
|
const yardBoxes = instGroup.userData.yardBoxes;
|
|
66335
66690
|
for (const sg of [bp, stGroups.foundation, stGroups.starterBars, stGroups.frame, stGroups.masonry, instGroup, ...yardBoxes ? [yardBoxes] : [], roofFraming]) {
|
|
66336
66691
|
gs[sg.name] = sg;
|
|
@@ -66689,6 +67044,90 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66689
67044
|
installBuildBuild(K, shared3);
|
|
66690
67045
|
return buildApi(K, shared3);
|
|
66691
67046
|
}
|
|
67047
|
+
var HOLD_REACH2 = 0.05;
|
|
67048
|
+
var BACK_TOUCH = 0.02;
|
|
67049
|
+
var SOFT = /* @__PURE__ */ new Set(["fabric", "paper", "foliage"]);
|
|
67050
|
+
var gapOf = (a, b) => Math.max(0, ...[0, 1, 2].map((k) => Math.max(a.min[k] - b.max[k], b.min[k] - a.max[k])));
|
|
67051
|
+
function groupsOf(parts2, joints) {
|
|
67052
|
+
const root = new Map(parts2.map((part) => [part.id, part.id]));
|
|
67053
|
+
const find = (id) => {
|
|
67054
|
+
let at4 = id;
|
|
67055
|
+
while (root.get(at4) !== at4) at4 = root.get(at4);
|
|
67056
|
+
root.set(id, at4);
|
|
67057
|
+
return at4;
|
|
67058
|
+
};
|
|
67059
|
+
for (const joint2 of joints) root.set(find(joint2.a), find(joint2.b));
|
|
67060
|
+
const groups = /* @__PURE__ */ new Map();
|
|
67061
|
+
for (const part of parts2) {
|
|
67062
|
+
const at4 = find(part.id);
|
|
67063
|
+
groups.set(at4, [...groups.get(at4) ?? [], part.id]);
|
|
67064
|
+
}
|
|
67065
|
+
return [...groups.values()];
|
|
67066
|
+
}
|
|
67067
|
+
function nearestJoint(loose, held, boxOf3, reach2) {
|
|
67068
|
+
let best = null;
|
|
67069
|
+
for (const a of loose) {
|
|
67070
|
+
for (const b of held) {
|
|
67071
|
+
const gap = gapOf(boxOf3(a.id), boxOf3(b.id));
|
|
67072
|
+
if (gap <= reach2 && (!best || gap < best.gap)) best = { gap, a, b };
|
|
67073
|
+
}
|
|
67074
|
+
}
|
|
67075
|
+
if (!best) return null;
|
|
67076
|
+
const [joint2] = inferJoints([best.a, best.b], best.gap + 0.05);
|
|
67077
|
+
return joint2 ? { ...joint2, id: `${best.a.id}~${best.b.id}` } : null;
|
|
67078
|
+
}
|
|
67079
|
+
var FLOOR_TOUCH = 5e-3;
|
|
67080
|
+
var STANDS_ALONE = 0.3;
|
|
67081
|
+
function standsAlone(group, boxOf3) {
|
|
67082
|
+
const feet = group.map((part) => boxOf3(part.id)).filter((box5) => box5.min[1] <= FLOOR_TOUCH);
|
|
67083
|
+
if (feet.length === 0) return false;
|
|
67084
|
+
const height = Math.max(...group.map((part) => boxOf3(part.id).max[1]));
|
|
67085
|
+
const across2 = (k) => Math.max(...feet.map((box5) => box5.max[k])) - Math.min(...feet.map((box5) => box5.min[k]));
|
|
67086
|
+
return Math.min(across2(0), across2(2)) >= STANDS_ALONE * height;
|
|
67087
|
+
}
|
|
67088
|
+
function joinBodies({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
67089
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id))).sort((a, b) => b.length - a.length);
|
|
67090
|
+
const [main, ...rest2] = groups;
|
|
67091
|
+
if (!main) return;
|
|
67092
|
+
for (const group of rest2) {
|
|
67093
|
+
if (standsAlone(group, boxOf3)) continue;
|
|
67094
|
+
const joint2 = nearestJoint(group, main, boxOf3, Infinity);
|
|
67095
|
+
if (joint2) joints.push(joint2);
|
|
67096
|
+
}
|
|
67097
|
+
}
|
|
67098
|
+
function holdLooseGroups(params) {
|
|
67099
|
+
const byId = new Map(params.parts.map((part) => [part.id, part]));
|
|
67100
|
+
holdHanging(params, byId);
|
|
67101
|
+
joinBodies(params, byId);
|
|
67102
|
+
}
|
|
67103
|
+
function holdHanging({ parts: parts2, joints, boxOf: boxOf3 }, byId) {
|
|
67104
|
+
const back = Math.min(...parts2.map((part) => boxOf3(part.id).min[2]));
|
|
67105
|
+
for (let pass = 0; pass < parts2.length; pass++) {
|
|
67106
|
+
const groups = groupsOf(parts2, joints).map((ids) => ids.map((id) => byId.get(id)));
|
|
67107
|
+
const held = groups.filter((group) => group.some((part) => part.anchored)).flat();
|
|
67108
|
+
const loose = groups.filter((group) => !group.some((part) => part.anchored));
|
|
67109
|
+
if (loose.length === 0) return;
|
|
67110
|
+
let changed = false;
|
|
67111
|
+
for (const group of loose) {
|
|
67112
|
+
const joint2 = nearestJoint(group, held, boxOf3, HOLD_REACH2);
|
|
67113
|
+
if (joint2) {
|
|
67114
|
+
joints.push(joint2);
|
|
67115
|
+
changed = true;
|
|
67116
|
+
continue;
|
|
67117
|
+
}
|
|
67118
|
+
const onWall = group.filter((part) => !SOFT.has(part.material) && boxOf3(part.id).min[2] <= back + BACK_TOUCH);
|
|
67119
|
+
if (onWall.length === 0) continue;
|
|
67120
|
+
for (const part of onWall) part.anchored = true;
|
|
67121
|
+
changed = true;
|
|
67122
|
+
}
|
|
67123
|
+
if (changed) continue;
|
|
67124
|
+
for (const group of loose) {
|
|
67125
|
+
const joint2 = nearestJoint(group, held, boxOf3, Infinity);
|
|
67126
|
+
if (joint2) joints.push(joint2);
|
|
67127
|
+
}
|
|
67128
|
+
return;
|
|
67129
|
+
}
|
|
67130
|
+
}
|
|
66692
67131
|
var WOOD_THIN = 0.035;
|
|
66693
67132
|
var BOARD_TOP_THICK = 0.07;
|
|
66694
67133
|
var BOARD_TOP_WIDTH = 0.5;
|
|
@@ -66740,7 +67179,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66740
67179
|
const channel = (shift) => Math.min(255, Math.round((color2 >> shift & 255) * k)) << shift;
|
|
66741
67180
|
return channel(16) | channel(8) | channel(0);
|
|
66742
67181
|
}
|
|
66743
|
-
var
|
|
67182
|
+
var FLOOR_TOUCH2 = 5e-3;
|
|
66744
67183
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
66745
67184
|
var BASE_MATERIAL = {
|
|
66746
67185
|
wood: "wood_hard",
|
|
@@ -66825,7 +67264,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66825
67264
|
else if (p.key === "wood" && material === "wood_hard" && thin < WOOD_THIN) material = "wood_soft";
|
|
66826
67265
|
const part = { id: p.id, material, shape: p.shape, position: p.position };
|
|
66827
67266
|
if (p.rotation) part.rotation = p.rotation;
|
|
66828
|
-
if (!LOOSE.has(material) && p.min[1] <=
|
|
67267
|
+
if (!LOOSE.has(material) && p.min[1] <= FLOOR_TOUCH2) part.anchored = true;
|
|
67268
|
+
if (opts.carcass && LOOSE.has(material)) {
|
|
67269
|
+
part.hands = 1;
|
|
67270
|
+
part.tags = ["book"];
|
|
67271
|
+
}
|
|
66829
67272
|
return part;
|
|
66830
67273
|
});
|
|
66831
67274
|
const byId = new Map(drawn.map((p) => [p.id, p]));
|
|
@@ -66844,6 +67287,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66844
67287
|
}
|
|
66845
67288
|
joints.push(j);
|
|
66846
67289
|
}
|
|
67290
|
+
holdLooseGroups({ parts: parts2, joints, boxOf: (id) => byId.get(id) });
|
|
67291
|
+
const low = (part) => byId.get(part.id).min[1];
|
|
67292
|
+
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
67293
|
+
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
67294
|
+
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
67295
|
+
const fixed2 = wallMounted || sunk || rooted;
|
|
66847
67296
|
const all = drawn.reduce(
|
|
66848
67297
|
(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]) }),
|
|
66849
67298
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|
|
@@ -66865,7 +67314,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66865
67314
|
if ((max2[0] - min2[0]) * (max2[1] - min2[1]) >= 0.6 * footprint && mid.max[1] >= 0.2) top = { part: mid.id, y: mid.max[1], parts: boards.map((b) => b.id) };
|
|
66866
67315
|
}
|
|
66867
67316
|
if (opts.carcass) carcass(parts2, byId);
|
|
66868
|
-
const spec = { name, parts: parts2, joints, tags: ["furniture"] };
|
|
67317
|
+
const spec = { name, parts: parts2, joints, tags: ["furniture"], ...fixed2 ? { fixed: fixed2 } : {} };
|
|
66869
67318
|
const colors = new Map(drawn.map((p) => [p.id, p.color]));
|
|
66870
67319
|
const build = (T3) => {
|
|
66871
67320
|
const group = markKitOrigin(new T3.Group(), { owner: "game-floorplan-three", kind: "furniture", id: name });
|
|
@@ -66895,7 +67344,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66895
67344
|
}
|
|
66896
67345
|
return group;
|
|
66897
67346
|
};
|
|
66898
|
-
return { spec, build, top };
|
|
67347
|
+
return { spec, build, top, fixed: fixed2 };
|
|
66899
67348
|
}
|
|
66900
67349
|
function furnitureSpec(THREE, type, opts = {}) {
|
|
66901
67350
|
const renderer = rendererOf(THREE, opts.document);
|
|
@@ -66931,7 +67380,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66931
67380
|
);
|
|
66932
67381
|
const spouts = K.PARTS.slice(before).filter((p) => p.type === "water_tap").map((p) => [p.pos[0] - root.x, p.pos[1], p.pos[2] - root.z]);
|
|
66933
67382
|
K.PARTS.length = before;
|
|
66934
|
-
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts };
|
|
67383
|
+
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts, fixed: made.fixed };
|
|
66935
67384
|
}
|
|
66936
67385
|
|
|
66937
67386
|
// src/attachments-key.ts
|
|
@@ -100484,7 +100933,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100484
100933
|
};
|
|
100485
100934
|
var handleHand = (pair, event, tool2) => {
|
|
100486
100935
|
const { box: box5, model } = pair;
|
|
100487
|
-
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
100936
|
+
if (event.type === "explosion" || event.type === "player" || event.type === "footfall" || event.type === "holster") return;
|
|
100488
100937
|
if (event.type === "tool") {
|
|
100489
100938
|
if (hasWeaponModel(event.weapon)) box5.unequip();
|
|
100490
100939
|
else model.unequip();
|
|
@@ -100514,7 +100963,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100514
100963
|
};
|
|
100515
100964
|
return {
|
|
100516
100965
|
handle(event, tool2) {
|
|
100517
|
-
if (event.type === "explosion" || event.type === "player" || event.type === "footfall") return;
|
|
100966
|
+
if (event.type === "explosion" || event.type === "player" || event.type === "footfall" || event.type === "holster") return;
|
|
100518
100967
|
if (event.hand !== "L") {
|
|
100519
100968
|
handleHand(right, event, tool2);
|
|
100520
100969
|
return;
|
|
@@ -100636,6 +101085,72 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100636
101085
|
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
101086
|
}
|
|
100638
101087
|
|
|
101088
|
+
// src/fx/holstered.ts
|
|
101089
|
+
var HOLSTER_PLACEMENT = {
|
|
101090
|
+
hip: { muzzle: [0, -1, 0], out: [-1, 0, 0] },
|
|
101091
|
+
back: { muzzle: [0.55, 0.835, 0], out: [0, 0, -1] }
|
|
101092
|
+
};
|
|
101093
|
+
var holsteredModel = (THREE, weapon2, slot, items) => {
|
|
101094
|
+
const place = HOLSTER_PLACEMENT[slot];
|
|
101095
|
+
const model = place ? buildModeledProp(THREE, { id: weapon2 }, weapon2, void 0, items) : void 0;
|
|
101096
|
+
if (!place || !model) return void 0;
|
|
101097
|
+
const [, height, thickness] = model.userData.footprint ?? [0, 0, 0];
|
|
101098
|
+
const muzzle2 = new THREE.Vector3(...place.muzzle).normalize();
|
|
101099
|
+
const out = new THREE.Vector3(...place.out).normalize();
|
|
101100
|
+
const top = new THREE.Vector3().crossVectors(out, muzzle2).normalize();
|
|
101101
|
+
model.quaternion.setFromRotationMatrix(new THREE.Matrix4().makeBasis(muzzle2, top, out));
|
|
101102
|
+
model.position.copy(top.multiplyScalar(-height / 2)).addScaledVector(out, thickness / 2);
|
|
101103
|
+
const holder = new THREE.Group();
|
|
101104
|
+
holder.name = `holstered_${weapon2}`;
|
|
101105
|
+
holder.add(model);
|
|
101106
|
+
return holder;
|
|
101107
|
+
};
|
|
101108
|
+
var createHolsteredWeapons = (options) => {
|
|
101109
|
+
const { THREE } = options;
|
|
101110
|
+
const models = /* @__PURE__ */ new Map();
|
|
101111
|
+
const away = /* @__PURE__ */ new Map();
|
|
101112
|
+
const place = (weapon2, slot) => {
|
|
101113
|
+
const holder = models.get(`${weapon2}@${slot}`);
|
|
101114
|
+
const pose = options.bodySlot(slot);
|
|
101115
|
+
if (!holder) return;
|
|
101116
|
+
holder.visible = pose !== null;
|
|
101117
|
+
if (!pose) return;
|
|
101118
|
+
holder.position.set(pose.position[0], pose.position[1], pose.position[2]);
|
|
101119
|
+
holder.quaternion.set(pose.quaternion[0], pose.quaternion[1], pose.quaternion[2], pose.quaternion[3]);
|
|
101120
|
+
};
|
|
101121
|
+
return {
|
|
101122
|
+
handle(event) {
|
|
101123
|
+
const key2 = `${event.weapon}@${event.slot}`;
|
|
101124
|
+
if (!event.on) {
|
|
101125
|
+
away.delete(event.weapon);
|
|
101126
|
+
const holder = models.get(key2);
|
|
101127
|
+
if (holder) holder.visible = false;
|
|
101128
|
+
return;
|
|
101129
|
+
}
|
|
101130
|
+
if (!options.arsenal.weapons.has(event.weapon)) return;
|
|
101131
|
+
if (!models.has(key2)) {
|
|
101132
|
+
const holder = holsteredModel(THREE, event.weapon, event.slot, options.items);
|
|
101133
|
+
if (!holder) return;
|
|
101134
|
+
options.scene.add(holder);
|
|
101135
|
+
models.set(key2, holder);
|
|
101136
|
+
}
|
|
101137
|
+
away.set(event.weapon, event.slot);
|
|
101138
|
+
place(event.weapon, event.slot);
|
|
101139
|
+
},
|
|
101140
|
+
update() {
|
|
101141
|
+
for (const [weapon2, slot] of away) place(weapon2, slot);
|
|
101142
|
+
},
|
|
101143
|
+
get drawn() {
|
|
101144
|
+
return [...away.keys()];
|
|
101145
|
+
},
|
|
101146
|
+
dispose() {
|
|
101147
|
+
discardObject3D([...models.values()]);
|
|
101148
|
+
models.clear();
|
|
101149
|
+
away.clear();
|
|
101150
|
+
}
|
|
101151
|
+
};
|
|
101152
|
+
};
|
|
101153
|
+
|
|
100639
101154
|
// assets/weapon-svg/manifest.json
|
|
100640
101155
|
var manifest_default = {
|
|
100641
101156
|
version: 1,
|
|
@@ -102095,8 +102610,14 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102095
102610
|
else if (change.kind === "control" && change.id === "fuse_length" && typeof change.value === "number") lent.configureTool?.({ fuse_length: String(change.value) });
|
|
102096
102611
|
});
|
|
102097
102612
|
const worldEffects = createWorldEffects({ arsenal });
|
|
102613
|
+
const bodySlot = lent.bodySlot?.bind(lent);
|
|
102614
|
+
const holstered = bodySlot ? createHolsteredWeapons({ THREE: lent.THREE, scene: lent.scene, arsenal, ...options.items ? { items: options.items } : {}, bodySlot }) : null;
|
|
102098
102615
|
const offEvents = lent.on((event) => {
|
|
102099
102616
|
worldEffects.handle(event, lent.effects);
|
|
102617
|
+
if (event.type === "holster") {
|
|
102618
|
+
holstered?.handle(event);
|
|
102619
|
+
return;
|
|
102620
|
+
}
|
|
102100
102621
|
if (event.type === "explosion") {
|
|
102101
102622
|
if (lentEngine) return;
|
|
102102
102623
|
const away = Math.hypot(event.point[0] - camera2.position.x, event.point[1] - camera2.position.y, event.point[2] - camera2.position.z);
|
|
@@ -102114,7 +102635,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102114
102635
|
}
|
|
102115
102636
|
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
102637
|
});
|
|
102117
|
-
const offFrame = lent.onFrame((dt) =>
|
|
102638
|
+
const offFrame = lent.onFrame((dt) => {
|
|
102639
|
+
created.update(dt);
|
|
102640
|
+
holstered?.update();
|
|
102641
|
+
});
|
|
102118
102642
|
const offHands = lent.setHandTargets?.(() => created.handTargets());
|
|
102119
102643
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
102120
102644
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
@@ -102128,6 +102652,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
102128
102652
|
offHands?.();
|
|
102129
102653
|
offMuzzle?.();
|
|
102130
102654
|
created.dispose();
|
|
102655
|
+
holstered?.dispose();
|
|
102131
102656
|
audio?.dispose();
|
|
102132
102657
|
fx = null;
|
|
102133
102658
|
host = null;
|