@adatechnology/game-weapons-three 0.29.2 → 0.29.4

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.
@@ -21889,33 +21889,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21889
21889
  return out;
21890
21890
  };
21891
21891
  var granules = (inp, box5, count) => bsp(box5, count, [0, 1, 2], inp.rnd).map((b) => ({ center: b.c, size: b.s, q: quat.identity(), shape: "chunk", weight: b.s[0] * b.s[1] * b.s[2] }));
21892
- var SLAB_MIN = 0.03;
21893
- var splitAtHit = (root, hit, axes, count, rnd2) => {
21894
- let pieces = [root];
21895
- for (const ax of axes) {
21896
- const half = root.s[ax] / 2;
21897
- if (hit[ax] - -half < SLAB_MIN || half - hit[ax] < SLAB_MIN) continue;
21898
- const next = [];
21899
- for (const b of pieces) {
21900
- const lo = b.c[ax] - b.s[ax] / 2;
21901
- const hi = b.c[ax] + b.s[ax] / 2;
21902
- for (const [from, to] of [[lo, hit[ax]], [hit[ax], hi]]) {
21903
- const c = [b.c[0], b.c[1], b.c[2]];
21904
- const s = [b.s[0], b.s[1], b.s[2]];
21905
- c[ax] = (from + to) / 2;
21906
- s[ax] = to - from;
21907
- next.push({ c, s });
21908
- }
21909
- }
21910
- pieces = next;
21911
- }
21912
- while (pieces.length < count) {
21913
- pieces.sort((a, b) => b.s[axes[0]] * b.s[axes[1]] - a.s[axes[0]] * a.s[axes[1]]);
21914
- const [big, ...rest2] = pieces;
21915
- pieces = [...bsp(big, 2, axes, rnd2), ...rest2];
21916
- }
21917
- return pieces;
21918
- };
21919
21892
  var CRUMBS = 6;
21920
21893
  var severAt = (inp, root, at4, gap) => {
21921
21894
  const dims = root.s;
@@ -21963,8 +21936,72 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21963
21936
  }
21964
21937
  return out;
21965
21938
  };
21939
+ var radialPlates = (inp, root, axes, n, th, cap, fit = false) => {
21940
+ const { rnd: rnd2, maxFragments } = inp;
21941
+ const { t, u, v } = axes;
21942
+ const dims = root.s;
21943
+ const out = [];
21944
+ const Hu = dims[u] / 2, Hv = dims[v] / 2;
21945
+ const hu = clamp(inp.hit[u] - root.c[u], -Hu * 0.95, Hu * 0.95);
21946
+ const hv = clamp(inp.hit[v] - root.c[v], -Hv * 0.95, Hv * 0.95);
21947
+ const R = Math.max(Math.hypot(Hu + Math.abs(hu), Hv + Math.abs(hv)), 0.02);
21948
+ const sectors = clamp(Math.round(Math.sqrt(n * 1.6)), Math.min(5, n), 10);
21949
+ const rings = Math.max(1, Math.ceil(n / sectors));
21950
+ const radii = [];
21951
+ for (let k = 0; k <= rings; k++) radii.push(R * Math.pow(k / rings, 1.3));
21952
+ for (let j = 0; j < sectors && out.length < maxFragments; j++) {
21953
+ const theta = (j + (rnd2() - 0.5) * 0.4) * (Math.PI * 2 / sectors);
21954
+ for (let k = 0; k < rings && out.length < maxFragments; k++) {
21955
+ const rm = (radii[k] + radii[k + 1]) / 2;
21956
+ const cu = hu + rm * Math.cos(theta);
21957
+ const cv = hv + rm * Math.sin(theta);
21958
+ if (Math.abs(cu) > Hu + 0.01 || Math.abs(cv) > Hv + 0.01) continue;
21959
+ const radial = clamp(radii[k + 1] - radii[k], 0.01, cap);
21960
+ const tang = clamp(radii[k + 1] * (Math.PI * 2 / sectors) * 0.9, 0.01, cap);
21961
+ const c = [root.c[0], root.c[1], root.c[2]];
21962
+ c[u] = root.c[u] + clamp(cu, -Hu * 0.98, Hu * 0.98);
21963
+ c[v] = root.c[v] + clamp(cv, -Hv * 0.98, Hv * 0.98);
21964
+ const shrink = fit ? fitInside(radial, tang, theta, Hu, Hv) : 1;
21965
+ if (fit) {
21966
+ const reach2 = reachOf(radial * shrink, tang * shrink, theta);
21967
+ c[u] = root.c[u] + clamp(c[u] - root.c[u], -(Hu - reach2[0]), Hu - reach2[0]);
21968
+ c[v] = root.c[v] + clamp(c[v] - root.c[v], -(Hv - reach2[1]), Hv - reach2[1]);
21969
+ }
21970
+ out.push({ center: c, size: [radial * shrink, tang * shrink, th], q: frame(u, v, t, theta), shape: "shard", weight: radial * tang * shrink * shrink });
21971
+ }
21972
+ }
21973
+ if (out.length === 0) out.push({ center: [root.c[0], root.c[1], root.c[2]], size: [dims[u], dims[v], th], q: frame(u, v, t), shape: "shard", weight: 1 });
21974
+ return out;
21975
+ };
21976
+ var reachOf = (radial, tang, theta) => {
21977
+ const cos2 = Math.abs(Math.cos(theta)), sin2 = Math.abs(Math.sin(theta));
21978
+ return [(cos2 * radial + sin2 * tang) / 2, (sin2 * radial + cos2 * tang) / 2];
21979
+ };
21980
+ var fitInside = (radial, tang, theta, halfU, halfV) => {
21981
+ const [reachU, reachV] = reachOf(radial, tang, theta);
21982
+ return Math.min(halfU / Math.max(reachU, 1e-9), halfV / Math.max(reachV, 1e-9), 1);
21983
+ };
21966
21984
  var STACK_LAYER = 0.012;
