@adatechnology/game-weapons-three 0.12.0 → 0.13.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.
- package/dist/{chunk-ZVLG34JN.js → chunk-NQELXT56.js} +178 -20
- package/dist/chunk-NQELXT56.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +2067 -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-BoxqhX_W.d.ts} +488 -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, SfxManifestSound, 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;
|
|
46
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};
|
|
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,54 @@ 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: SfxManifestSound, overrides?: WeaponSampleOptions['sounds']): SampleDefaults | undefined;
|
|
791
|
+
/** The bank of the recorded weapon sounds, every url through `url` (or `baseUrl`). Gunshots choke at three voices. */
|
|
792
|
+
declare function weaponSampleBank(options: WeaponSampleOptions): SoundBank;
|
|
793
|
+
|
|
794
|
+
/** What a reload cue played: its recording, nothing (another cue's recording carries it), or the synthesized steps. */
|
|
795
|
+
type CuePlayed = 'sample' | 'carried' | 'synth';
|
|
796
|
+
/** What sounded for a shot: the recorded takes (`sample`, with the take of each layer) or the synthesized layers (`synth`). */
|
|
797
|
+
type GunshotPlayed = {
|
|
798
|
+
readonly kind: 'synth';
|
|
799
|
+
} | {
|
|
800
|
+
readonly kind: 'sample';
|
|
801
|
+
readonly id: string;
|
|
802
|
+
readonly layers: readonly {
|
|
803
|
+
readonly role: string;
|
|
804
|
+
readonly take: number;
|
|
805
|
+
readonly rate: number;
|
|
806
|
+
}[];
|
|
807
|
+
};
|
|
345
808
|
/** What a shot adds to the energy and the category: where the listener is and how the weapon is set. */
|
|
346
809
|
type ShotExtras = Pick<ShotSoundInput, 'caliber' | 'distance' | 'volume' | 'suppressed' | 'indoors'> & {
|
|
347
810
|
/** 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 +824,9 @@ interface WeaponAudioOptions extends ShotSoundOptions {
|
|
|
361
824
|
/** Pitch spread of a shot, ± this fraction (default 0.04, C5). */
|
|
362
825
|
readonly pitchSpread?: number;
|
|
363
826
|
/** Told each gunshot played (profile, take, pitch, space, distance), so a host can log what sounded. */
|
|
364
|
-
readonly onGunshot?: (shot: Gunshot, input: GunshotInput) => void;
|
|
827
|
+
readonly onGunshot?: (shot: Gunshot, input: GunshotInput, played: GunshotPlayed) => void;
|
|
365
828
|
/** Told each case that lands (floor, case type, sample id). */
|
|
366
|
-
readonly onCasing?: (sound: CasingSound) => void;
|
|
829
|
+
readonly onCasing?: (sound: CasingSound, played: 'sample' | 'synth') => void;
|
|
367
830
|
/** Seed of the noise buffer, of the start point in it and of the casing pitch: same seed, same sound. Default 1. */
|
|
368
831
|
readonly seed?: number;
|
|
369
832
|
/** Replaces or adds mechanical sounds by id. */
|
|
@@ -378,6 +841,11 @@ interface WeaponAudioOptions extends ShotSoundOptions {
|
|
|
378
841
|
* weapon audio makes its own engine with the game mix, no voice limit, and the master at `volume`.
|
|
379
842
|
*/
|
|
380
843
|
readonly engine?: AudioEngine;
|
|
844
|
+
/**
|
|
845
|
+
* 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
|
|
846
|
+
* 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.
|
|
847
|
+
*/
|
|
848
|
+
readonly samples?: WeaponSampleOptions;
|
|
381
849
|
}
|
|
382
850
|
/** Sounds the weapon presentation plays. */
|
|
383
851
|
interface WeaponAudio {
|
|
@@ -391,8 +859,14 @@ interface WeaponAudio {
|
|
|
391
859
|
click(): void;
|
|
392
860
|
/** A mechanical sound by id: a reload stage, `dry_fire`, `jam`, `safety_on`... */
|
|
393
861
|
mechanical(id: MechanicalSoundId): void;
|
|
394
|
-
/**
|
|
395
|
-
|
|
862
|
+
/**
|
|
863
|
+
* 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
|
|
864
|
+
* 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
|
|
865
|
+
* that much later; the synthesized steps, whose hit is at their start, wait `lead`.
|
|
866
|
+
*/
|
|
867
|
+
cue(id: string, profile?: SoundProfile, lead?: number): CuePlayed;
|
|
868
|
+
/** Loads the recorded files now (they load on the first sound otherwise, and the synthesized sound plays meanwhile). */
|
|
869
|
+
loadSamples(): Promise<void>;
|
|
396
870
|
/** The mechanical sound of a weapon event, if it has one (reload stages, empty, misfire, fault, clear, safety, mode, feed). */
|
|
397
871
|
event(event: WeaponEvent): void;
|
|
398
872
|
/** A sound class of the game by name (`impact`, `flesh`, `glass`...), with the game's distance muffling. */
|
|
@@ -796,6 +1270,7 @@ interface WeaponFxOptions {
|
|
|
796
1270
|
weapon: string;
|
|
797
1271
|
cue: string;
|
|
798
1272
|
profile: SoundProfile;
|
|
1273
|
+
played?: CuePlayed;
|
|
799
1274
|
}) => void;
|
|
800
1275
|
/** Builders of accessory models that replace or add to the ones the kit ships (by the `model` of the accessory). */
|
|
801
1276
|
attachmentModels?: AttachmentModelRegistry;
|
|
@@ -889,6 +1364,8 @@ interface WeaponsTestModuleOptions {
|
|
|
889
1364
|
arsenal?: Arsenal;
|
|
890
1365
|
/** Play sounds (default true; silent anyway where there is no AudioContext). */
|
|
891
1366
|
sound?: boolean;
|
|
1367
|
+
/** The recorded shots and reload steps (game-audio's sfx manifest and where its files are); without it the synthesized sounds play. */
|
|
1368
|
+
samples?: WeaponSampleOptions;
|
|
892
1369
|
/** Wear of the weapon in the hands, which the gallery models show in their metal: `new` (default), `used`, `worn` or `rusty`. */
|
|
893
1370
|
condition?: string;
|
|
894
1371
|
/** Seed of the scatter of casings and smoke (default 1). */
|
|
@@ -1015,6 +1492,7 @@ interface ExplosivesText {
|
|
|
1015
1492
|
push_outward: string;
|
|
1016
1493
|
push_falloff: string;
|
|
1017
1494
|
push_person: string;
|
|
1495
|
+
push_sheltered: string;
|
|
1018
1496
|
push_heavy: string;
|
|
1019
1497
|
};
|
|
1020
1498
|
}
|
|
@@ -1056,6 +1534,10 @@ interface ExplosivesRoom {
|
|
|
1056
1534
|
readonly maxHp: number;
|
|
1057
1535
|
})[];
|
|
1058
1536
|
} | null;
|
|
1537
|
+
/** The share of a blast at `point` that reaches `target` through the cover between them (game-destruction `blastReach`). */
|
|
1538
|
+
blastReach?(point: Vec3$1, target: Vec3$1, options?: {
|
|
1539
|
+
readonly ignore?: readonly string[];
|
|
1540
|
+
}): number;
|
|
1059
1541
|
};
|
|
1060
1542
|
readonly renderer: {
|
|
1061
1543
|
impulse(objectId: string, impulse: Vec3$1, point?: Vec3$1): void;
|
|
@@ -1213,4 +1695,4 @@ declare function createExplosivesTestModule(options?: ExplosivesTestModuleOption
|
|
|
1213
1695
|
readonly bench: ReturnType<typeof createExplosivesBench>;
|
|
1214
1696
|
};
|
|
1215
1697
|
|
|
1216
|
-
export {
|
|
1698
|
+
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-BoxqhX_W.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.0",
|
|
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-contracts": "^0.
|
|
48
|
-
"@adatechnology/game-
|
|
49
|
-
"@adatechnology/game-
|
|
50
|
-
"@adatechnology/game-items-three": "^0.7.
|
|
51
|
-
"@adatechnology/game-shapes-three": "^0.3.0",
|
|
47
|
+
"@adatechnology/game-contracts": "^0.23.0",
|
|
48
|
+
"@adatechnology/game-floorplan-three": "^0.9.1",
|
|
49
|
+
"@adatechnology/game-audio": "^0.5.0",
|
|
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.22.0",
|
|
69
69
|
"@adatechnology/golden-tool": "^0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|