@adatechnology/game-weapons-three 0.13.1 → 0.14.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.
@@ -9408,7 +9408,7 @@ var explosivePart = (def, shape, scale) => ({
9408
9408
  // a real mass (the vessel and what it holds) replaces the hollow-sheet density
9409
9409
  ...def.mass !== void 0 && shape.wall !== void 0 ? { mass: def.mass } : {},
9410
9410
  ...def.leak ? { contains: { fluid: def.leak.fluid, liters: def.leak.liters, pressurized: def.leak.pressurized } } : {},
9411
- explodes: { energy: def.energy * scale, radius: def.injuryRadius * scale, lethalRadius: def.lethalRadius * scale, effect: def.id, ...def.chain ? { chain: { ...def.chain } } : {} }
9411
+ explodes: { energy: def.energy * scale, radius: def.injuryRadius * scale, lethalRadius: def.lethalRadius * scale, effect: def.id, ...def.tnt !== void 0 ? { tnt: def.tnt * scale } : {}, ...def.chain ? { chain: { ...def.chain } } : {} }
9412
9412
  });
9413
9413
  var meshOf = (THREE, shape) => {
9414
9414
  const geometry = shape.shape.kind === "cylinder" ? new THREE.CylinderGeometry(shape.shape.radius, shape.shape.radius, shape.shape.height, 16) : shape.shape.kind === "box" ? new THREE.BoxGeometry(...shape.shape.size) : new THREE.SphereGeometry(0.2);
@@ -10087,7 +10087,7 @@ var EXPLOSIVES_TEXT = {
10087
10087
  push_found: "{n} bodies were laid around the blast to be measured ({kinds})",
10088
10088
  push_outward: "Every body inside the reach moved away from the blast ({moved} of {n}, {least} m at the least)",
10089
10089
  push_falloff: "{what}: the nearer one moved more than the farther one ({near} m at {nearDistance} m, {far} m at {farDistance} m)",
10090
- push_person: "{who} at {distance} m was pushed {moved} m away",
10090
+ push_person_wave: "{who} at {distance} m moved {moved} m away, no farther than the blast wave pushes a person ({most} m at most)",
10091
10091
  push_sheltered: "{what} at {distance} m stood behind cover ({cover}% of the blast got through) and moved only {moved} m",
10092
10092
  push_heavy: "{what} (too heavy to grab, not fixed) was moved {moved} m by the blast"
10093
10093
  }
@@ -10173,7 +10173,7 @@ var EXPLOSIVES_TEXT = {
10173
10173
  push_found: "{n} corpos foram postos em volta da explos\xE3o para serem medidos ({kinds})",
10174
10174
  push_outward: "Todo corpo dentro do alcance se afastou da explos\xE3o ({moved} de {n}, no m\xEDnimo {least} m)",
10175
10175
  push_falloff: "{what}: o mais perto andou mais que o mais longe ({near} m a {nearDistance} m, {far} m a {farDistance} m)",
10176
- push_person: "{who} a {distance} m foi empurrado {moved} m para longe",
10176
+ push_person_wave: "{who} a {distance} m se afastou {moved} m, n\xE3o mais do que a onda da explos\xE3o empurra uma pessoa (no m\xE1ximo {most} m)",
10177
10177
  push_sheltered: "{what} a {distance} m estava atr\xE1s de cobertura ({cover}% da explos\xE3o passou) e andou s\xF3 {moved} m",
10178
10178
  push_heavy: "{what} (pesado demais para pegar, mas solto) foi movido {moved} m pela explos\xE3o"
10179
10179
  }
@@ -10673,7 +10673,7 @@ function createExplosivesBench(options) {
10673
10673
  }
10674
10674
  offs.push(
10675
10675
  lent.on((event) => {
10676
- if (event.type === "explosion") lastBlast = { point: event.point, energy: event.energy, radius: event.radius, cause: event.cause, ...event.explosive === void 0 ? {} : { explosive: event.explosive } };
10676
+ if (event.type === "explosion") lastBlast = { point: event.point, energy: event.energy, radius: event.radius, cause: event.cause, ...event.explosive === void 0 ? {} : { explosive: event.explosive }, ...event.tnt === void 0 ? {} : { tnt: event.tnt } };
10677
10677
  })
10678
10678
  );
10679
10679
  offs.push(lent.onFrame(frame));
@@ -10710,6 +10710,7 @@ function createExplosivesBench(options) {
10710
10710
  }
10711
10711
 
10712
10712
  // src/test-area/explosives-scenarios.ts
10713
+ import { blastBodySpeed, DEFAULT_BLAST_IMPULSE } from "@adatechnology/game-contracts";
10713
10714
  var TORCH_WINDOW = [0.7, 1];
10714
10715
  var BLAST_WITHIN = 1.6;
10715
10716
  var CYLINDER_ITEM = `${WORLD_EXPLOSIVE_PREFIX}propane_p13`;
@@ -10725,6 +10726,9 @@ var SHELTERED_MOST = 1;
10725
10726
  var CHEST = 1.1;
10726
10727
  var MIDDLE = 0.3;
10727
10728
  var HEAVY_ITEMS = ["camp_table"];
10729
+ var PERSON_MASS = 70;
10730
+ var GROUND_FRICTION = 7;
10731
+ var PERSON_SLACK = 0.4;
10728
10732
  var flat = (a, b) => Math.hypot(a[0] - b[0], a[2] - b[2]);
10729
10733
  var bearing = (centre, distance, degrees) => [centre[0] + Math.sin(degrees * Math.PI / 180) * distance, 0, centre[2] + Math.cos(degrees * Math.PI / 180) * distance];
10730
10734
  var PUSH_LAYOUT = {
@@ -10818,7 +10822,8 @@ function pushScenario(all, bench, mode) {
10818
10822
  for (const row of sheltered) {
10819
10823
  expect(row.outward < SHELTERED_MOST, fillText2(text.push_sheltered, { what: things[row.kind] ?? row.kind, distance: row.distance.toFixed(1), cover: (row.cover * 100).toFixed(0), moved: Math.max(0, row.outward).toFixed(2) }), { row: { kind: row.kind, distance: row.distance, outward: row.outward, cover: row.cover } });
10820
10824
  }
10821
- const reached = inReach.filter((row) => row.cover >= SHELTERED);
10825
+ const isPerson = (row) => row.kind === "survivor" || row.kind === "zombie";
10826
+ const reached = inReach.filter((row) => row.cover >= SHELTERED && !isPerson(row));
10822
10827
  const movedAway = reached.filter((row) => row.outward >= MOVED);
10823
10828
  const least = reached.length === 0 ? 0 : Math.min(...reached.map((row) => row.outward));
10824
10829
  expect(reached.length > 0 && movedAway.length === reached.length, fillText2(text.push_outward, { moved: movedAway.length, n: reached.length, least: least.toFixed(2) }), { rows: reached.map((row) => ({ kind: row.kind, distance: row.distance, outward: row.outward })), torn: rows.filter(torn).map((row) => row.objectId) });
@@ -10829,8 +10834,12 @@ function pushScenario(all, bench, mode) {
10829
10834
  const far = ofKind[ofKind.length - 1];
10830
10835
  expect(near.outward > far.outward, fillText2(text.push_falloff, { what: things[kind] ?? kind, near: near.outward.toFixed(2), nearDistance: near.distance.toFixed(1), far: far.outward.toFixed(2), farDistance: far.distance.toFixed(1) }), { near: near.outward, far: far.outward });
10831
10836
  }
10832
- for (const row of reached.filter((entry) => entry.kind === "zombie" || entry.kind === "survivor")) {
10833
- expect(row.outward >= MOVED, fillText2(text.push_person, { who: things[row.kind] ?? row.kind, distance: row.distance.toFixed(1), moved: row.outward.toFixed(2) }), { row: { kind: row.kind, distance: row.distance, outward: row.outward } });
10837
+ for (const row of inReach.filter(isPerson)) {
10838
+ const from = origin.get(row.objectId) ?? row.from;
10839
+ const chest = Math.hypot(from[0] - blast.point[0], from[1] + CHEST - blast.point[1], from[2] - blast.point[2]);
10840
+ const speed = blastBodySpeed(blast.tnt ?? blast.energy * DEFAULT_BLAST_IMPULSE.tntPerJoule, chest, PERSON_MASS, row.cover);
10841
+ const most = speed * speed / (2 * GROUND_FRICTION) + PERSON_SLACK;
10842
+ expect(row.outward <= most, fillText2(text.push_person_wave, { who: things[row.kind] ?? row.kind, distance: row.distance.toFixed(1), moved: Math.max(0, row.outward).toFixed(2), most: most.toFixed(2) }), { row: { kind: row.kind, distance: row.distance, outward: row.outward, speed, most } });
10834
10843
  }
10835
10844
  const table = rows.find((row) => HEAVY_ITEMS.includes(row.kind) && row.distance < blast.radius * 0.85);
10836
10845
  if (table) expect(table.moved >= MOVED, fillText2(text.push_heavy, { what: things[table.itemId] ?? table.itemId, moved: table.moved.toFixed(2) }), { table });
@@ -11057,4 +11066,4 @@ export {
11057
11066
  DEFAULT_EXPLOSIVES_SCENE,
11058
11067
  createExplosivesTestModule
11059
11068
  };
11060
- //# sourceMappingURL=chunk-U4JAJ533.js.map
11069
+ //# sourceMappingURL=chunk-PRC75VKC.js.map