@adatechnology/game-weapons-three 0.29.1 → 0.29.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.
@@ -25010,6 +25010,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25010
25010
  var THIN_SHEET_CRUSH = 5e-4;
25011
25011
  var THIN_SHEET_CONTACT = 0.025;
25012
25012
  var DMG_PER_J = 0.02;
25013
+ var THROW_SPREAD = 0.6;
25013
25014
  var FRAGMENT_RAYS = 256;
25014
25015
  var FRAGMENT_MAX_WEIGHT = 8;
25015
25016
  var SHELTER_DEFAULTS = { k: 2800, brokenTransmission: 0.5, minPath: 5e-3 };
@@ -25053,6 +25054,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
25053
25054
  var MASONRY_CRUMBLE_SPEED = 0.6;
25054
25055
  var MASONRY_TOPPLE = 0.4;
25055
25056
  var MASONRY_TOPPLE_MIN_HEIGHT = 0.5;
25057
+ var SPIN_REACH = 0.1;
25058
+ var bornSpin = (size, chipSpin, rnd2) => {
25059
+ const reach2 = Math.hypot(size[0] ?? 0, size[1] ?? 0, size[2] ?? 0) / 2;
25060
+ const scale = reach2 <= SPIN_REACH ? 1 : SPIN_REACH / reach2;
25061
+ return [(rnd2() - 0.5) * chipSpin * scale, (rnd2() - 0.5) * chipSpin * scale, (rnd2() - 0.5) * chipSpin * scale];
25062
+ };
25056
25063
  var TILE_CLUMPS = 160;
25057
25064
  var TILE_THICKNESS = 0.018;
25058
25065
  var PANEL_EDGE_PILLAR = 2;
@@ -27668,7 +27675,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27668
27675
  size: [cell.size[0], cell.size[1], cell.size[2]],
27669
27676
  rotation: q,
27670
27677
  velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd2(), dv[2] * k],
27671
- angularVelocity: [(rnd2() - 0.5) * 8, (rnd2() - 0.5) * 8, (rnd2() - 0.5) * 8],
27678
+ angularVelocity: bornSpin(cell.size, 8, rnd2),
27672
27679
  mass: mass * faceArea(cell) / total,
27673
27680
  ...marks.length > 0 ? { marks } : {},
27674
27681
  ...inner && laid ? { unit: true } : inner ? { inner } : {}
@@ -27707,7 +27714,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
27707
27714
  size,
27708
27715
  rotation: q,
27709
27716
  velocity: [out0[0] * k, out0[1] * k + 0.5 * rnd2(), out0[2] * k],
27710
- angularVelocity: [(rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12],
27717
+ angularVelocity: bornSpin(size, 12, rnd2),
27711
27718
  mass: layer3.mat.density * size[0] * size[1] * size[2]
27712
27719
  });
27713
27720
  }
@@ -28033,7 +28040,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28033
28040
  size,
28034
28041
  rotation: q,
28035
28042
  velocity: [vdir[0] * k, vdir[1] * k + 0.5 * rnd2(), vdir[2] * k],
28036
- angularVelocity: [(rnd2() - 0.5) * 20, (rnd2() - 0.5) * 20, (rnd2() - 0.5) * 20],
28043
+ angularVelocity: bornSpin(size, 20, rnd2),
28037
28044
  mass: mass / n,
28038
28045
  inner: true
28039
28046
  });
@@ -28380,6 +28387,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28380
28387
  loosened(o, opened, "break", src);
28381
28388
  collapseCheck(o, src);
28382
28389
  };
