@adatechnology/game-floorplan-three 0.4.0 → 0.4.2

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.
@@ -10895,6 +10895,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
10895
10895
  const flame = flameBase * (1 - rules.flameFillInfluence * (1 - k));
10896
10896
  return 1 - (1 - Math.min(1, Math.max(0, spark))) * (1 - Math.min(1, Math.max(0, flame)));
10897
10897
  };
10898
+ var KIT_ORIGIN_KEY = "kitOrigin";
10899
+ function markKitOrigin(object2, origin) {
10900
+ const node = object2;
10901
+ node.userData = node.userData ?? {};
10902
+ node.userData[KIT_ORIGIN_KEY] = { ...origin };
10903
+ return object2;
10904
+ }
10898
10905
 
10899
10906
  // ../game-destruction/dist/index.js
10900
10907
  var FIRE_PRIME_C = 300;
@@ -11225,6 +11232,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
11225
11232
  return angle === 0 ? q : quat.mul(q, quat.fromAxisAngle([0, 0, 1], angle));
11226
11233
  };
11227
11234
  var clamp = (v, a, b) => Math.max(a, Math.min(b, v));
11235
+ var tearStack = (inp, root, t, u, v, n, sheet) => {
11236
+ const { dims, rnd, maxFragments } = inp;
11237
+ const layers = clamp(Math.ceil(dims[t] / STACK_LAYER), 2, 4);
11238
+ const per = clamp(n, 3, Math.max(3, Math.floor(maxFragments / layers)));
11239
+ const out = [];
11240
+ for (let k = 0; k < layers; k++) {
11241
+ const off = -dims[t] / 2 + (k + 0.5) * dims[t] / layers;
11242
+ for (const b of bsp(root, per, [u, v], rnd)) {
11243
+ if (out.length >= maxFragments) return out;
11244
+ const c = [b.c[0], b.c[1], b.c[2]];
11245
+ c[t] = off;
11246
+ out.push({ center: c, size: [b.s[u], b.s[v], sheet], q: frame(u, v, t, (rnd() - 0.5) * 0.8), shape: "scrap", weight: b.s[u] * b.s[v], inner: out.length % 4 !== 0 });
11247
+ }
11248
+ }
11249
+ return out;
11250
+ };
11251
+ var STACK_LAYER = 0.012;
11228
11252
  var planFragments = (inp) => {
11229
11253
  const { style, dims, rnd, maxFragments } = inp;
11230
11254
  const [fmin, fmax] = inp.fragmentSize;
@@ -11267,6 +11291,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
11267
11291
  }
11268
11292
  if (style === "tear") {
11269
11293
  const n2 = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 3, maxFragments);
11294
+ const sheet = inp.sheet ?? 0;
11295
+ if (sheet > 0 && dims[t] > sheet * 4) return tearStack(inp, root, t, u, v, n2, sheet);
11270
11296
  const th2 = Math.min(inp.thickness, dims[t]);
11271
11297
  for (const b of bsp(root, n2, [u, v], rnd)) {
11272
11298
  out.push({ center: [b.c[0], b.c[1], b.c[2]], size: [b.s[u], b.s[v], th2], q: frame(u, v, t), shape: "scrap", weight: b.s[u] * b.s[v] });
@@ -12849,6 +12875,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12849
12875
  0.03,
12850
12876
  0.15
12851
12877
  ],
12878
+ sheet: 1e-3,
12852
12879
  damageScale: {
12853
12880
  slash: 3
12854
12881
  },
@@ -12864,7 +12891,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
12864
12891
  smoke: "grey"
12865
12892
  },
12866
12893
  visual: {
12867
- charColor: 1709072
12894
+ charColor: 1709072,
12895
+ innerColor: 15524048
12868
12896
  },
12869
12897
  tags: [
12870
12898
  "fabric",
@@ -14577,7 +14605,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14577
14605
  hit: hitLocal,
14578
14606
  fragmentSize: p.mat.fragmentSize ?? [0.04, 0.2],
14579
14607
  maxFragments,
14580
- rnd
14608
+ rnd,
14609
+ sheet: p.mat.sheet
14581
14610
  });
14582
14611
  const holes = p.st.holes.length > 0 ? localHolesOf(p) : [];
14583
14612
  const mass = p.st.mass;
@@ -14601,7 +14630,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
14601
14630
  velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd(), dv[2] * k],
14602
14631
  angularVelocity: [(rnd() - 0.5) * 12, (rnd() - 0.5) * 12, (rnd() - 0.5) * 12],
14603
14632
  mass: mass * f.weight / totW,
14604
- ...marks.length > 0 ? { marks } : {}
14633
+ ...marks.length > 0 ? { marks } : {},
14634
+ ...f.inner ? { inner: true } : {}
14605
14635
  };
14606
14636
  });
14607
14637
  const reinforcement = p.spec.reinforcement;
@@ -19630,7 +19660,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
19630
19660
  assembleInteractive(gs);
19631
19661
  linkDoorLeaves();
19632
19662
  mailboxInteractive();
19633
- const root = new THREE.Group(), house = new THREE.Group();
19663
+ const root = markKitOrigin(new THREE.Group(), { owner: "game-floorplan-three", kind: "structure", id: r.template }), house = new THREE.Group();
19634
19664
  root.name = "house3d";
19635
19665
  root.add(house);
19636
19666
  shared.mirrors.house = house;
@@ -22668,7 +22698,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22668
22698
  const spec = { name, parts, joints, tags: ["furniture"] };
22669
22699
  const colors = new Map(drawn.map((p) => [p.id, p.color]));
22670
22700
  const build = (T3) => {
22671
- const group = new T3.Group();
22701
+ const group = markKitOrigin(new T3.Group(), { owner: "game-floorplan-three", kind: "furniture", id: name });
22672
22702
  group.name = name;
22673
22703
  const mats = /* @__PURE__ */ new Map();
22674
22704
  for (const p of parts) {