@adatechnology/game-weapons-three 0.5.0 → 0.6.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 +1 -1
- package/dist/index.d.ts +32 -3
- package/dist/index.global.js +1631 -120
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +200 -96
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @adatechnology/game-weapons-three
|
|
2
2
|
|
|
3
|
-
three.js presentation for `@adatechnology/game-weapons`: the real models of the arsenal, the weapon in the hands, ejected casings, sounds and the weapons test area.
|
|
3
|
+
three.js presentation for `@adatechnology/game-weapons`: the real models of the arsenal, the weapon in the hands, ejected casings, sounds (recipes on `@adatechnology/game-audio`; `createWeaponAudio(volume, { engine })` plays on a shared engine) and the weapons test area.
|
|
4
4
|
|
|
5
5
|
## Licenses
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HostTool, HostEvent, TestableModule, AreaPlacement, TestableItem, EffectSink, DestructibleSpec, ToolClipSet } from '@adatechnology/game-contracts';
|
|
2
2
|
import { CaliberDef, ReloadStageId, WeaponEvent, MountKind, AttachmentDef, FittedAttachment, Arsenal, ExplosiveDef, WeaponDef, CartridgeDims, CaseType, ReloadFamily } from '@adatechnology/game-weapons';
|
|
3
|
+
import { AudioEngine } from '@adatechnology/game-audio';
|
|
3
4
|
import * as THREE_NS from 'three';
|
|
4
5
|
|
|
5
6
|
/** One sound of the game: [lowpass cutoff Hz, gain, seconds]. Literal from the `P` table of `sfx` in the game (jogo.js L62101-L62104). */
|
|
@@ -135,12 +136,34 @@ type SoundStep =
|
|
|
135
136
|
readonly at: number;
|
|
136
137
|
readonly gain: number;
|
|
137
138
|
readonly frequency: number;
|
|
139
|
+
}
|
|
140
|
+
/** The art scene's `sTone` (cena L1324): a tone sliding from `f` to `f2` (default `f`) in `d` seconds, at `vol`, `at` seconds after the start. */
|
|
141
|
+
| {
|
|
142
|
+
readonly layer: 'scene_tone';
|
|
143
|
+
readonly at: number;
|
|
144
|
+
readonly wave: 'sine' | 'square';
|
|
145
|
+
readonly f: number;
|
|
146
|
+
readonly f2?: number;
|
|
147
|
+
readonly d: number;
|
|
148
|
+
readonly vol: number;
|
|
149
|
+
}
|
|
150
|
+
/** The art scene's `sNoise` (cena L1323): filtered noise, the filter sliding to `f2` when given, `d` seconds, at `vol`. */
|
|
151
|
+
| {
|
|
152
|
+
readonly layer: 'scene_noise';
|
|
153
|
+
readonly at: number;
|
|
154
|
+
readonly type: 'lowpass' | 'highpass' | 'bandpass';
|
|
155
|
+
readonly f: number;
|
|
156
|
+
readonly f2?: number;
|
|
157
|
+
readonly q: number;
|
|
158
|
+
readonly d: number;
|
|
159
|
+
readonly vol: number;
|
|
138
160
|
};
|
|
139
161
|
type MechanicalSoundId = ReloadStageId | 'dry_fire' | 'misfire' | 'feed' | 'cycle' | 'mode' | 'safety_on' | 'safety_off' | 'jam' | 'clear_start' | 'clear_end' | 'stock_fold' | 'light_click' | 'attach';
|
|
140
162
|
/**
|
|
141
163
|
* Sounds keyed by the rule: the `reload_stage` ids of `RELOAD_STAGES`, plus the other weapon events. The click of an empty weapon and the generic
|
|
142
|
-
* reload tick are the game's `vazio` and `recarga` classes (jogo.js L62101-L62104; played at L68644-L68662)
|
|
143
|
-
*
|
|
164
|
+
* reload tick are the game's `vazio` and `recarga` classes (jogo.js L62101-L62104; played at L68644-L68662). The Cena de Arte delivered the reload sounds
|
|
165
|
+
* (`empty` -> dry_fire, `magOut` -> magazine_out, `magIn` -> magazine_in, `bolt` -> charge, `shell` -> round_in; cena L1339-L1343), so those use them; the gallery
|
|
166
|
+
* (sources/armas-itens__galeria-3d-arsenal.js) has no sound, and the other metal layers are the SDK synth (the same `metal` used since the first version).
|
|
144
167
|
*/
|
|
145
168
|
declare const MECHANICAL_SOUNDS: Readonly<Record<MechanicalSoundId, readonly SoundStep[]>>;
|
|
146
169
|
/** Which mechanical sound a weapon event asks for, if any (`shot`, `draw` and `reload` start/end have their own handling). */
|
|
@@ -153,8 +176,14 @@ interface WeaponAudioOptions extends ShotSoundOptions {
|
|
|
153
176
|
readonly seed?: number;
|
|
154
177
|
/** Replaces or adds mechanical sounds by id. */
|
|
155
178
|
readonly mechanical?: Readonly<Partial<Record<MechanicalSoundId, readonly SoundStep[]>>>;
|
|
156
|
-
/** Where the AudioContext comes from (default: the global one); lets a host or a test lend its own. */
|
|
179
|
+
/** Where the AudioContext comes from (default: the global one); lets a host or a test lend its own. Not used with `engine`. */
|
|
157
180
|
readonly createContext?: () => AudioContext;
|
|
181
|
+
/**
|
|
182
|
+
* A sound engine the host already has (one shared engine mixes, limits and pans every module the same way). The weapon sounds are registered in it
|
|
183
|
+
* and play on its `weapons` bus; `seed` gives them their own random stream, the master volume and the context stay the engine's. Without it the
|
|
184
|
+
* weapon audio makes its own engine with the game mix, no voice limit, and the master at `volume`.
|
|
185
|
+
*/
|
|
186
|
+
readonly engine?: AudioEngine;
|
|
158
187
|
}
|
|
159
188
|
/** Sounds the weapon presentation plays. */
|
|
160
189
|
interface WeaponAudio {
|