21985
+ var SOLID_VOLUME_MIN = 1e-6;
21967
21986
  var planFragments = (inp) => {
21987
+ const solids2 = inp.solids;
21988
+ if (!solids2 || solids2.length < 2) return planBox(inp);
21989
+ const volumes = solids2.map((solid2) => Math.max(SOLID_VOLUME_MIN, solid2.size[0] * solid2.size[1] * solid2.size[2]));
21990
+ const total = volumes.reduce((sum2, volume) => sum2 + volume, 0);
21991
+ const out = [];
21992
+ solids2.forEach((solid2, i) => {
21993
+ const share = Math.max(1, Math.round(inp.maxFragments * volumes[i] / total));
21994
+ const hit = [inp.hit[0] - solid2.center[0], inp.hit[1] - solid2.center[1], inp.hit[2] - solid2.center[2]];
21995
+ const { cut, solids: _all, ...rest2 } = inp;
21996
+ const along2 = cut ? [0, 1, 2].sort((a, b) => solid2.size[b] - solid2.size[a])[0] : -1;
21997
+ const inside3 = cut && Math.abs(cut.at - solid2.center[along2]) < solid2.size[along2] / 2 ? { cut: { at: cut.at - solid2.center[along2], gap: cut.gap } } : {};
21998
+ for (const f of planBox({ ...rest2, ...inside3, dims: [solid2.size[0], solid2.size[1], solid2.size[2]], hit, maxFragments: share, thickness: Math.min(inp.thickness, Math.min(...solid2.size)) })) {
21999
+ out.push({ ...f, center: [f.center[0] + solid2.center[0], f.center[1] + solid2.center[1], f.center[2] + solid2.center[2]] });
22000
+ }
22001
+ });
22002
+ return out;
22003
+ };
22004
+ var planBox = (inp) => {
21968
22005
  const { style, dims, rnd: rnd2, maxFragments } = inp;
21969
22006
  const [fmin, fmax] = inp.fragmentSize;
21970
22007
  const mean = (fmin + fmax) / 2;
@@ -21977,9 +22014,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21977
22014
  if (style === "snap") {
21978
22015
  if (inp.cut) return severAt(inp, root, inp.cut.at, inp.cut.gap);
21979
22016
  if (inp.form === "plies") return plyBreak(inp, root, maxFragments);
21980
- const n2 = Math.min(maxFragments, 2 + Math.floor(rnd2() * 3));
21981
- const slabs = inp.form === "granules" && dims[t] < Math.min(dims[u], dims[v]) / 4 ? splitAtHit(root, inp.hit, [u, v], n2, rnd2) : bsp(root, n2, [0, 1, 2], rnd2);
21982
- for (const b of slabs) out.push({ center: b.c, size: b.s, q: idq, shape: "slab", weight: b.s[0] * b.s[1] * b.s[2] });
22017
+ const thinBoard = dims[t] < Math.min(dims[u], dims[v]) / 4;
22018
+ if (thinBoard && inp.form !== "slivers") {
22019
+ const crumbled = inp.form === "granules" ? CRUMBS : 0;
22020
+ const plates = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 6, Math.max(6, maxFragments - crumbled));
22021
+ for (const f of radialPlates(inp, root, { t, u, v }, plates, dims[t], fmax * 1.5, true)) out.push({ ...f, weight: f.size[0] * f.size[1] * dims[t] });
22022
+ } else {
22023
+ const n2 = Math.min(maxFragments, 2 + Math.floor(rnd2() * 3));
22024
+ for (const b of bsp(root, n2, [0, 1, 2], rnd2)) out.push({ center: b.c, size: b.s, q: idq, shape: "slab", weight: b.s[0] * b.s[1] * b.s[2] });
22025
+ }
21983
22026
  if (inp.form !== "granules") return out;
21984
22027
  const crumbs = Math.min(CRUMBS, maxFragments - out.length);
21985
22028
  if (crumbs <= 0) return out;
@@ -22002,44 +22045,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
22002
22045
  return out;
22003
22046
  }
