@adatechnology/game-floorplan-structure 1.3.2 → 1.3.3

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.
@@ -5064,6 +5064,7 @@ var GameFloorplanStructure = (() => {
5064
5064
  var CHIP_ENERGY = 200;
5065
5065
  var CHIP_SPLASH = 0.5;
5066
5066
  var CRATER_SPENT = 0.6;
5067
+ var EDGE_REACH = 1.5;
5067
5068
  var BAR_BOW = 0.08;
5068
5069
  var BULLET_JOINT_SPAN = 0.3;
5069
5070
  var CUT_SLICE = 1;
@@ -6437,6 +6438,9 @@ var GameFloorplanStructure = (() => {
6437
6438
  const lo = cell.center[a] - cell.size[a] / 2 + w / 2, hi = cell.center[a] + cell.size[a] / 2 - w / 2;
6438
6439
  size[a] = w;
6439
6440
  center[a] = clamp22(lp[a], lo, hi);
6441
+ const [from, to] = tornToEdge({ p, cell, a, b: a === u ? v : u, at: lp[a], crater: [center[a] - w / 2, center[a] + w / 2], reach: w * EDGE_REACH, gone: (k) => worn[k] === -1 });
6442
+ size[a] = to - from;
6443
+ center[a] = (from + to) / 2;
6440
6444
  }
6441
6445
  const taken2 = (cut[i] ?? 0) + size[u] * size[v];
6442
6446
  if (taken2 >= cell.size[u] * cell.size[v] * CRATER_SPENT) {
@@ -6474,6 +6478,19 @@ var GameFloorplanStructure = (() => {
6474
6478
  collapseCheck(o, src);
6475
6479
  }
6476
6480
  };
6481
+ const tornToEdge = (o) => {
6482
+ const { p, cell, a, b, at: at2, crater: crater2, reach, gone } = o;
6483
+ const half = p.dims[a] / 2;
6484
+ const lo = cell.center[a] - cell.size[a] / 2, hi = cell.center[a] + cell.size[a] / 2;
6485
+ const free = (side, sign) => {
6486
+ if (sign > 0 ? side >= half - 1e-6 : side <= -half + 1e-6) return sign > 0 || a !== planeAxes(p.thin)[1];
6487
+ const probe = side + sign * 1e-3;
6488
+ return gridOf(p).some((c, k) => gone(k) && Math.abs(probe - c.center[a]) <= c.size[a] / 2 && Math.abs(cell.center[b] - c.center[b]) <= c.size[b] / 2);
6489
+ };
6490
+ if (at2 - lo <= reach && free(lo, -1)) return [lo, Math.max(crater2[1], lo)];
6491
+ if (hi - at2 <= reach && free(hi, 1)) return [Math.min(crater2[0], hi), hi];
6492
+ return crater2;
6493
+ };
6477
6494
  const craterAcross = (energy) => clamp22(0.03 + 12e-4 * Math.sqrt(Math.max(0, energy)), 0.03, 0.14);
6478
6495
  const craterFragments = (o, p, cell, dir, speed, mass, tag) => {
6479
6496
  const { c, q } = partXf(o, p);