@adatechnology/game-floorplan-three 0.10.3 → 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 };
@@ -6437,7 +6453,7 @@ function installDestructionPieces(K, shared) {
6437
6453
  if (!b) continue;
6438
6454
  const vol = Math.max(1e-6, (b[3] - b[0]) * (b[4] - b[1]) * (b[5] - b[2]));
6439
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 };
6440
- 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];
6441
6457
  parts.push(p);
6442
6458
  byId.set(id, p);
6443
6459
  }
@@ -6446,7 +6462,11 @@ function installDestructionPieces(K, shared) {
6446
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;
6447
6463
  };
6448
6464
  for (const p of parts.slice(base)) {
6449
- 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;
6450
6470
  const target = /^water_tank/.test(p.id) ? ["slab"] : ["wall", "partition"];
6451
6471
  let m = null, md = 1e9;
6452
6472
  for (const q of parts.slice(0, base)) {
@@ -6457,7 +6477,7 @@ function installDestructionPieces(K, shared) {
6457
6477
  m = q;
6458
6478
  }
6459
6479
  }
6460
- 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 });
6461
6481
  }
6462
6482
  const specParts = parts.slice(), specSupports = supports.slice();
6463
6483
  if (view.panels.length) {
@@ -7562,6 +7582,7 @@ function installBuildBuild(K, shared) {
7562
7582
  cursor.separate = opts.pieces === "meshes";
7563
7583
  cursor.pc = null;
7564
7584
  shared.ctx.showPillars = opts.pillars !== "hidden";
7585
+ shared.ctx.baseboardBand = opts.baseboard === "band";
7565
7586
  shared.ctx.apartment = r.template === "apartment_modern";
7566
7587
  shared.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
7567
7588
  shared.ctx.pf = Math.max(1, Math.min(shared.ctx.pa, pr.floor != null ? pr.floor : 3));
@@ -9100,6 +9121,8 @@ export {
9100
9121
  rectsOf,
9101
9122
  isOpenArea,
9102
9123
  planLod,
9124
+ BASEBOARD_TILES,
9125
+ SIDEWALK_SLABS,
9103
9126
  VERSION,
9104
9127
  create,
9105
9128
  SPECIMEN_AT,
@@ -9110,4 +9133,4 @@ export {
9110
9133
  FLOORPLAN_AREA_ID,
9111
9134
  createFloorplanTestModule
9112
9135
  };
9113
- //# sourceMappingURL=chunk-JZQA7G63.js.map
9136
+ //# sourceMappingURL=chunk-PJ4WEP6U.js.map