22004
22047
  if (style === "tear") {
22048
+ if (inp.form === "granules") return granules(inp, root, clamp(Math.ceil(dims[0] * dims[1] * dims[2] / (mean * mean * mean)), 3, maxFragments));
22005
22049
  const n2 = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 3, maxFragments);
22006
22050
  const sheet = inp.sheet ?? 0;
22007
22051
  if (sheet > 0 && dims[t] > sheet * 4) return tearStack(inp, root, t, u, v, n2, sheet);
22008
- const th2 = Math.min(inp.thickness, dims[t]);
22052
+ const th = Math.min(inp.thickness, dims[t]);
22009
22053
  for (const b of bsp(root, n2, [u, v], rnd2)) {
22010
- 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] });
22054
+ out.push({ center: [b.c[0], b.c[1], b.c[2]], size: [b.s[u], b.s[v], th], q: frame(u, v, t), shape: "scrap", weight: b.s[u] * b.s[v] });
22011
22055
  }
22012
22056
  return out;
22013
22057
  }
22014
- const th = Math.min(inp.thickness, dims[t]);
22015
- const Hu = dims[u] / 2, Hv = dims[v] / 2;
22016
- const hu = clamp(inp.hit[u], -Hu * 0.95, Hu * 0.95);
22017
- const hv = clamp(inp.hit[v], -Hv * 0.95, Hv * 0.95);
22018
- const R = Math.max(Math.hypot(Hu + Math.abs(hu), Hv + Math.abs(hv)), 0.02);
22019
22058
  const n = clamp(Math.round(dims[u] * dims[v] / (mean * mean)), 6, maxFragments);
22020
- const sectors = clamp(Math.round(Math.sqrt(n * 1.6)), 5, 10);
22021
- const rings = Math.max(1, Math.ceil(n / sectors));
22022
- const radii = [];
22023
- for (let k = 0; k <= rings; k++) radii.push(R * Math.pow(k / rings, 1.3));
22024
- const cap = fmax * 1.5;
22025
- for (let j = 0; j < sectors && out.length < maxFragments; j++) {
22026
- const theta = (j + (rnd2() - 0.5) * 0.4) * (Math.PI * 2 / sectors);
22027
- for (let k = 0; k < rings && out.length < maxFragments; k++) {
22028
- const rm = (radii[k] + radii[k + 1]) / 2;
22029
- const cu = hu + rm * Math.cos(theta);
22030
- const cv = hv + rm * Math.sin(theta);
22031
- if (Math.abs(cu) > Hu + 0.01 || Math.abs(cv) > Hv + 0.01) continue;
22032
- const radial = clamp(radii[k + 1] - radii[k], 0.01, cap);
22033
- const tang = clamp(radii[k + 1] * (Math.PI * 2 / sectors) * 0.9, 0.01, cap);
22034
- const c = [0, 0, 0];
22035
- c[u] = clamp(cu, -Hu * 0.98, Hu * 0.98);
22036
- c[v] = clamp(cv, -Hv * 0.98, Hv * 0.98);
22037
- c[t] = 0;
22038
- out.push({ center: c, size: [radial, tang, th], q: frame(u, v, t, theta), shape: "shard", weight: radial * tang });
22039
- }
22040
- }
22041
- if (out.length === 0) out.push({ center: [0, 0, 0], size: [dims[u], dims[v], th], q: frame(u, v, t), shape: "shard", weight: 1 });
22042
- return out;
22059
+ return radialPlates(inp, root, { t, u, v }, n, Math.min(inp.thickness, dims[t]), fmax * 1.5);
22043
22060
  };
22044
22061
  var planeAxes = (thin) => thin === 1 ? [0, 2] : [thin === 0 ? 2 : 0, 1];