28390
+ const thrownAlong = (out, dir) => {
28391
+ const across2 = vec.madd(out, dir, -vec.dot(out, dir));
28392
+ return vec.normalize(vec.madd(dir, [across2[0], 0, across2[2]], THROW_SPREAD), dir);
28393
+ };
28383
28394
  const failPart = (o, p, origin, dir, fragEnergy, cap, src, force) => {
28384
28395
  if (isLost(p)) return;
28385
28396
  if (p.st.stripped) {
@@ -28427,7 +28438,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28427
28438
  const fragments = plan.map((f, i) => {
28428
28439
  const cw = toWorld(c, q, f.center);
28429
28440
  const out = vec.normalize(vec.sub(cw, hitW), [0, 1, 0]);
28430
- const dv = dir ? vec.normalize(vec.madd(out, dir, 0.6)) : out;
28441
+ const dv = dir ? thrownAlong(out, dir) : out;
28431
28442
  const k = speed * (0.6 + 0.8 * rnd2());
28432
28443
  const marks = marksInBox(f.center, f.size, f.q, holes);
28433
28444
  return {
@@ -28439,7 +28450,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28439
28450
  size: f.size,
28440
28451
  rotation: quat.mul(q, f.q),
28441
28452
  velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd2(), dv[2] * k],
28442
- angularVelocity: [(rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12, (rnd2() - 0.5) * 12],
28453
+ angularVelocity: bornSpin(f.size, 12, rnd2),
28443
28454
  mass: mass * f.weight / totW,
28444
28455
  ...marks.length > 0 ? { marks } : {},
28445
28456
  ...f.inner ? { inner: true } : {}
@@ -28578,7 +28589,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
28578
28589
  rotation: q,
28579
28590
  velocity: v,
28580
28591
  inner: true,
28581
- angularVelocity: [(rnd2() - 0.5) * 30, (rnd2() - 0.5) * 30, (rnd2() - 0.5) * 30],
28592
+ angularVelocity: bornSpin(size, 30, rnd2),
28582
28593
  mass
28583
28594
  });
28584
28595
  }
@@ -56086,7 +56097,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
56086
56097
  }
56087
56098
  var residentialTower = residentialTowerTemplate();
56088
56099
 
56089
- // ../game-floorplan-three/dist/chunk-Z3IBCX7E.js
56100
+ // ../game-floorplan-three/dist/chunk-OGYLJ4F7.js
56090
56101
  var __defProp4 = Object.defineProperty;
56091
56102
  var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
56092
56103
  var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
@@ -94884,7 +94895,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
94884
94895
  ...DEBRIS_EFFECT_FAMILIES.flatMap((family) => [stageCrack(family), breachDust(family), collapseDust(family)]),
94885
94896
  REBAR_EXPOSE
94886
94897
  ];
94887
- var FACING5 = [0, 0, 1];
94888
94898
  var ORIGIN2 = [0, 0, 0];
94889
94899
  var FORWARD4 = [0, 0, -1];
94890
94900
  var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
@@ -94894,7 +94904,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
94894
94904
  team: "weapons",
94895
94905
  budget: { particles: 40, decals: 1 },
94896
94906
  loop: 2,
94897
- timeline: [call2("impact", material, ORIGIN2, FACING5, 1, 0)]
94907
+ timeline: [call2("impact", material, ORIGIN2, NORMAL, 1, 0)]
94898
94908
  });
94899
94909
  var muzzleEffect = (weapon2) => ({
94900
94910
  id: `muzzle_${weapon2}`,
@@ -98600,7 +98610,6 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
98600
98610
  var FIRE_FLICKER_SWAY = 0.25;
98601
98611
  var FIRE_FLICKER_JITTER = 0.08;
98602
98612
  var LENS_FADE = 0.16;
98603
- var FLOOR_NORMAL_Y = 0.9;
98604
98613
  function rotate2(q, v) {
98605
98614
  const [qx, qy, qz, qw] = q;
98606
98615
  const ix = qw * v[0] + qy * v[2] - qz * v[1];
@@ -98737,7 +98746,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
98737
98746
  const [x, y, z] = this.place([recipe2[0], recipe2[1], recipe2[2]]);
98738
98747
  const options = recipe2[5];
98739
98748
  const normal = options?.n ? this.turn(options.n) : void 0;
98740
- const onFloor = !normal || normal[1] > FLOOR_NORMAL_Y;
98749
+ const onFloor = !normal;
98741
98750
  args = [x, onFloor ? this.context.groundAt(x, z) : y, z, recipe2[3], recipe2[4], normal ? { ...options, n: normal } : options];
98742
98751
  }
98743
98752
  this.context.trace?.("decal", args);