@adatechnology/game-destruction-three 0.15.0 → 0.15.1

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.
package/README.md CHANGED
@@ -104,7 +104,7 @@ loose meshes. An invalid range (outside the geometry or empty) throws from `bind
104
104
  |---|---|---|
105
105
  | `dent` | vertices within `dent.radius` pushed in by `depth * (1 - (d/r)^2)^2` (skipped on `low` for meshes over 20k vertices); sparks on metal | `impact_*` |
106
106
  | `hole` | dark disc decal on the surface (and on the exit side of a through hole); a crack star on transparent materials; sparks on metal | `impact_*` |
107
- | `crack` | star of jagged lines, white on glass, dark otherwise | `impact_*` |
107
+ | `crack` | star of jagged white lines on glass (transparent materials) only; an opaque body draws no lines, its damage shows as chips, holes and dents | `impact_*` |
108
108
  | `ricochet` | sparks along the reflected direction | `ricochet` |
109
109
  | `debris` | a burst of the requested kind (`sparks`, `dust`, `shards`, `splinters`, `chips`, `fibers`, `leaves`, `drips`, `ash`, `smoke`, `steam`) | |
110
110
  | `fracture` | part hidden; fragments (boxes, thin irregular prisms for shards) with gravity, ground bounce, settling, sleep and shrink-away; debris burst by style | `shatter_glass`, `crumble`, `splinter`, `impact_*` |
@@ -13021,7 +13021,6 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
13021
13021
  var rendererCount = 0;
13022
13022
  var COLLAPSE_CLOUD_KG = 1e3;
13023
13023
  var CHIP_DECAL_EDGE = 0.05;
13024
- var OPAQUE_CRACK = 0.1;
13025
13024
  var WOOD_RIM = 1.5;
13026
13025
  var IMPACT_TAGS = ["metal", "glass", "wood"];
13027
13026
  var GLOW_FROM_C = 430;
@@ -13957,14 +13956,11 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
13957
13956
  const pv = b?.parts.get(ev.part);
13958
13957
  if (!b || !pv) return;
13959
13958
  const def = this.world.materials.get(pv.material);
13960
- const wp = new this.THREE.Vector3(ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
13961
- const mv = this.nearestMesh(pv, wp);
13962
- if (mv) {
13963
- const glass2 = !!def?.visual?.transparent;
13964
- const own = this.partColor(pv, def) ?? fallbackColor(pv.material, def);
13965
- const color = glass2 ? 15267071 : new this.THREE.Color(own).multiplyScalar(0.45).getHex();
13966
- const length = glass2 ? ev.crack.length : Math.min(ev.crack.length, OPAQUE_CRACK);
13967
- this.visuals.addCrack(mv, wp, this.worldDir(b, ev.crack.normal), ev.crack.rays, length, color, hashNumbers(ev.time, ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]));
13959
+ if (def?.visual?.transparent) {
13960
+ const wp = new this.THREE.Vector3(ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
13961
+ const mv = this.nearestMesh(pv, wp);
13962
+ const seed = hashNumbers(ev.time, ev.worldPoint[0], ev.worldPoint[1], ev.worldPoint[2]);
13963
+ if (mv) this.visuals.addCrack(mv, wp, this.worldDir(b, ev.crack.normal), ev.crack.rays, ev.crack.length, 15267071, seed);
13968
13964
  }
13969
13965
  this.impactSound(pv.material, ev.worldPoint, 0.5, ev.blow);
13970
13966
  }
@@ -14544,7 +14540,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14544
14540
  }
14545
14541
  };
14546
14542
 
14547
- // ../game-audio/dist/chunk-7TLFY7VO.js
14543
+ // ../game-audio/dist/chunk-KBTUANNG.js
14548
14544
  var DISTANCE_CURVES = {
14549
14545
  /** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
14550
14546
  game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
@@ -14757,7 +14753,11 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14757
14753
  ["casing_drop_terra_pistol", 1],
14758
14754
  ["casing_drop_terra_rifle", 1],
14759
14755
  ["casing_drop_terra_shell", 1],
14760
- ["rocket_fire", 2]
14756
+ ["rocket_fire", 2],
14757
+ ["smg_45_auto", 2, "sfx_pistol"],
14758
+ ["weapon_draw", 2],
14759
+ ["suppressor_attach", 3],
14760
+ ["suppressor_detach", 3]
14761
14761
  ]),
14762
14762
  ...entries("explosoes-fogo", [
14763
14763
  ["explosion_grenade", 1, "boom"],
@@ -14771,7 +14771,11 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14771
14771
  ["fire_loop_large", 1],
14772
14772
  ["fire_extinguish", 2, "hiss"],
14773
14773
  ["gas_leak_hiss", 2],
14774
- ["structure_collapse", 2, "crumble"]
14774
+ ["structure_collapse", 2, "crumble"],
14775
+ ["grenade_bounce", 1],
14776
+ ["c4_plant", 2],
14777
+ ["c4_beep", 2],
14778
+ ["c4_disarm", 2]
14775
14779
  ]),
14776
14780
  ...entries("personagem", [
14777
14781
  ["footstep_concrete_walk", 1, "sfx_step"],
@@ -14787,7 +14791,19 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14787
14791
  ["blunt_hit", 1],
14788
14792
  ["bite", 1, "sfx_flesh"],
14789
14793
  ["body_fall", 1],
14790
- ["player_hurt", 2]
14794
+ ["player_hurt", 2],
14795
+ ["footstep_tile_walk", 1, "sfx_step"],
14796
+ ["footstep_water_walk", 1, "sfx_step"],
14797
+ ["footstep_grate_walk", 2, "sfx_step"],
14798
+ ["footstep_duct_walk", 3, "sfx_step"],
14799
+ ["ladder_climb", 2],
14800
+ ["swim", 2],
14801
+ ["zombie_groan", 1],
14802
+ ["zombie_alert", 1],
14803
+ ["zombie_attack", 1],
14804
+ ["zombie_pain", 1],
14805
+ ["zombie_claw_hit", 1, "sfx_flesh"],
14806
+ ["zombie_claw_miss", 2]
14791
14807
  ]),
14792
14808
  ...entries("veiculos", [
14793
14809
  ["engine_loop_car", 1],
@@ -14815,7 +14831,8 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14815
14831
  ["wind_loop", 2],
14816
14832
  ["thunder_near", 2],
14817
14833
  ["thunder_far", 2],
14818
- ["water_splash", 2]
14834
+ ["water_splash", 2],
14835
+ ["helicopter_loop", 3]
14819
14836
  ])
14820
14837
  ];
14821
14838
  var SFX_MATERIALS = [
@@ -14897,6 +14914,60 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14897
14914
  burst: 20,
14898
14915
  burstSpacing: 0.06
14899
14916
  };
14917
+ var SFX_TIERS = { light: 0, medium: 0.34, heavy: 0.67 };
14918
+ function splitTier(id) {
14919
+ const match = /^(.*)_(light|medium|heavy)$/.exec(id);
14920
+ return match ? { base: match[1], tier: match[2] } : { base: id };
14921
+ }
14922
+ var refsOf = (entries2, baseUrl) => (entries2 ?? []).map((entry) => ({ url: `${baseUrl}${entry.file}` }));
14923
+ function sampleBankFromManifest(manifest, options) {
14924
+ const baseUrl = options.baseUrl ?? "";
14925
+ const samples = [];
14926
+ const tiersOf = /* @__PURE__ */ new Map();
14927
+ for (const sound of manifest.sounds) {
14928
+ const { base, tier } = splitTier(sound.id);
14929
+ if (tier) tiersOf.set(base, [...tiersOf.get(base) ?? [], sound]);
14930
+ }
14931
+ const bases = /* @__PURE__ */ new Map();
14932
+ for (const sound of manifest.sounds) {
14933
+ if (!splitTier(sound.id).tier) bases.set(sound.id, sound);
14934
+ }
14935
+ for (const [base, tiers] of tiersOf) {
14936
+ if (!bases.has(base)) bases.set(base, { id: base, category: tiers[0]?.category ?? "", layers: { close: tiers[0]?.layers.close ?? [] } });
14937
+ }
14938
+ for (const sound of bases.values()) {
14939
+ const numbers = options.sounds?.[sound.id] ?? options.defaults?.(sound);
14940
+ const close = refsOf(sound.layers.close, baseUrl);
14941
+ if (!numbers || close.length === 0) continue;
14942
+ const tiers = (tiersOf.get(sound.id) ?? []).map((tier) => {
14943
+ const name = splitTier(tier.id).tier;
14944
+ const tierFar = refsOf(tier.layers.far, baseUrl);
14945
+ return { name, from: SFX_TIERS[name] ?? 0, close: refsOf(tier.layers.close, baseUrl), ...tierFar.length > 0 ? { far: tierFar } : {} };
14946
+ }).sort((a, b) => a.from - b.from);
14947
+ const far = refsOf(sound.layers.far, baseUrl);
14948
+ const indoor = refsOf(sound.layers.tail_in, baseUrl);
14949
+ const outdoor = refsOf(sound.layers.tail_out, baseUrl);
14950
+ const files = [sound, ...tiersOf.get(sound.id) ?? []].flatMap((entry) => Object.values(entry.layers).flatMap((entries2) => entries2 ?? []));
14951
+ samples.push({
14952
+ id: sound.id,
14953
+ bus: numbers.bus,
14954
+ close,
14955
+ ...far.length > 0 ? { far } : {},
14956
+ ...tiers.length > 0 ? { tiers } : {},
14957
+ ...numbers.crossover ? { crossover: numbers.crossover } : {},
14958
+ ...indoor.length > 0 || outdoor.length > 0 ? { tail: { ...indoor.length > 0 ? { indoor } : {}, ...outdoor.length > 0 ? { outdoor } : {}, ...numbers.tailGain === void 0 ? {} : { gain: numbers.tailGain } } } : {},
14959
+ ...numbers.pitch === void 0 ? {} : { pitch: numbers.pitch },
14960
+ ...numbers.gain === void 0 ? {} : { gain: numbers.gain },
14961
+ ...numbers.falloff ? { falloff: numbers.falloff } : {},
14962
+ ...numbers.cutoffK === void 0 ? {} : { cutoffK: numbers.cutoffK },
14963
+ ...numbers.group ? { group: numbers.group } : {},
14964
+ ...numbers.priority === void 0 ? {} : { priority: numbers.priority },
14965
+ ...numbers.fallback ? { fallback: numbers.fallback } : {},
14966
+ sources: files.map((file) => `${file.file}: ${file.source} ${file.author} ${file.license}`)
14967
+ });
14968
+ }
14969
+ return { id: options.id, samples };
14970
+ }
14900
14971
  var PT = {
14901
14972
  group: "Som",
14902
14973
  name: "Painel de som (arquivos e C1\u2013C10)",
@@ -14904,6 +14975,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14904
14975
  category: "1 \xB7 Categoria",
14905
14976
  sound: "1 \xB7 Som",
14906
14977
  play: "1 \xB7 \u25B6 Tocar",
14978
+ play_user: "1 \xB7 \u25B6 Tocar o seu",
14907
14979
  material: "2 \xB7 Material",
14908
14980
  blow: "2 \xB7 Golpe",
14909
14981
  strike: "2 \xB7 \u25B6 Tocar golpe",
@@ -14925,6 +14997,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14925
14997
  approve: "5 \xB7 Aprovo (C10)"
14926
14998
  },
14927
14999
  hints: {
15000
+ 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.",
14928
15001
  sound: "A = arquivo, S = sintetizado, F = faltando. O que tem arquivo toca o arquivo; o resto toca o som atual.",
14929
15002
  strike: "Toca impact_<material>_<golpe>: o arquivo se existir, sen\xE3o o som atual daquele material.",
14930
15003
  wall: "P\xF5e a parede de casa entre voc\xEA e a fonte: o som fica abafado (C4).",
@@ -14969,9 +15042,10 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14969
15042
  strengths: { light: "leve", medium: "m\xE9dio", heavy: "forte" },
14970
15043
  states: { file: "A", synth: "S", missing: "F" },
14971
15044
  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" },
14972
- 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" },
15045
+ 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" },
14973
15046
  run: { idle: "parada", measuring: "medindo\u2026", done: "pronta", failed: "falhou", recording: "gravando\u2026", recorded: "grava\xE7\xE3o baixada" },
14974
15047
  words: { none: "\u2014", hidden: "? (revele)", prefers: "prefere", approved: "aprovado pelo dono" },
15048
+ sources: { sdk: "SDK", user: "seu som", synth: "sintetizado" },
14975
15049
  probe: "Fonte do som",
14976
15050
  wall: "Parede (oclus\xE3o)",
14977
15051
  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" }
@@ -14984,6 +15058,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
14984
15058
  category: "1 \xB7 Category",
14985
15059
  sound: "1 \xB7 Sound",
14986
15060
  play: "1 \xB7 \u25B6 Play",
15061
+ play_user: "1 \xB7 \u25B6 Play yours",
14987
15062
  material: "2 \xB7 Material",
14988
15063
  blow: "2 \xB7 Blow",
14989
15064
  strike: "2 \xB7 \u25B6 Play blow",
@@ -15005,6 +15080,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
15005
15080
  approve: "5 \xB7 Approve (C10)"
15006
15081
  },
15007
15082
  hints: {
15083
+ 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.",
15008
15084
  sound: "A = file, S = synthesized, F = missing. A file plays the file; the rest plays the current sound.",
15009
15085
  strike: "Plays impact_<material>_<blow>: the file if there is one, else the current sound of that material.",
15010
15086
  wall: "Puts the house wall between you and the source: the sound is muffled (C4).",
@@ -15039,69 +15115,16 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
15039
15115
  environments: { indoor: "indoor", outdoor: "outdoor" },
15040
15116
  strengths: { light: "light", medium: "medium", heavy: "heavy" },
15041
15117
  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" },
15042
- 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" },
15118
+ 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" },
15043
15119
  run: { idle: "idle", measuring: "measuring\u2026", done: "done", failed: "failed", recording: "recording\u2026", recorded: "recording downloaded" },
15044
15120
  words: { none: "\u2014", hidden: "? (reveal)", prefers: "prefers", approved: "approved by the owner" },
15121
+ sources: { sdk: "SDK", user: "your sound", synth: "synthesized" },
15045
15122
  probe: "Sound source",
15046
15123
  wall: "Wall (occlusion)",
15047
15124
  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" }
15048
15125
  };
15049
15126
 
15050
15127
  // ../game-audio/dist/index.js
15051
- var SFX_TIERS = { light: 0, medium: 0.34, heavy: 0.67 };
15052
- function splitTier(id) {
15053
- const match = /^(.*)_(light|medium|heavy)$/.exec(id);
15054
- return match ? { base: match[1], tier: match[2] } : { base: id };
15055
- }
15056
- var refsOf = (entries2, baseUrl) => (entries2 ?? []).map((entry) => ({ url: `${baseUrl}${entry.file}` }));
15057
- function sampleBankFromManifest(manifest, options) {
15058
- const baseUrl = options.baseUrl ?? "";
15059
- const samples = [];
15060
- const tiersOf = /* @__PURE__ */ new Map();
15061
- for (const sound of manifest.sounds) {
15062
- const { base, tier } = splitTier(sound.id);
15063
- if (tier) tiersOf.set(base, [...tiersOf.get(base) ?? [], sound]);
15064
- }
15065
- const bases = /* @__PURE__ */ new Map();
15066
- for (const sound of manifest.sounds) {
15067
- if (!splitTier(sound.id).tier) bases.set(sound.id, sound);
15068
- }
15069
- for (const [base, tiers] of tiersOf) {
15070
- if (!bases.has(base)) bases.set(base, { id: base, category: tiers[0]?.category ?? "", layers: { close: tiers[0]?.layers.close ?? [] } });
15071
- }
15072
- for (const sound of bases.values()) {
15073
- const numbers = options.sounds?.[sound.id] ?? options.defaults?.(sound);
15074
- const close = refsOf(sound.layers.close, baseUrl);
15075
- if (!numbers || close.length === 0) continue;
15076
- const tiers = (tiersOf.get(sound.id) ?? []).map((tier) => {
15077
- const name = splitTier(tier.id).tier;
15078
- const tierFar = refsOf(tier.layers.far, baseUrl);
15079
- return { name, from: SFX_TIERS[name] ?? 0, close: refsOf(tier.layers.close, baseUrl), ...tierFar.length > 0 ? { far: tierFar } : {} };
15080
- }).sort((a, b) => a.from - b.from);
15081
- const far = refsOf(sound.layers.far, baseUrl);
15082
- const indoor = refsOf(sound.layers.tail_in, baseUrl);
15083
- const outdoor = refsOf(sound.layers.tail_out, baseUrl);
15084
- const files = [sound, ...tiersOf.get(sound.id) ?? []].flatMap((entry) => Object.values(entry.layers).flatMap((entries2) => entries2 ?? []));
15085
- samples.push({
15086
- id: sound.id,
15087
- bus: numbers.bus,
15088
- close,
15089
- ...far.length > 0 ? { far } : {},
15090
- ...tiers.length > 0 ? { tiers } : {},
15091
- ...numbers.crossover ? { crossover: numbers.crossover } : {},
15092
- ...indoor.length > 0 || outdoor.length > 0 ? { tail: { ...indoor.length > 0 ? { indoor } : {}, ...outdoor.length > 0 ? { outdoor } : {}, ...numbers.tailGain === void 0 ? {} : { gain: numbers.tailGain } } } : {},
15093
- ...numbers.pitch === void 0 ? {} : { pitch: numbers.pitch },
15094
- ...numbers.gain === void 0 ? {} : { gain: numbers.gain },
15095
- ...numbers.falloff ? { falloff: numbers.falloff } : {},
15096
- ...numbers.cutoffK === void 0 ? {} : { cutoffK: numbers.cutoffK },
15097
- ...numbers.group ? { group: numbers.group } : {},
15098
- ...numbers.priority === void 0 ? {} : { priority: numbers.priority },
15099
- ...numbers.fallback ? { fallback: numbers.fallback } : {},
15100
- sources: files.map((file) => `${file.file}: ${file.source} ${file.author} ${file.license}`)
15101
- });
15102
- }
15103
- return { id: options.id, samples };
15104
- }
15105
15128
  var ATTACK = 2e-3;
15106
15129
  function lengthOf(d, attack) {
15107
15130
  if (typeof d === "number") return attack + d;