@adatechnology/game-characters-three 0.9.0 → 0.9.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.
@@ -1586,25 +1586,30 @@ var GameCharactersThree = (() => {
1586
1586
  };
1587
1587
 
1588
1588
  // ../game-contracts/dist/index.js
1589
- var DEFAULT_BLAST_SHOVE = { coupling: 0.02, maxSpeed: 20, lift: 0.3, minSpeed: 0.3, falloffPower: 2 };
1590
- function blastShove(blast2, target, options = {}) {
1591
- const o = { ...DEFAULT_BLAST_SHOVE, ...options };
1592
- const dx = target.position[0] - blast2.point[0];
1593
- const dy = target.position[1] - blast2.point[1];
1594
- const dz = target.position[2] - blast2.point[2];
1595
- const distance3 = Math.hypot(dx, dy, dz);
1596
- if (!(blast2.radius > 0) || distance3 > blast2.radius) return void 0;
1597
- const falloff = (1 - distance3 / blast2.radius) ** o.falloffPower;
1598
- const mass = Math.max(target.mass, 0.05);
1599
- const speed = Math.min(o.maxSpeed, Math.sqrt(2 * blast2.energy * (blast2.reach ?? 1) * o.coupling / mass)) * falloff;
1600
- if (!(speed >= o.minSpeed)) return void 0;
1601
- const direction = distance3 > 1e-4 ? [dx / distance3, dy / distance3 + o.lift, dz / distance3] : [0, 1, 0];
1602
- const length = Math.hypot(direction[0], direction[1], direction[2]);
1603
- return { speed, direction: [direction[0] / length, direction[1] / length, direction[2] / length], distance: distance3, falloff };
1589
+ var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
1590
+ var NEAREST = 0.3;
1591
+ function sideOnImpulse(tnt, distance3) {
1592
+ if (!(tnt > 0)) return 0;
1593
+ const w3 = Math.cbrt(tnt);
1594
+ const z = Math.max(distance3, NEAREST) / w3;
1595
+ const scaled = 0.067 * Math.sqrt(1 + (z / 0.23) ** 4) / (z * z * Math.cbrt(1 + (z / 1.55) ** 3));
1596
+ return scaled * w3 * 100;
1597
+ }
1598
+ function bodyImpulse(tnt, distance3) {
1599
+ if (!(tnt > 0)) return 0;
1600
+ const z = Math.max(distance3, NEAREST) / Math.cbrt(tnt);
1601
+ return sideOnImpulse(tnt, distance3) * (2 + 4 / (1 + z * z));
1602
+ }
1603
+ function blastBodySpeed(tnt, distance3, mass, reach = 1, options = {}) {
1604
+ const area3 = options.bodyArea ?? DEFAULT_BLAST_IMPULSE.bodyArea;
1605
+ return bodyImpulse(tnt, distance3) * area3 * Math.max(0, reach) / Math.max(mass, 1);
1604
1606
  }
1605
1607
  var KNOCK_DOWN_SPEED = 2.5;
1606
1608
  var KNOCKED_DOWN_ANGLE = 1.35;
1607
1609
  var LIE_SECONDS = 1.6;
1610
+ var WOUNDED_LIE_SECONDS = 6;
1611
+ var FRAGMENT_COVER = 0.5;
1612
+ var STUN_SECONDS = 4;
1608
1613
  var STAND_UP_PER_SPEED = 0.25;
1609
1614
  var FALL_SECONDS = 0.25;
1610
1615
  var RISE_SECONDS = 0.6;
@@ -1613,11 +1618,38 @@ var GameCharactersThree = (() => {
1613
1618
  var KNOCK_CHEST = 1.1;
1614
1619
  var CHEST = KNOCK_CHEST;
1615
1620
  var bodyMass = (height, build = 1) => 70 * (height / 1.75) ** 2 * build;
1616
- function knockOf(blast2, feet, mass, options) {
1617
- const hit = blastShove(blast2, { position: [feet[0], feet[1] + CHEST, feet[2]], mass }, options);
1618
- if (!hit) return void 0;
1619
- const [dx, dy, dz] = hit.direction;
1620
- return { velocity: [dx * hit.speed, Math.max(0, dy * hit.speed), dz * hit.speed], airborne: dy > 0, lying: 0, lieLeft: 0, down: hit.speed >= KNOCK_DOWN_SPEED };
1621
+ function knockOf(blast2, feet, mass, options, impulse = {}) {
1622
+ const o = { ...DEFAULT_BLAST_IMPULSE, ...impulse };
1623
+ const chest = [feet[0], feet[1] + CHEST, feet[2]];
1624
+ const dx = chest[0] - blast2.point[0];
1625
+ const dy = chest[1] - blast2.point[1];
1626
+ const dz = chest[2] - blast2.point[2];
1627
+ const distance3 = Math.hypot(dx, dy, dz);
1628
+ if (!(blast2.radius > 0) || distance3 > blast2.radius) return void 0;
1629
+ const reach = Math.max(0, Math.min(1, blast2.reach ?? 1));
1630
+ const tnt = blast2.tnt ?? blast2.energy * o.tntPerJoule;
1631
+ let speed = blastBodySpeed(tnt, distance3, mass, reach, o);
1632
+ const minSpeed = impulse.minSpeed ?? options?.minSpeed ?? o.minSpeed;
1633
+ if (speed < minSpeed) speed = 0;
1634
+ const struck = reach >= FRAGMENT_COVER;
1635
+ const wounded = struck && blast2.lethalRadius !== void 0 && distance3 <= blast2.lethalRadius;
1636
+ const edge = 1 - distance3 / blast2.radius;
1637
+ const stunSeconds = struck ? STUN_SECONDS * edge * edge * reach : 0;
1638
+ if (speed === 0 && !wounded && stunSeconds < 0.25) return void 0;
1639
+ const horizontal = Math.hypot(dx, dz);
1640
+ const away = horizontal > 1e-4 ? [dx / horizontal, o.lift, dz / horizontal] : [0, 1, 0];
1641
+ const length = Math.hypot(away[0], away[1], away[2]);
1642
+ const velocity = [away[0] / length * speed, away[1] / length * speed, away[2] / length * speed];
1643
+ return {
1644
+ velocity,
1645
+ airborne: velocity[1] > 0.5,
1646
+ lying: 0,
1647
+ lieLeft: wounded ? WOUNDED_LIE_SECONDS : 0,
1648
+ away: horizontal > 1e-4 ? [dx / horizontal, 0, dz / horizontal] : [0, 0, 0],
1649
+ down: speed >= KNOCK_DOWN_SPEED || wounded,
1650
+ ...wounded ? { wounded } : {},
1651
+ ...stunSeconds >= 0.25 ? { stunSeconds } : {}
1652
+ };
1621
1653
  }
1622
1654
  function stepKnock(knock2, position, dt, groundAt, alive) {
1623
1655
  const v = knock2.velocity;
@@ -1641,14 +1673,11 @@ var GameCharactersThree = (() => {
1641
1673
  }
1642
1674
  const moving = horizontal > 0.05 || knock2.airborne;
1643
1675
  if (knock2.down) {
1644
- if (moving) knock2.lying = Math.min(1, knock2.lying + dt / FALL_SECONDS);
1645
- else {
1646
- knock2.lying = 1;
1647
- if (alive) {
1648
- knock2.lieLeft = knock2.lieLeft > 0 ? knock2.lieLeft : LIE_SECONDS + Math.hypot(v[0], v[2]) * STAND_UP_PER_SPEED;
1649
- knock2.lieLeft -= dt;
1650
- if (knock2.lieLeft <= 0) knock2.down = false;
1651
- }
1676
+ if (moving || knock2.lying < 1) knock2.lying = Math.min(1, knock2.lying + dt / FALL_SECONDS);
1677
+ else if (alive) {
1678
+ knock2.lieLeft = knock2.lieLeft > 0 ? knock2.lieLeft : LIE_SECONDS + Math.hypot(v[0], v[2]) * STAND_UP_PER_SPEED;
1679
+ knock2.lieLeft -= dt;
1680
+ if (knock2.lieLeft <= 0) knock2.down = false;
1652
1681
  }
1653
1682
  } else if (knock2.lying > 0) knock2.lying = Math.max(0, knock2.lying - dt / RISE_SECONDS);
1654
1683
  return !moving && !knock2.down && knock2.lying === 0;
@@ -8539,7 +8568,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8539
8568
  };
8540
8569
  };
8541
8570
 
8542
- // ../game-audio/dist/chunk-7TLFY7VO.js
8571
+ // ../game-audio/dist/chunk-KBTUANNG.js
8543
8572
  var DISTANCE_CURVES = {
8544
8573
  /** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
8545
8574
  game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
@@ -8752,7 +8781,11 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8752
8781
  ["casing_drop_terra_pistol", 1],
8753
8782
  ["casing_drop_terra_rifle", 1],
8754
8783
  ["casing_drop_terra_shell", 1],
8755
- ["rocket_fire", 2]
8784
+ ["rocket_fire", 2],
8785
+ ["smg_45_auto", 2, "sfx_pistol"],
8786
+ ["weapon_draw", 2],
8787
+ ["suppressor_attach", 3],
8788
+ ["suppressor_detach", 3]
8756
8789
  ]),
8757
8790
  ...entries("explosoes-fogo", [
8758
8791
  ["explosion_grenade", 1, "boom"],
@@ -8766,7 +8799,11 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8766
8799
  ["fire_loop_large", 1],
8767
8800
  ["fire_extinguish", 2, "hiss"],
8768
8801
  ["gas_leak_hiss", 2],
8769
- ["structure_collapse", 2, "crumble"]
8802
+ ["structure_collapse", 2, "crumble"],
8803
+ ["grenade_bounce", 1],
8804
+ ["c4_plant", 2],
8805
+ ["c4_beep", 2],
8806
+ ["c4_disarm", 2]
8770
8807
  ]),
8771
8808
  ...entries("personagem", [
8772
8809
  ["footstep_concrete_walk", 1, "sfx_step"],
@@ -8782,7 +8819,19 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8782
8819
  ["blunt_hit", 1],
8783
8820
  ["bite", 1, "sfx_flesh"],
8784
8821
  ["body_fall", 1],
8785
- ["player_hurt", 2]
8822
+ ["player_hurt", 2],
8823
+ ["footstep_tile_walk", 1, "sfx_step"],
8824
+ ["footstep_water_walk", 1, "sfx_step"],
8825
+ ["footstep_grate_walk", 2, "sfx_step"],
8826
+ ["footstep_duct_walk", 3, "sfx_step"],
8827
+ ["ladder_climb", 2],
8828
+ ["swim", 2],
8829
+ ["zombie_groan", 1],
8830
+ ["zombie_alert", 1],
8831
+ ["zombie_attack", 1],
8832
+ ["zombie_pain", 1],
8833
+ ["zombie_claw_hit", 1, "sfx_flesh"],
8834
+ ["zombie_claw_miss", 2]
8786
8835
  ]),
8787
8836
  ...entries("veiculos", [
8788
8837
  ["engine_loop_car", 1],
@@ -8810,7 +8859,8 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8810
8859
  ["wind_loop", 2],
8811
8860
  ["thunder_near", 2],
8812
8861
  ["thunder_far", 2],
8813
- ["water_splash", 2]
8862
+ ["water_splash", 2],
8863
+ ["helicopter_loop", 3]
8814
8864
  ])
8815
8865
  ];
8816
8866
  var SFX_MATERIALS = [
@@ -8899,6 +8949,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8899
8949
  category: "1 \xB7 Categoria",
8900
8950
  sound: "1 \xB7 Som",
8901
8951
  play: "1 \xB7 \u25B6 Tocar",
8952
+ play_user: "1 \xB7 \u25B6 Tocar o seu",
8902
8953
  material: "2 \xB7 Material",
8903
8954
  blow: "2 \xB7 Golpe",
8904
8955
  strike: "2 \xB7 \u25B6 Tocar golpe",
@@ -8920,6 +8971,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8920
8971
  approve: "5 \xB7 Aprovo (C10)"
8921
8972
  },
8922
8973
  hints: {
8974
+ play_user: "Toca a sua grava\xE7\xE3o deste som (dos seus pacotes, fora do git), mesmo quando o SDK tem uma melhor e toca na frente.",
8923
8975
  sound: "A = arquivo, S = sintetizado, F = faltando. O que tem arquivo toca o arquivo; o resto toca o som atual.",
8924
8976
  strike: "Toca impact_<material>_<golpe>: o arquivo se existir, sen\xE3o o som atual daquele material.",
8925
8977
  wall: "P\xF5e a parede de casa entre voc\xEA e a fonte: o som fica abafado (C4).",
@@ -8964,9 +9016,10 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8964
9016
  strengths: { light: "leve", medium: "m\xE9dio", heavy: "forte" },
8965
9017
  states: { file: "A", synth: "S", missing: "F" },
8966
9018
  criteria: { C1: "C1 Sincronia", C2: "C2 Certo p/ a\xE7\xE3o", C3: "C3 Dist\xE2ncia", C4: "C4 Posi\xE7\xE3o", C5: "C5 Varia\xE7\xE3o", C6: "C6 Volume", C7: "C7 Intensidade", C8: "C8 Cauda", C9: "C9 Rajada", C10: "C10 Escuta" },
8967
- metrics: { chosen: "1 \xB7 Escolhido", matrix: "2 \xB7 Matriz", last: "\xDAltimo tocado", ab: "4 \xB7 A \xD7 B", blind: "4 \xB7 X", verdicts: "4 \xB7 Prefer\xEAncias", state: "5 \xB7 Medi\xE7\xE3o", count: "1 \xB7 Cat\xE1logo" },
9019
+ metrics: { source: "1 \xB7 Fonte do que tocou", chosen: "1 \xB7 Escolhido", matrix: "2 \xB7 Matriz", last: "\xDAltimo tocado", ab: "4 \xB7 A \xD7 B", blind: "4 \xB7 X", verdicts: "4 \xB7 Prefer\xEAncias", state: "5 \xB7 Medi\xE7\xE3o", count: "1 \xB7 Cat\xE1logo" },
8968
9020
  run: { idle: "parada", measuring: "medindo\u2026", done: "pronta", failed: "falhou", recording: "gravando\u2026", recorded: "grava\xE7\xE3o baixada" },
8969
9021
  words: { none: "\u2014", hidden: "? (revele)", prefers: "prefere", approved: "aprovado pelo dono" },
9022
+ sources: { sdk: "SDK", user: "seu som", synth: "sintetizado" },
8970
9023
  probe: "Fonte do som",
8971
9024
  wall: "Parede (oclus\xE3o)",
8972
9025
  scenarios: { pipeline: "Arquivo \u2192 decodifica \u2192 toca (round-robin, cauda)", criteria: "Crit\xE9rios C1\u2013C9 no som de calibra\xE7\xE3o", loop: "Loop de arquivo: emenda sem buraco (crossfade)", panel: "Painel: categorias, matriz, A/B e parede" }
@@ -8979,6 +9032,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8979
9032
  category: "1 \xB7 Category",
8980
9033
  sound: "1 \xB7 Sound",
8981
9034
  play: "1 \xB7 \u25B6 Play",
9035
+ play_user: "1 \xB7 \u25B6 Play yours",
8982
9036
  material: "2 \xB7 Material",
8983
9037
  blow: "2 \xB7 Blow",
8984
9038
  strike: "2 \xB7 \u25B6 Play blow",
@@ -9000,6 +9054,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
9000
9054
  approve: "5 \xB7 Approve (C10)"
9001
9055
  },
9002
9056
  hints: {
9057
+ play_user: "Plays your own take of this sound (from your packs, kept out of git), even where the SDK has a better one that plays first.",
9003
9058
  sound: "A = file, S = synthesized, F = missing. A file plays the file; the rest plays the current sound.",
9004
9059
  strike: "Plays impact_<material>_<blow>: the file if there is one, else the current sound of that material.",
9005
9060
  wall: "Puts the house wall between you and the source: the sound is muffled (C4).",
@@ -9034,9 +9089,10 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
9034
9089
  environments: { indoor: "indoor", outdoor: "outdoor" },
9035
9090
  strengths: { light: "light", medium: "medium", heavy: "heavy" },
9036
9091
  criteria: { C1: "C1 Sync", C2: "C2 Right sound", C3: "C3 Distance", C4: "C4 Position", C5: "C5 Variation", C6: "C6 Level", C7: "C7 Strength", C8: "C8 Tail", C9: "C9 Burst", C10: "C10 Listening" },
9037
- metrics: { chosen: "1 \xB7 Chosen", matrix: "2 \xB7 Matrix", last: "Last played", ab: "4 \xB7 A \xD7 B", blind: "4 \xB7 X", verdicts: "4 \xB7 Preferences", state: "5 \xB7 Measurement", count: "1 \xB7 Catalogue" },
9092
+ metrics: { source: "1 \xB7 Source of what played", chosen: "1 \xB7 Chosen", matrix: "2 \xB7 Matrix", last: "Last played", ab: "4 \xB7 A \xD7 B", blind: "4 \xB7 X", verdicts: "4 \xB7 Preferences", state: "5 \xB7 Measurement", count: "1 \xB7 Catalogue" },
9038
9093
  run: { idle: "idle", measuring: "measuring\u2026", done: "done", failed: "failed", recording: "recording\u2026", recorded: "recording downloaded" },
9039
9094
  words: { none: "\u2014", hidden: "? (reveal)", prefers: "prefers", approved: "approved by the owner" },
9095
+ sources: { sdk: "SDK", user: "your sound", synth: "synthesized" },
9040
9096
  probe: "Sound source",
9041
9097
  wall: "Wall (occlusion)",
9042
9098
  scenarios: { pipeline: "File \u2192 decode \u2192 play (round-robin, tail)", criteria: "Criteria C1\u2013C9 on the calibration sound", loop: "File loop: seamless joins (crossfade)", panel: "Panel: categories, matrix, A/B and wall" }