@adatechnology/game-weapons-three 0.18.0 → 0.18.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-V47DJ55G.js → chunk-4HWHC6US.js} +23 -5
- package/dist/chunk-4HWHC6US.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +139 -31
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-CRjxCHxK.d.ts → testing-I8H8oNSD.d.ts} +12 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-V47DJ55G.js.map +0 -1
|
@@ -8522,6 +8522,8 @@ var GUNSHOT_SAMPLE = {
|
|
|
8522
8522
|
priority: 3
|
|
8523
8523
|
};
|
|
8524
8524
|
var SUPPRESSED_SAMPLE = { ...GUNSHOT_SAMPLE, gain: 0.55, crossover: { from: 10, to: 50 }, falloff: { model: "inverse_square", k: 4e-3, minGain: 8e-4 } };
|
|
8525
|
+
var LAUNCH_SAMPLE = { bus: "weapons", gain: 0.9, pitch: 0.04, falloff: { model: "inverse_square", k: 1e-3, minGain: 1e-3 }, cutoffK: 0.03, priority: 3 };
|
|
8526
|
+
var LAUNCH_IDS = /* @__PURE__ */ new Set(["launcher_40mm", "rocket_launch"]);
|
|
8525
8527
|
var RELOAD_SAMPLE = { bus: "weapons", gain: 0.32, pitch: 0.05, falloff: { model: "inverse_square", k: 0.05, minGain: 2e-3 }, cutoffK: 0.02, priority: 2 };
|
|
8526
8528
|
var CASING_SAMPLE = { bus: "weapons", gain: 0.22, pitch: 0.06, falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 }, cutoffK: 0.03, priority: 1 };
|
|
8527
8529
|
var casingSampleId = (sample) => sample.replace(/_(pistol|rifle|shell)$/, "");
|
|
@@ -8531,7 +8533,7 @@ var CUES_IN_SAMPLE = { mag_release: "mag_out", mag_insert: "mag_seat" };
|
|
|
8531
8533
|
var isGunshot = (id) => GUNSHOT_SAMPLE_IDS.includes(id);
|
|
8532
8534
|
function weaponSampleDefaults(sound3, overrides = {}) {
|
|
8533
8535
|
if (sound3.category !== "armas") return void 0;
|
|
8534
|
-
const base = sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : sound3.id.startsWith("casing_drop_") || sound3.id.startsWith("mag_drop_") ? CASING_SAMPLE : RELOAD_SAMPLE;
|
|
8536
|
+
const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : sound3.id.startsWith("casing_drop_") || sound3.id.startsWith("mag_drop_") ? CASING_SAMPLE : RELOAD_SAMPLE;
|
|
8535
8537
|
return { ...base, ...overrides[sound3.id] };
|
|
8536
8538
|
}
|
|
8537
8539
|
function weaponSampleBank(options) {
|
|
@@ -8552,6 +8554,8 @@ function weaponSampleBank(options) {
|
|
|
8552
8554
|
}
|
|
8553
8555
|
|
|
8554
8556
|
// src/audio.ts
|
|
8557
|
+
var LAUNCH_SOUND_IDS = { grenade: "launcher_40mm", rocket: "rocket_launch" };
|
|
8558
|
+
var LAUNCH_HALF_AT = 40;
|
|
8555
8559
|
var NOISE_SECONDS = 1.5;
|
|
8556
8560
|
var DEFAULT_SEED = 1;
|
|
8557
8561
|
function createWeaponAudio(volume = 0.6, options = {}) {
|
|
@@ -8758,6 +8762,17 @@ function createWeaponAudio(volume = 0.6, options = {}) {
|
|
|
8758
8762
|
}
|
|
8759
8763
|
burst({ seconds: 0.09, gain: 0.35 * (input.speed === void 0 ? 1 : Math.min(1, Math.max(0.3, input.speed / 2.5))) * ((input.bounce ?? 0) === 0 ? 1 : 0.5), filter: "lowpass", frequency: 380 });
|
|
8760
8764
|
},
|
|
8765
|
+
launch(kind, volume2 = 1, distance = 0) {
|
|
8766
|
+
const level = Math.min(1, volume2 / (1 + distance / LAUNCH_HALF_AT));
|
|
8767
|
+
const id = LAUNCH_SOUND_IDS[kind];
|
|
8768
|
+
if (hostReady(id)) {
|
|
8769
|
+
channel.play(id, { volume: level });
|
|
8770
|
+
return;
|
|
8771
|
+
}
|
|
8772
|
+
burst({ seconds: kind === "rocket" ? 0.22 : 0.16, gain: 0.7 * level, filter: "lowpass", frequency: kind === "rocket" ? 220 : 170 });
|
|
8773
|
+
burst({ seconds: 0.035, gain: 0.25 * level, filter: "highpass", frequency: 1800 });
|
|
8774
|
+
if (kind === "rocket") burst({ seconds: 0.8, gain: 0.3 * level, filter: "highpass", frequency: 1100, at: 0.04 });
|
|
8775
|
+
},
|
|
8761
8776
|
setVolume(next) {
|
|
8762
8777
|
const level = Math.max(0, Math.min(1, next));
|
|
8763
8778
|
if (shared) shared.setBus("weapons", { gain: level });
|
|
@@ -12217,13 +12232,14 @@ function createViewmodel(options) {
|
|
|
12217
12232
|
else if (tool.suppressed !== void 0) current.suppressed = tool.suppressed;
|
|
12218
12233
|
else current.suppressed = hasSuppressor(tool.attachments ? fittedOf2(tool.attachments) : current.def.fitted ?? []);
|
|
12219
12234
|
if (tool.underbarrelActive && current.model.parts.uglMuzzle) {
|
|
12220
|
-
audio?.
|
|
12235
|
+
audio?.launch("grenade", LAUNCH_VOLUME, distance());
|
|
12221
12236
|
return;
|
|
12222
12237
|
}
|
|
12223
12238
|
const action = current.def.action;
|
|
12224
12239
|
if (action.kind === "launcher") {
|
|
12225
|
-
|
|
12226
|
-
|
|
12240
|
+
const isRocket = current.model.parts.family === "rocket";
|
|
12241
|
+
if (isRocket) launchRocket(heavy(current), options.flyRocket !== false);
|
|
12242
|
+
audio?.launch(isRocket ? "rocket" : "grenade", LAUNCH_VOLUME, distance());
|
|
12227
12243
|
}
|
|
12228
12244
|
if (action.kind !== "firearm") return;
|
|
12229
12245
|
const caliber = caliberOf(arsenal, current.def);
|
|
@@ -15059,12 +15075,14 @@ export {
|
|
|
15059
15075
|
computeFlyby,
|
|
15060
15076
|
GUNSHOT_SAMPLE_IDS,
|
|
15061
15077
|
GUNSHOT_SAMPLE,
|
|
15078
|
+
LAUNCH_SAMPLE,
|
|
15062
15079
|
RELOAD_SAMPLE,
|
|
15063
15080
|
RELOAD_SAMPLE_HITS,
|
|
15064
15081
|
WEIGHT_INTENSITY,
|
|
15065
15082
|
CUES_IN_SAMPLE,
|
|
15066
15083
|
weaponSampleDefaults,
|
|
15067
15084
|
weaponSampleBank,
|
|
15085
|
+
LAUNCH_SOUND_IDS,
|
|
15068
15086
|
createWeaponAudio,
|
|
15069
15087
|
VIEW_HOLD,
|
|
15070
15088
|
toWorldLens,
|
|
@@ -15123,4 +15141,4 @@ export {
|
|
|
15123
15141
|
DEFAULT_EXPLOSIVES_SCENE,
|
|
15124
15142
|
createExplosivesTestModule
|
|
15125
15143
|
};
|
|
15126
|
-
//# sourceMappingURL=chunk-
|
|
15144
|
+
//# sourceMappingURL=chunk-4HWHC6US.js.map
|