22045
22062
  var unitGrid = (dims, thin, units, cap) => {
@@ -24144,6 +24161,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
24144
24161
  penetration: 0.5,
24145
24162
  ductility: 0.7,
24146
24163
  fracture: "tear",
24164
+ splitForm: "granules",
24147
24165
  fragmentSize: [
24148
24166
  0.03,
24149
24167
  0.15
@@ -28428,7 +28446,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28428
28446
  rnd: planRnd,
28429
28447
  sheet: p.mat.sheet,
28430
28448
  ...p.mat.splitForm ? { form: p.mat.splitForm } : {},
28431
- ...cutAt2 !== void 0 ? { cut: { at: cutAt2, gap: SEVER_BAND } } : {}
28449
+ ...cutAt2 !== void 0 ? { cut: { at: cutAt2, gap: SEVER_BAND } } : {},
28450
+ ...p.spec.solids ? { solids: p.spec.solids } : {}
28432
28451
  });
28433
28452
  const holes = p.st.holes.length > 0 ? localHolesOf(p) : [];
28434
28453
  const mass = p.st.mass;
@@ -52293,6 +52312,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52293
52312
  var bin = { body: { material: "plastic", joint: "fused" }, parts: [["lid", door("plastic", "hinge", "lid")]] };
52294
52313
  var upholstery = { material: "fabric", joint: "glue" };
52295
52314
  var POLE_CAGE = { material: "steel", spacing: 0.1, diameter: 0.01 };
52315
+ var BRICKWORK = { size: [0.23, 0.075, 0.11], bond: "running", mortar: "mortar" };
52296
52316
  var DESTRUCTION = {
52297
52317
  fridge: fridgeLike,
52298
52318
  fridge_compact: fridgeLike,
@@ -52348,13 +52368,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52348
52368
  parts: [["flap", door("steel", "hinge", "flap")], ["flag", { material: "steel", joint: "hinge", piece: "flag" }]]
52349
52369
  },
52350
52370
  dog_house: { body: { material: "plywood", joint: "nail" }, parts: [] },
52351
- bbq: { body: { material: "brick", joint: "mortar" }, parts: [["counter_door", door("steel")]] },
52371
+ bbq: { body: { material: "brick", joint: "mortar", units: BRICKWORK }, parts: [["counter_door", door("steel")]] },
52352
52372
  bunk_bed: { body: { material: "wood_soft", joint: "screw" }, parts: [] },
52353
52373
  wood_stove: {
52354
52374
  body: { material: "cast_iron", joint: "bolt" },
52355
52375
  parts: [["firebox_door", { material: "cast_iron", joint: "hinge", piece: "door" }]]
52356
52376
  },
52357
- fireplace: { body: { material: "brick", joint: "mortar" }, parts: [] },
52377
+ fireplace: { body: { material: "brick", joint: "mortar", units: BRICKWORK }, parts: [] },
52358
52378
  outhouse: {
52359
52379
  body: { material: "wood_soft", joint: "nail" },
52360
52380
  parts: [["door", door("wood_soft", "hinge", "door")], ["seat_lid", door("wood_soft", "hinge", "lid")]]
@@ -52468,6 +52488,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52468
52488
  "prompt.glass_door.open": "Close the glass door",
52469
52489
  "prompt.glass_door.closed": "Open the glass door",
52470
52490
  "prompt.flush": "Flush",
52491
+ "prompt.flush.off": "Flush",
52492
+ "prompt.flush.on": "Flushing",
52493
+ "program.wash": "Wash",
52494
+ "program.dry": "Spin-dry",
52495
+ "use.grill": "Put {item} on the grill",
52471
52496
  "prompt.toilet_lid": "Toilet lid",
52472
52497
  "prompt.toilet_lid.open": "Close the lid",
52473
52498
  "prompt.toilet_lid.closed": "Lift the lid",
@@ -52711,6 +52736,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
52711
52736
  "prompt.glass_door.open": "Fechar a porta de vidro",
52712
52737
  "prompt.glass_door.closed": "Abrir a porta de vidro",
52713
52738
  "prompt.flush": "Descarga",
52739
+ "prompt.flush.off": "Dar a descarga",
52740
+ "prompt.flush.on": "Descarga correndo",
52741
+ "program.wash": "Lavar",
52742
+ "program.dry": "Secar",
52743
+ "use.grill": "P\xF4r {item} na grelha",
52714
52744
  "prompt.toilet_lid": "Tampa do vaso",
52715
52745
  "prompt.toilet_lid.open": "Fechar a tampa",
52716
52746
  "prompt.toilet_lid.closed": "Levantar a tampa",
@@ -53338,7 +53368,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
53338
53368
  h: 1.3,
53339
53369
  y: 0,
53340
53370
  solid: true,
53341
- massKg: 6
53371
+ massKg: 6,
53372
+ fixed: true
53342
53373
  },
53343
53374
  {
53344
53375
  id: "dog_house",