@adatechnology/game-weapons-three 0.12.0 → 0.13.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/dist/{chunk-ZVLG34JN.js → chunk-U4JAJ533.js} +178 -20
- package/dist/chunk-U4JAJ533.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +2098 -223
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-BlaMwqMW.d.ts → testing-DjtsFm2m.d.ts} +491 -6
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-ZVLG34JN.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HostTool, HandPose, EffectSink, HostEvent, HandTargets, TestableModule, AreaPlacement, DestructionEvent, Hit, Vec3 as Vec3$1, ModuleControl, ModuleLayer, ModuleMetric, ModuleHost } from '@adatechnology/game-contracts';
|
|
2
2
|
import { CaseType, CaliberDef, ReloadStageId, WeaponEvent, MountKind, AttachmentDef, FittedAttachment, Arsenal, WeaponDef, ExplosiveDef } from '@adatechnology/game-weapons';
|
|
3
|
-
import { AudioEngine } from '@adatechnology/game-audio';
|
|
3
|
+
import { SampleDefaults, SfxManifest, SoundBank, AudioEngine } from '@adatechnology/game-audio';
|
|
4
4
|
import * as THREE_NS from 'three';
|
|
5
5
|
import { LightBudget, RenderPools } from '@adatechnology/game-render-three';
|
|
6
6
|
|
|
@@ -14,6 +14,21 @@ interface FlybyInput {
|
|
|
14
14
|
/** Default 6 m. */
|
|
15
15
|
readonly maxMiss?: number;
|
|
16
16
|
}
|
|
17
|
+
interface FlybyVoice {
|
|
18
|
+
readonly kind: 'noise' | 'tone';
|
|
19
|
+
readonly filter?: 'highpass' | 'bandpass';
|
|
20
|
+
readonly frequency: number;
|
|
21
|
+
readonly to?: number;
|
|
22
|
+
readonly q?: number;
|
|
23
|
+
readonly gain: number;
|
|
24
|
+
readonly seconds: number;
|
|
25
|
+
}
|
|
26
|
+
interface FlybySound {
|
|
27
|
+
readonly supersonic: boolean;
|
|
28
|
+
readonly sample: 'bullet_crack_by' | 'bullet_whiz';
|
|
29
|
+
readonly voices: readonly FlybyVoice[];
|
|
30
|
+
}
|
|
31
|
+
declare function computeFlyby(input: FlybyInput): FlybySound | null;
|
|
17
32
|
|
|
18
33
|
type CasingSurface = 'hard' | 'wood' | 'metal' | 'soft';
|
|
19
34
|
type CasingKind = 'pistol' | 'rifle' | 'shell';
|
|
@@ -43,7 +58,399 @@ interface CasingSound {
|
|
|
43
58
|
readonly sample: string;
|
|
44
59
|
readonly voices: readonly CasingVoice[];
|
|
45
60
|
}
|
|
61
|
+
declare function computeCasingSound(input: CasingInput): CasingSound;
|
|
62
|
+
|
|
63
|
+
var profiles$1 = {
|
|
64
|
+
pistol_22lr: {
|
|
65
|
+
referenceJ: 160,
|
|
66
|
+
far: "pistol",
|
|
67
|
+
crack: {
|
|
68
|
+
frequency: 5200,
|
|
69
|
+
gain: 0.4,
|
|
70
|
+
seconds: 0.006
|
|
71
|
+
},
|
|
72
|
+
blast: {
|
|
73
|
+
cutoff: 3400,
|
|
74
|
+
gain: 0.517,
|
|
75
|
+
seconds: 0.05
|
|
76
|
+
},
|
|
77
|
+
body: {
|
|
78
|
+
from: 200,
|
|
79
|
+
to: 90,
|
|
80
|
+
gain: 0.045,
|
|
81
|
+
seconds: 0.04
|
|
82
|
+
},
|
|
83
|
+
far_layer: {
|
|
84
|
+
cutoff: 1300,
|
|
85
|
+
gain: 0.22,
|
|
86
|
+
seconds: 0.12
|
|
87
|
+
},
|
|
88
|
+
tail_out: {
|
|
89
|
+
cutoff: 1500,
|
|
90
|
+
gain: 0.08,
|
|
91
|
+
seconds: 0.5
|
|
92
|
+
},
|
|
93
|
+
tail_in: {
|
|
94
|
+
cutoff: 2400,
|
|
95
|
+
gain: 0.24,
|
|
96
|
+
seconds: 0.25
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
pistol_9mm: {
|
|
100
|
+
referenceJ: 500,
|
|
101
|
+
far: "pistol",
|
|
102
|
+
crack: {
|
|
103
|
+
frequency: 4200,
|
|
104
|
+
gain: 0.55,
|
|
105
|
+
seconds: 0.008
|
|
106
|
+
},
|
|
107
|
+
blast: {
|
|
108
|
+
cutoff: 2500,
|
|
109
|
+
gain: 0.92,
|
|
110
|
+
seconds: 0.09
|
|
111
|
+
},
|
|
112
|
+
body: {
|
|
113
|
+
from: 160,
|
|
114
|
+
to: 55,
|
|
115
|
+
gain: 0.189,
|
|
116
|
+
seconds: 0.1
|
|
117
|
+
},
|
|
118
|
+
far_layer: {
|
|
119
|
+
cutoff: 950,
|
|
120
|
+
gain: 0.35,
|
|
121
|
+
seconds: 0.2
|
|
122
|
+
},
|
|
123
|
+
tail_out: {
|
|
124
|
+
cutoff: 1150,
|
|
125
|
+
gain: 0.2,
|
|
126
|
+
seconds: 0.9
|
|
127
|
+
},
|
|
128
|
+
tail_in: {
|
|
129
|
+
cutoff: 2200,
|
|
130
|
+
gain: 0.45,
|
|
131
|
+
seconds: 0.4
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
pistol_45: {
|
|
135
|
+
referenceJ: 480,
|
|
136
|
+
far: "pistol",
|
|
137
|
+
crack: {
|
|
138
|
+
frequency: 3400,
|
|
139
|
+
gain: 0.42,
|
|
140
|
+
seconds: 0.009
|
|
141
|
+
},
|
|
142
|
+
blast: {
|
|
143
|
+
cutoff: 1650,
|
|
144
|
+
gain: 0.977,
|
|
145
|
+
seconds: 0.12
|
|
146
|
+
},
|
|
147
|
+
body: {
|
|
148
|
+
from: 120,
|
|
149
|
+
to: 42,
|
|
150
|
+
gain: 0.279,
|
|
151
|
+
seconds: 0.15
|
|
152
|
+
},
|
|
153
|
+
far_layer: {
|
|
154
|
+
cutoff: 760,
|
|
155
|
+
gain: 0.4,
|
|
156
|
+
seconds: 0.25
|
|
157
|
+
},
|
|
158
|
+
tail_out: {
|
|
159
|
+
cutoff: 1000,
|
|
160
|
+
gain: 0.22,
|
|
161
|
+
seconds: 1
|
|
162
|
+
},
|
|
163
|
+
tail_in: {
|
|
164
|
+
cutoff: 1900,
|
|
165
|
+
gain: 0.48,
|
|
166
|
+
seconds: 0.45
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
revolver_38_357: {
|
|
170
|
+
referenceJ: 800,
|
|
171
|
+
far: "pistol",
|
|
172
|
+
crack: {
|
|
173
|
+
frequency: 4000,
|
|
174
|
+
gain: 0.6,
|
|
175
|
+
seconds: 0.009
|
|
176
|
+
},
|
|
177
|
+
blast: {
|
|
178
|
+
cutoff: 2000,
|
|
179
|
+
gain: 1.035,
|
|
180
|
+
seconds: 0.13
|
|
181
|
+
},
|
|
182
|
+
body: {
|
|
183
|
+
from: 135,
|
|
184
|
+
to: 45,
|
|
185
|
+
gain: 0.248,
|
|
186
|
+
seconds: 0.15
|
|
187
|
+
},
|
|
188
|
+
far_layer: {
|
|
189
|
+
cutoff: 820,
|
|
190
|
+
gain: 0.42,
|
|
191
|
+
seconds: 0.28
|
|
192
|
+
},
|
|
193
|
+
tail_out: {
|
|
194
|
+
cutoff: 1100,
|
|
195
|
+
gain: 0.28,
|
|
196
|
+
seconds: 1.4
|
|
197
|
+
},
|
|
198
|
+
tail_in: {
|
|
199
|
+
cutoff: 2000,
|
|
200
|
+
gain: 0.54,
|
|
201
|
+
seconds: 0.5
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
revolver_44_50ae: {
|
|
205
|
+
referenceJ: 1800,
|
|
206
|
+
far: "pistol",
|
|
207
|
+
crack: {
|
|
208
|
+
frequency: 3100,
|
|
209
|
+
gain: 0.62,
|
|
210
|
+
seconds: 0.012
|
|
211
|
+
},
|
|
212
|
+
blast: {
|
|
213
|
+
cutoff: 1350,
|
|
214
|
+
gain: 1.15,
|
|
215
|
+
seconds: 0.18
|
|
216
|
+
},
|
|
217
|
+
body: {
|
|
218
|
+
from: 100,
|
|
219
|
+
to: 36,
|
|
220
|
+
gain: 0.369,
|
|
221
|
+
seconds: 0.21
|
|
222
|
+
},
|
|
223
|
+
far_layer: {
|
|
224
|
+
cutoff: 650,
|
|
225
|
+
gain: 0.5,
|
|
226
|
+
seconds: 0.33
|
|
227
|
+
},
|
|
228
|
+
tail_out: {
|
|
229
|
+
cutoff: 900,
|
|
230
|
+
gain: 0.34,
|
|
231
|
+
seconds: 1.7
|
|
232
|
+
},
|
|
233
|
+
tail_in: {
|
|
234
|
+
cutoff: 1700,
|
|
235
|
+
gain: 0.6,
|
|
236
|
+
seconds: 0.6
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
shotgun_12: {
|
|
240
|
+
referenceJ: 2700,
|
|
241
|
+
far: "shotgun",
|
|
242
|
+
crack: {
|
|
243
|
+
frequency: 2600,
|
|
244
|
+
gain: 0.36,
|
|
245
|
+
seconds: 0.012
|
|
246
|
+
},
|
|
247
|
+
blast: {
|
|
248
|
+
cutoff: 900,
|
|
249
|
+
gain: 1.15,
|
|
250
|
+
seconds: 0.26
|
|
251
|
+
},
|
|
252
|
+
body: {
|
|
253
|
+
from: 90,
|
|
254
|
+
to: 32,
|
|
255
|
+
gain: 0.405,
|
|
256
|
+
seconds: 0.3
|
|
257
|
+
},
|
|
258
|
+
far_layer: {
|
|
259
|
+
cutoff: 540,
|
|
260
|
+
gain: 0.55,
|
|
261
|
+
seconds: 0.42
|
|
262
|
+
},
|
|
263
|
+
tail_out: {
|
|
264
|
+
cutoff: 800,
|
|
265
|
+
gain: 0.38,
|
|
266
|
+
seconds: 1.9
|
|
267
|
+
},
|
|
268
|
+
tail_in: {
|
|
269
|
+
cutoff: 1500,
|
|
270
|
+
gain: 0.63,
|
|
271
|
+
seconds: 0.7
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
rifle_5_56: {
|
|
275
|
+
referenceJ: 1750,
|
|
276
|
+
far: "rifle",
|
|
277
|
+
crack: {
|
|
278
|
+
frequency: 5400,
|
|
279
|
+
gain: 0.78,
|
|
280
|
+
seconds: 0.007
|
|
281
|
+
},
|
|
282
|
+
blast: {
|
|
283
|
+
cutoff: 2700,
|
|
284
|
+
gain: 0.977,
|
|
285
|
+
seconds: 0.11
|
|
286
|
+
},
|
|
287
|
+
body: {
|
|
288
|
+
from: 145,
|
|
289
|
+
to: 50,
|
|
290
|
+
gain: 0.216,
|
|
291
|
+
seconds: 0.12
|
|
292
|
+
},
|
|
293
|
+
far_layer: {
|
|
294
|
+
cutoff: 900,
|
|
295
|
+
gain: 0.5,
|
|
296
|
+
seconds: 0.36
|
|
297
|
+
},
|
|
298
|
+
tail_out: {
|
|
299
|
+
cutoff: 1300,
|
|
300
|
+
gain: 0.4,
|
|
301
|
+
seconds: 2.1
|
|
302
|
+
},
|
|
303
|
+
tail_in: {
|
|
304
|
+
cutoff: 2300,
|
|
305
|
+
gain: 0.57,
|
|
306
|
+
seconds: 0.55
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
rifle_7_62x39: {
|
|
310
|
+
referenceJ: 2100,
|
|
311
|
+
far: "rifle",
|
|
312
|
+
crack: {
|
|
313
|
+
frequency: 4300,
|
|
314
|
+
gain: 0.72,
|
|
315
|
+
seconds: 0.01
|
|
316
|
+
},
|
|
317
|
+
blast: {
|
|
318
|
+
cutoff: 1850,
|
|
319
|
+
gain: 1.092,
|
|
320
|
+
seconds: 0.15
|
|
321
|
+
},
|
|
322
|
+
body: {
|
|
323
|
+
from: 115,
|
|
324
|
+
to: 40,
|
|
325
|
+
gain: 0.297,
|
|
326
|
+
seconds: 0.17
|
|
327
|
+
},
|
|
328
|
+
far_layer: {
|
|
329
|
+
cutoff: 780,
|
|
330
|
+
gain: 0.52,
|
|
331
|
+
seconds: 0.38
|
|
332
|
+
},
|
|
333
|
+
tail_out: {
|
|
334
|
+
cutoff: 1100,
|
|
335
|
+
gain: 0.42,
|
|
336
|
+
seconds: 2.2
|
|
337
|
+
},
|
|
338
|
+
tail_in: {
|
|
339
|
+
cutoff: 2000,
|
|
340
|
+
gain: 0.6,
|
|
341
|
+
seconds: 0.6
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
rifle_308_3006: {
|
|
345
|
+
referenceJ: 3500,
|
|
346
|
+
far: "rifle",
|
|
347
|
+
crack: {
|
|
348
|
+
frequency: 4500,
|
|
349
|
+
gain: 0.8,
|
|
350
|
+
seconds: 0.01
|
|
351
|
+
},
|
|
352
|
+
blast: {
|
|
353
|
+
cutoff: 1500,
|
|
354
|
+
gain: 1.15,
|
|
355
|
+
seconds: 0.19
|
|
356
|
+
},
|
|
357
|
+
body: {
|
|
358
|
+
from: 100,
|
|
359
|
+
to: 36,
|
|
360
|
+
gain: 0.36,
|
|
361
|
+
seconds: 0.21
|
|
362
|
+
},
|
|
363
|
+
far_layer: {
|
|
364
|
+
cutoff: 650,
|
|
365
|
+
gain: 0.6,
|
|
366
|
+
seconds: 0.46
|
|
367
|
+
},
|
|
368
|
+
tail_out: {
|
|
369
|
+
cutoff: 950,
|
|
370
|
+
gain: 0.5,
|
|
371
|
+
seconds: 2.7
|
|
372
|
+
},
|
|
373
|
+
tail_in: {
|
|
374
|
+
cutoff: 1800,
|
|
375
|
+
gain: 0.675,
|
|
376
|
+
seconds: 0.7
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
sniper_338_300wm: {
|
|
380
|
+
referenceJ: 6600,
|
|
381
|
+
far: "heavy",
|
|
382
|
+
crack: {
|
|
383
|
+
frequency: 4200,
|
|
384
|
+
gain: 0.86,
|
|
385
|
+
seconds: 0.012
|
|
386
|
+
},
|
|
387
|
+
blast: {
|
|
388
|
+
cutoff: 1250,
|
|
389
|
+
gain: 1.208,
|
|
390
|
+
seconds: 0.23
|
|
391
|
+
},
|
|
392
|
+
body: {
|
|
393
|
+
from: 85,
|
|
394
|
+
to: 32,
|
|
395
|
+
gain: 0.414,
|
|
396
|
+
seconds: 0.26
|
|
397
|
+
},
|
|
398
|
+
far_layer: {
|
|
399
|
+
cutoff: 580,
|
|
400
|
+
gain: 0.65,
|
|
401
|
+
seconds: 0.52
|
|
402
|
+
},
|
|
403
|
+
tail_out: {
|
|
404
|
+
cutoff: 850,
|
|
405
|
+
gain: 0.56,
|
|
406
|
+
seconds: 3.1
|
|
407
|
+
},
|
|
408
|
+
tail_in: {
|
|
409
|
+
cutoff: 1650,
|
|
410
|
+
gain: 0.72,
|
|
411
|
+
seconds: 0.8
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
antimateriel_50bmg: {
|
|
415
|
+
referenceJ: 18000,
|
|
416
|
+
far: "heavy",
|
|
417
|
+
crack: {
|
|
418
|
+
frequency: 3500,
|
|
419
|
+
gain: 0.9,
|
|
420
|
+
seconds: 0.015
|
|
421
|
+
},
|
|
422
|
+
blast: {
|
|
423
|
+
cutoff: 900,
|
|
424
|
+
gain: 1.265,
|
|
425
|
+
seconds: 0.3
|
|
426
|
+
},
|
|
427
|
+
body: {
|
|
428
|
+
from: 62,
|
|
429
|
+
to: 25,
|
|
430
|
+
gain: 0.495,
|
|
431
|
+
seconds: 0.36
|
|
432
|
+
},
|
|
433
|
+
far_layer: {
|
|
434
|
+
cutoff: 450,
|
|
435
|
+
gain: 0.7,
|
|
436
|
+
seconds: 0.62
|
|
437
|
+
},
|
|
438
|
+
tail_out: {
|
|
439
|
+
cutoff: 700,
|
|
440
|
+
gain: 0.6,
|
|
441
|
+
seconds: 3.6
|
|
442
|
+
},
|
|
443
|
+
tail_in: {
|
|
444
|
+
cutoff: 1400,
|
|
445
|
+
gain: 0.75,
|
|
446
|
+
seconds: 0.9
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
var data$1 = {
|
|
451
|
+
profiles: profiles$1};
|
|
46
452
|
|
|
453
|
+
type GunshotProfileId = keyof typeof data$1.profiles;
|
|
47
454
|
type GunshotFarClass = 'pistol' | 'rifle' | 'shotgun' | 'heavy';
|
|
48
455
|
type Noise = {
|
|
49
456
|
readonly cutoff: number;
|
|
@@ -73,6 +480,7 @@ interface GunshotProfile {
|
|
|
73
480
|
readonly tail_out: Noise;
|
|
74
481
|
readonly tail_in: Noise;
|
|
75
482
|
}
|
|
483
|
+
declare const GUNSHOT_PROFILES: Readonly<Record<GunshotProfileId, GunshotProfile>>;
|
|
76
484
|
type GunshotSpace = 'outdoor' | 'indoor';
|
|
77
485
|
type GunshotGroup = 'close' | 'mech' | 'tail' | 'far';
|
|
78
486
|
interface GunshotInput {
|
|
@@ -140,6 +548,13 @@ interface Gunshot {
|
|
|
140
548
|
readonly samples: Readonly<Record<GunshotGroup, string>>;
|
|
141
549
|
readonly voices: readonly GunshotVoice[];
|
|
142
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* The voices of one gunshot. Distance: every layer arrives `d / 343` s late; the level falls as `(reference / d)^exponent`, the highs go first (the
|
|
553
|
+
* crack fades over ~60 m, lowpass cutoffs fall with `1 + d / 250`) and the close sound fades into the far boom between `farFrom` and `farTo`. Space:
|
|
554
|
+
* outdoors the field answers with two late echoes and a long low tail; indoors the room answers at once (early reflections and a dense, short tail
|
|
555
|
+
* sent to the reverb). A suppressor takes the blast and the body down and leaves the action and a supersonic crack.
|
|
556
|
+
*/
|
|
557
|
+
declare function computeGunshot(input: GunshotInput, options?: GunshotOptions): Gunshot;
|
|
143
558
|
|
|
144
559
|
/** One sound of the game: [lowpass cutoff Hz, gain, seconds]. Literal from the `P` table of `sfx` in the game (jogo.js L62101-L62104). */
|
|
145
560
|
type SoundClassDef = readonly [cutoff: number, gain: number, seconds: number];
|
|
@@ -342,6 +757,57 @@ interface SoundProfile {
|
|
|
342
757
|
readonly material: keyof typeof data.profiles.material;
|
|
343
758
|
}
|
|
344
759
|
|
|
760
|
+
/** Where the recorded files are: the manifest the converter wrote and how a file of it becomes a url. */
|
|
761
|
+
interface WeaponSampleOptions {
|
|
762
|
+
readonly manifest: SfxManifest;
|
|
763
|
+
/** Prefix of every file (`/sfx/`), when `url` is not given. Default ''. */
|
|
764
|
+
readonly baseUrl?: string;
|
|
765
|
+
/** The url of a file of the manifest (`armas/pistol_9mm_close_01.ogg`): a served path or a `data:` url of the inlined bytes. */
|
|
766
|
+
readonly url?: (file: string) => string;
|
|
767
|
+
/** Replaces the numbers of a sound by id (gain, crossover, falloff...). */
|
|
768
|
+
readonly sounds?: Readonly<Record<string, Partial<SampleDefaults>>>;
|
|
769
|
+
}
|
|
770
|
+
/** The shot sounds: the calibre profiles and the suppressed ones. */
|
|
771
|
+
declare const GUNSHOT_SAMPLE_IDS: readonly string[];
|
|
772
|
+
/**
|
|
773
|
+
* A shot as recorded: the near take up to 20 m, the mid-distance one from 90 m, an equal-power crossfade between. The level falls gently (a
|
|
774
|
+
* gunshot carries: about −14 dB at 100 m, −36 dB at 800 m) and the highs go with the air (6.7 kHz at 50 m, 2.2 kHz at 200 m). Three plays ring at once at most, so a burst stays shot
|
|
775
|
+
* by shot.
|
|
776
|
+
*/
|
|
777
|
+
declare const GUNSHOT_SAMPLE: SampleDefaults;
|
|
778
|
+
/** A reload step: heard at the hands, about a third of a shot's level after the converter's peak normalization. */
|
|
779
|
+
declare const RELOAD_SAMPLE: SampleDefaults;
|
|
780
|
+
/** Seconds from the start of each recorded reload step to its hit (`data/reload-sample-hits.json`, measured on the files). */
|
|
781
|
+
declare const RELOAD_SAMPLE_HITS: Readonly<Record<string, number>>;
|
|
782
|
+
/** The tier a weapon's weight plays (`SFX_TIERS`: light from 0, medium from 0.34, heavy from 0.67). */
|
|
783
|
+
declare const WEIGHT_INTENSITY: Readonly<Record<SoundProfile['weight'], number>>;
|
|
784
|
+
/**
|
|
785
|
+
* Reload cues the recordings of another cue already carry: the magazine release button is the start of the "detach magazine" take, the slide of
|
|
786
|
+
* the magazine into the well the start of the "insert magazine" one. When that sample plays, these cues stay silent.
|
|
787
|
+
*/
|
|
788
|
+
declare const CUES_IN_SAMPLE: Readonly<Record<string, string>>;
|
|
789
|
+
/** The numbers of a sound of the manifest: a gunshot, a case landing or a reload step (`armas` only). */
|
|
790
|
+
declare function weaponSampleDefaults(sound: {
|
|
791
|
+
readonly id: string;
|
|
792
|
+
readonly category: string;
|
|
793
|
+
}, overrides?: WeaponSampleOptions['sounds']): SampleDefaults | undefined;
|
|
794
|
+
/** The bank of the recorded weapon sounds, every url through `url` (or `baseUrl`). Gunshots choke at three voices. */
|
|
795
|
+
declare function weaponSampleBank(options: WeaponSampleOptions): SoundBank;
|
|
796
|
+
|
|
797
|
+
/** What a reload cue played: its recording, nothing (another cue's recording carries it), or the synthesized steps. */
|
|
798
|
+
type CuePlayed = 'sample' | 'carried' | 'synth';
|
|
799
|
+
/** What sounded for a shot: the recorded takes (`sample`, with the take of each layer) or the synthesized layers (`synth`). */
|
|
800
|
+
type GunshotPlayed = {
|
|
801
|
+
readonly kind: 'synth';
|
|
802
|
+
} | {
|
|
803
|
+
readonly kind: 'sample';
|
|
804
|
+
readonly id: string;
|
|
805
|
+
readonly layers: readonly {
|
|
806
|
+
readonly role: string;
|
|
807
|
+
readonly take: number;
|
|
808
|
+
readonly rate: number;
|
|
809
|
+
}[];
|
|
810
|
+
};
|
|
345
811
|
/** What a shot adds to the energy and the category: where the listener is and how the weapon is set. */
|
|
346
812
|
type ShotExtras = Pick<ShotSoundInput, 'caliber' | 'distance' | 'volume' | 'suppressed' | 'indoors'> & {
|
|
347
813
|
/** Where the shot is, for the stereo side (the engine's listener is the other end). Left out, the shot is in front (the player's own weapon). */
|
|
@@ -361,9 +827,9 @@ interface WeaponAudioOptions extends ShotSoundOptions {
|
|
|
361
827
|
/** Pitch spread of a shot, ± this fraction (default 0.04, C5). */
|
|
362
828
|
readonly pitchSpread?: number;
|
|
363
829
|
/** Told each gunshot played (profile, take, pitch, space, distance), so a host can log what sounded. */
|
|
364
|
-
readonly onGunshot?: (shot: Gunshot, input: GunshotInput) => void;
|
|
830
|
+
readonly onGunshot?: (shot: Gunshot, input: GunshotInput, played: GunshotPlayed) => void;
|
|
365
831
|
/** Told each case that lands (floor, case type, sample id). */
|
|
366
|
-
readonly onCasing?: (sound: CasingSound) => void;
|
|
832
|
+
readonly onCasing?: (sound: CasingSound, played: 'sample' | 'synth') => void;
|
|
367
833
|
/** Seed of the noise buffer, of the start point in it and of the casing pitch: same seed, same sound. Default 1. */
|
|
368
834
|
readonly seed?: number;
|
|
369
835
|
/** Replaces or adds mechanical sounds by id. */
|
|
@@ -378,6 +844,11 @@ interface WeaponAudioOptions extends ShotSoundOptions {
|
|
|
378
844
|
* weapon audio makes its own engine with the game mix, no voice limit, and the master at `volume`.
|
|
379
845
|
*/
|
|
380
846
|
readonly engine?: AudioEngine;
|
|
847
|
+
/**
|
|
848
|
+
* The recorded shots and reload steps (game-audio's `assets/sfx/manifest.json` and where its files are served). A shot of a profile with files
|
|
849
|
+
* plays its takes, a reload cue the takes of the weapon's weight; until they are loaded, and for anything without files, the synthesized sound.
|
|
850
|
+
*/
|
|
851
|
+
readonly samples?: WeaponSampleOptions;
|
|
381
852
|
}
|
|
382
853
|
/** Sounds the weapon presentation plays. */
|
|
383
854
|
interface WeaponAudio {
|
|
@@ -391,8 +862,14 @@ interface WeaponAudio {
|
|
|
391
862
|
click(): void;
|
|
392
863
|
/** A mechanical sound by id: a reload stage, `dry_fire`, `jam`, `safety_on`... */
|
|
393
864
|
mechanical(id: MechanicalSoundId): void;
|
|
394
|
-
/**
|
|
395
|
-
|
|
865
|
+
/**
|
|
866
|
+
* A cue of a reload clip (`mag_seat`, `charging_handle_pull`, `pump_back`...) for a weapon's profile (the weight of its metal and what it is made
|
|
867
|
+
* of), where the clip says. `lead` is how early the clip started it (seconds before the part reaches its stop): a recording plays at once, its hit
|
|
868
|
+
* that much later; the synthesized steps, whose hit is at their start, wait `lead`.
|
|
869
|
+
*/
|
|
870
|
+
cue(id: string, profile?: SoundProfile, lead?: number): CuePlayed;
|
|
871
|
+
/** Loads the recorded files now (they load on the first sound otherwise, and the synthesized sound plays meanwhile). */
|
|
872
|
+
loadSamples(): Promise<void>;
|
|
396
873
|
/** The mechanical sound of a weapon event, if it has one (reload stages, empty, misfire, fault, clear, safety, mode, feed). */
|
|
397
874
|
event(event: WeaponEvent): void;
|
|
398
875
|
/** A sound class of the game by name (`impact`, `flesh`, `glass`...), with the game's distance muffling. */
|
|
@@ -796,6 +1273,7 @@ interface WeaponFxOptions {
|
|
|
796
1273
|
weapon: string;
|
|
797
1274
|
cue: string;
|
|
798
1275
|
profile: SoundProfile;
|
|
1276
|
+
played?: CuePlayed;
|
|
799
1277
|
}) => void;
|
|
800
1278
|
/** Builders of accessory models that replace or add to the ones the kit ships (by the `model` of the accessory). */
|
|
801
1279
|
attachmentModels?: AttachmentModelRegistry;
|
|
@@ -889,6 +1367,8 @@ interface WeaponsTestModuleOptions {
|
|
|
889
1367
|
arsenal?: Arsenal;
|
|
890
1368
|
/** Play sounds (default true; silent anyway where there is no AudioContext). */
|
|
891
1369
|
sound?: boolean;
|
|
1370
|
+
/** The recorded shots and reload steps (game-audio's sfx manifest and where its files are); without it the synthesized sounds play. */
|
|
1371
|
+
samples?: WeaponSampleOptions;
|
|
892
1372
|
/** Wear of the weapon in the hands, which the gallery models show in their metal: `new` (default), `used`, `worn` or `rusty`. */
|
|
893
1373
|
condition?: string;
|
|
894
1374
|
/** Seed of the scatter of casings and smoke (default 1). */
|
|
@@ -1015,6 +1495,7 @@ interface ExplosivesText {
|
|
|
1015
1495
|
push_outward: string;
|
|
1016
1496
|
push_falloff: string;
|
|
1017
1497
|
push_person: string;
|
|
1498
|
+
push_sheltered: string;
|
|
1018
1499
|
push_heavy: string;
|
|
1019
1500
|
};
|
|
1020
1501
|
}
|
|
@@ -1056,6 +1537,10 @@ interface ExplosivesRoom {
|
|
|
1056
1537
|
readonly maxHp: number;
|
|
1057
1538
|
})[];
|
|
1058
1539
|
} | null;
|
|
1540
|
+
/** The share of a blast at `point` that reaches `target` through the cover between them (game-destruction `blastReach`). */
|
|
1541
|
+
blastReach?(point: Vec3$1, target: Vec3$1, options?: {
|
|
1542
|
+
readonly ignore?: readonly string[];
|
|
1543
|
+
}): number;
|
|
1059
1544
|
};
|
|
1060
1545
|
readonly renderer: {
|
|
1061
1546
|
impulse(objectId: string, impulse: Vec3$1, point?: Vec3$1): void;
|
|
@@ -1213,4 +1698,4 @@ declare function createExplosivesTestModule(options?: ExplosivesTestModuleOption
|
|
|
1213
1698
|
readonly bench: ReturnType<typeof createExplosivesBench>;
|
|
1214
1699
|
};
|
|
1215
1700
|
|
|
1216
|
-
export {
|
|
1701
|
+
export { type ShotSoundOptions as $, type AttachmentModelRegistry as A, type GunshotInput as B, CLASS_REFERENCE_ENERGY as C, DEFAULT_ENERGY_CURVE as D, EXPLOSIVES_AREA_ID as E, type FlybySound as F, GAME_DISTANCE_CURVE as G, type GunshotPlayed as H, type ItemModels as I, type ItemModelRequest as J, MECHANICAL_SOUNDS as K, type LaserRaycast as L, type ModelKit as M, MODEL_ENTRIES as N, MOUNTED_M134_ITEM_ID as O, type MechanicalSoundId as P, type ModelEntry as Q, type ModelMaterials as R, type ModelOptions as S, type MountFrame as T, RELOAD_SAMPLE as U, RELOAD_SAMPLE_HITS as V, type WeaponProps as W, type ShotExtras as X, type ShotSound as Y, type ShotSoundClass as Z, type ShotSoundInput as _, type WeaponItemModel as a, type SoundClassDef as a0, type SoundStep as a1, WEAPON_ITEM_PREFIX as a2, WEIGHT_INTENSITY as a3, type WeaponAudio as a4, type WeaponAudioOptions as a5, type WeaponFx as a6, type WeaponFxOptions as a7, type WeaponSampleOptions as a8, type WeaponsTestModuleOptions as a9, buildItemWeaponModel as aa, buildWeaponModel as ab, buildWeaponModelById as ac, computeCasingSound as ad, computeFlyby as ae, computeGunshot as af, computeShotSound as ag, createExplosivesTestModule as ah, createWeaponAudio as ai, createWeaponFx as aj, createWeaponsTestModule as ak, defaultWeaponProps as al, deriveFrames as am, explosivesTextOf as an, hasWeaponModel as ao, itemModelOfWeapon as ap, mechanicalSoundOf as aq, modelKit as ar, mountFrame as as, registerWeaponItemModel as at, weaponSampleBank as au, weaponSampleDefaults as av, weaponsLayout as aw, type WeaponModel as b, type ModelParts as c, type ModelFamily as d, ARCHETYPE_MODELS as e, type AttachmentBuildContext as f, type AttachmentModel as g, type AttachmentModelBuilder as h, COUNTER_ITEM_ID as i, CUES_IN_SAMPLE as j, type CasingSound as k, type CuePlayed as l, DEFAULT_EXPLOSIVES_SCENE as m, type DistanceCurve as n, EXPLOSIVES_TEXT as o, type EnergyCurve as p, type ExplosivesRoom as q, type ExplosivesScene as r, type ExplosivesTestModuleOptions as s, type ExplosivesText as t, type FxLayers as u, GAME_SOUND_CLASSES as v, GUNSHOT_PROFILES as w, GUNSHOT_SAMPLE as x, GUNSHOT_SAMPLE_IDS as y, type Gunshot as z };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { i as COUNTER_ITEM_ID,
|
|
1
|
+
export { i as COUNTER_ITEM_ID, m as DEFAULT_EXPLOSIVES_SCENE, E as EXPLOSIVES_AREA_ID, o as EXPLOSIVES_TEXT, q as ExplosivesRoom, r as ExplosivesScene, s as ExplosivesTestModuleOptions, t as ExplosivesText, O as MOUNTED_M134_ITEM_ID, a2 as WEAPON_ITEM_PREFIX, a9 as WeaponsTestModuleOptions, ah as createExplosivesTestModule, ak as createWeaponsTestModule, an as explosivesTextOf, aw as weaponsLayout } from './testing-DjtsFm2m.js';
|
|
2
2
|
import '@adatechnology/game-contracts';
|
|
3
3
|
import '@adatechnology/game-weapons';
|
|
4
4
|
import '@adatechnology/game-audio';
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adatechnology/game-weapons-three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"license": "MIT AND CC-BY-SA-4.0 AND CC-BY-SA-3.0 AND CC-BY-3.0 AND CC0-1.0 AND LicenseRef-Public-Domain",
|
|
5
5
|
"description": "three.js presentation for @adatechnology/game-weapons: the real models of the Galeria 3D do Arsenal (78 weapons, a cartridge and a case per calibre), the weapon in the hands playing the tool-animation clips (fire, burst, cycle, jam, clear, safety and the seven reloads), ejected casings and dropped magazines, worn-metal conditions, synthesized sounds, and the weapons test area (counters with every weapon) as a TestableModule.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"assets"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@adatechnology/game-
|
|
48
|
-
"@adatechnology/game-
|
|
49
|
-
"@adatechnology/game-floorplan-three": "^0.9.
|
|
50
|
-
"@adatechnology/game-items-three": "^0.7.
|
|
51
|
-
"@adatechnology/game-shapes-three": "^0.3.0",
|
|
47
|
+
"@adatechnology/game-audio": "^0.6.0",
|
|
48
|
+
"@adatechnology/game-contracts": "^0.23.0",
|
|
49
|
+
"@adatechnology/game-floorplan-three": "^0.9.1",
|
|
50
|
+
"@adatechnology/game-items-three": "^0.7.1",
|
|
52
51
|
"@adatechnology/game-render-three": "^0.1.0",
|
|
52
|
+
"@adatechnology/game-shapes-three": "^0.3.1",
|
|
53
53
|
"@adatechnology/game-vfx": "^0.7.0",
|
|
54
|
-
"@adatechnology/game-vfx-three": "^0.5.
|
|
55
|
-
"@adatechnology/game-weapons": "^0.5.
|
|
54
|
+
"@adatechnology/game-vfx-three": "^0.5.1",
|
|
55
|
+
"@adatechnology/game-weapons": "^0.5.9"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"three": "^0.160.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"tsup": "^8.5.1",
|
|
66
66
|
"typescript": "^5.7.3",
|
|
67
67
|
"vitest": "^3.2.4",
|
|
68
|
-
"@adatechnology/game-test-room": "^0.
|
|
68
|
+
"@adatechnology/game-test-room": "^0.24.0",
|
|
69
69
|
"@adatechnology/golden-tool": "^0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|