@adatechnology/game-floorplan-three 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2977,8 +2977,10 @@ function installUtilitiesElectrical(K, shared) {
2977
2977
  }
2978
2978
 
2979
2979
  // src/house/baseboard.ts
2980
+ var BASEBOARD_TILES = { length: 0.6, joint: 3e-3, material: "ceramic", density: 2300 };
2981
+ var SIDEWALK_SLABS = { length: 1.2, joint: 0.01, material: "concrete", density: 2400 };
2980
2982
  function installHouseBaseboard(K, shared) {
2981
- const { Y0, bx, cursor, sideOf } = K;
2983
+ const { Y0, bx, cursor, pieceRecord, sideOf } = K;
2982
2984
  const sh = (...a) => K.sh(...a);
2983
2985
  function baseboardAndSidewalk() {
2984
2986
  const R = shared.ctx.r, W = 0.6, t = 0.012, ht = 0.35, color = sh(shared.ctx.colors.facade != null ? shared.ctx.colors.facade : 14209216, 0.62), y0 = Y0(0), cal = 13947078;
@@ -3000,15 +3002,29 @@ function installHouseBaseboard(K, shared) {
3000
3002
  };
3001
3003
  for (const A of ws) for (const [side, sd] of [[A.w.sides[0], -1], [A.w.sides[1], 1]]) {
3002
3004
  if (!sideOf(side, false).exterior) continue;
3003
- const strip = (k, y1, y2, o0, o1, mat, c, y1b) => {
3005
+ const strip = (k, y1, y2, o0, o1, mat, c, piece, laid = BASEBOARD_TILES) => {
3004
3006
  const ea = junction(A, A.a, sd) > 0 ? A.th / 2 + k : junction(A, A.a, sd) < 0 ? -A.th / 2 : 0, eb = junction(A, A.b, sd) > 0 ? A.th / 2 + k : junction(A, A.b, sd) < 0 ? -A.th / 2 : 0;
3005
3007
  const s0 = A.a - ea, s1 = A.b + eb, f0 = A.L + sd * (A.th / 2 + o0), f1 = A.L + sd * (A.th / 2 + o1), lo = Math.min(f0, f1), hi = Math.max(f0, f1);
3006
3008
  if (s1 - s0 < 1e-3) return;
3007
- if (A.au) bx(mat, s0, y1, lo, s1, y2, hi, c);
3008
- else bx(mat, lo, y1, s0, hi, y2, s1, c);
3009
+ const box = (a, b) => {
3010
+ if (A.au) bx(mat, a, y1, lo, b, y2, hi, c);
3011
+ else bx(mat, lo, y1, a, hi, y2, b, c);
3012
+ };
3013
+ const tag = laid === BASEBOARD_TILES ? "baseboard" : "sidewalk";
3014
+ const tile = (id, a, b) => {
3015
+ cursor.pc = pieceRecord(id, laid.material, null, { floor: 0, mass: Math.round((b - a) * (y2 - y1) * (hi - lo) * laid.density * 100) / 100, tags: [tag] });
3016
+ box(a, b);
3017
+ };
3018
+ if (!piece) box(s0, s1);
3019
+ else if (shared.ctx.baseboardBand) tile(piece, s0, s1);
3020
+ else {
3021
+ const n = Math.max(1, Math.round((s1 - s0) / laid.length)), w = (s1 - s0) / n, j = laid.joint / 2;
3022
+ for (let i = 0; i < n; i++) tile(`${piece}:${i}`, s0 + i * w + (i > 0 ? j : 0), s0 + (i + 1) * w - (i < n - 1 ? j : 0));
3023
+ }
3024
+ cursor.pc = null;
3009
3025
  };
3010
- strip(t, y0, y0 + ht, 0, t, "plaster", color);
3011
- strip(W, y0, y0 + 0.045, 0, W, "sidewalk", cal);
3026
+ strip(t, y0, y0 + ht, 0, t, "plaster", color, A.w.id ? `baseboard:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0);
3027
+ strip(W, y0, y0 + 0.045, 0, W, "sidewalk", cal, A.w.id ? `sidewalk:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0, SIDEWALK_SLABS);
3012
3028
  }
3013
3029
  }
3014
3030
  const defined = { baseboardAndSidewalk };
@@ -6400,7 +6416,8 @@ function installDestructionPieces(K, shared) {
6400
6416
  l.push(it);
6401
6417
  };
6402
6418
  root.updateMatrixWorld(true);
6403
- root.traverse((o) => {
6419
+ root.traverse((o0) => {
6420
+ const o = o0;
6404
6421
  if (o.isMesh && o.userData.ranges) {
6405
6422
  const nv = o.geometry.attributes.position.count;
6406
6423
  for (const f of o.userData.ranges) add(f.id, { mesh: o, v0: f.v0, v1: f.v1, i0: f.i0, i1: f.i1, whole: f.v0 === 0 && f.v1 === nv });
@@ -6436,7 +6453,7 @@ function installDestructionPieces(K, shared) {
6436
6453
  if (!b) continue;
6437
6454
  const vol = Math.max(1e-6, (b[3] - b[0]) * (b[4] - b[1]) * (b[5] - b[2]));
6438
6455
  const p = { id, role: "none", material: pc.mat, aabb: [b[0], b[2], b[3], b[5]], y0: b[1], y1: b[4], floor: pc.floor != null ? pc.floor : floorAtY(b[1] + 0.1), mass: pc.mass != null ? pc.mass : Math.max(0.5, vol * (DENSITY[pc.mat] || 800) * (pc.fill != null ? pc.fill : 0.15)), meshes: meshes.get(id).length, extra: true };
6439
- for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null) p[k] = pc[k];
6456
+ for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill", "units"]) if (pc[k] != null) p[k] = pc[k];
6440
6457
  parts.push(p);
6441
6458
  byId.set(id, p);
6442
6459
  }
@@ -6445,7 +6462,11 @@ function installDestructionPieces(K, shared) {
6445
6462
  return cx >= q.aabb[0] - m && cx <= q.aabb[2] + m && cz >= q.aabb[1] - m && cz <= q.aabb[3] + m && cy >= q.y0 - m && cy <= q.y1 + m;
6446
6463
  };
6447
6464
  for (const p of parts.slice(base)) {
6448
- if (!/^(window|window_pane|door|jamb|pipe|water_tank)/.test(p.id)) continue;
6465
+ if (/^sidewalk:/.test(p.id)) {
6466
+ supports.push({ part: p.id, on: "ground", joint: "mortar", extra: true });
6467
+ continue;
6468
+ }
6469
+ if (!/^(window|window_pane|door|jamb|pipe|water_tank|baseboard)/.test(p.id)) continue;
6449
6470
  const target = /^water_tank/.test(p.id) ? ["slab"] : ["wall", "partition"];
6450
6471
  let m = null, md = 1e9;
6451
6472
  for (const q of parts.slice(0, base)) {
@@ -6456,7 +6477,7 @@ function installDestructionPieces(K, shared) {
6456
6477
  m = q;
6457
6478
  }
6458
6479
  }
6459
- if (m) supports.push({ part: p.id, on: m.id, joint: /^(window|jamb)/.test(p.id) ? "glue" : "clip", bears: false, extra: true });
6480
+ if (m) supports.push({ part: p.id, on: m.id, joint: /^(window|jamb|baseboard)/.test(p.id) ? "glue" : "clip", bears: false, extra: true });
6460
6481
  }
6461
6482
  const specParts = parts.slice(), specSupports = supports.slice();
6462
6483
  if (view.panels.length) {
@@ -6896,7 +6917,7 @@ function installDestructionBreach(K, _shared) {
6896
6917
  return { center: local(chip.center), along: a, up: u };
6897
6918
  }
6898
6919
  function newView(hostId) {
6899
- const items = structure.meshesOf(hostId).filter((it) => it.mesh);
6920
+ const items = structure.meshesOf(hostId).filter((it) => !!it.mesh);
6900
6921
  if (!items.length) return null;
6901
6922
  const parts = [hostId, ...riders(hostId)].filter((id) => structure.byId.get(id) && specOf(id)?.units);
6902
6923
  const mask = maskOf(hostId, parts), core = maskOf(hostId, parts);
@@ -7561,6 +7582,7 @@ function installBuildBuild(K, shared) {
7561
7582
  cursor.separate = opts.pieces === "meshes";
7562
7583
  cursor.pc = null;
7563
7584
  shared.ctx.showPillars = opts.pillars !== "hidden";
7585
+ shared.ctx.baseboardBand = opts.baseboard === "band";
7564
7586
  shared.ctx.apartment = r.template === "apartment_modern";
7565
7587
  shared.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
7566
7588
  shared.ctx.pf = Math.max(1, Math.min(shared.ctx.pa, pr.floor != null ? pr.floor : 3));
@@ -9099,6 +9121,8 @@ export {
9099
9121
  rectsOf,
9100
9122
  isOpenArea,
9101
9123
  planLod,
9124
+ BASEBOARD_TILES,
9125
+ SIDEWALK_SLABS,
9102
9126
  VERSION,
9103
9127
  create,
9104
9128
  SPECIMEN_AT,
@@ -9109,4 +9133,4 @@ export {
9109
9133
  FLOORPLAN_AREA_ID,
9110
9134
  createFloorplanTestModule
9111
9135
  };
9112
- //# sourceMappingURL=chunk-Y3Y7NYOL.js.map
9136
+ //# sourceMappingURL=chunk-PJ4WEP6U.js.map