@adatechnology/game-weapons-three 0.26.4 → 0.27.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-CGGF5CDD.js → chunk-6L7CAZIF.js} +21 -2
- package/dist/chunk-6L7CAZIF.js.map +1 -0
- package/dist/index.d.ts +21 -20
- package/dist/index.global.js +45 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{testing-C9yn3tJI.d.ts → testing-Bk34V-6X.d.ts} +2 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-CGGF5CDD.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as ItemModels, W as WeaponProps, a as WeaponItemModel, M as ModelOptions, b as WeaponModel, c as ModelKit, d as ModelParts, e as ModelFamily, A as AttachmentModelRegistry, L as LaserRaycast } from './testing-
|
|
2
|
-
export { f as AttachmentBuildContext, g as AttachmentModel, h as AttachmentModelBuilder, C as CLASS_REFERENCE_ENERGY, i as COUNTER_ITEM_ID, j as CUES_IN_SAMPLE, k as CasingSound, l as CuePlayed, D as DEFAULT_ENERGY_CURVE, m as DEFAULT_EXPLOSIVES_SCENE, n as DistanceCurve, E as EXPLOSIVES_AREA_ID, o as EXPLOSIVES_TEXT, p as EnergyCurve, q as ExplosivesRoom, r as ExplosivesScene, s as ExplosivesTestModuleOptions, t as ExplosivesText, F as FlybySound, u as FxLayers, G as GAME_DISTANCE_CURVE, v as GAME_SOUND_CLASSES, w as GUNSHOT_PROFILES, x as GUNSHOT_SAMPLE, y as GUNSHOT_SAMPLE_IDS, z as Gunshot, B as GunshotInput, H as GunshotPlayed, J as ItemModelRequest, K as LAUNCH_SAMPLE, N as LAUNCH_SOUND_IDS, O as LaunchKind, P as MECHANICAL_SOUNDS, Q as MOUNTED_M134_ITEM_ID, R as MechanicalSoundId, S as ModelMaterials, T as MountFrame, U as RELOAD_SAMPLE, V as RELOAD_SAMPLE_HITS, X as ShotExtras, Y as ShotSound, Z as ShotSoundClass, _ as ShotSoundInput, $ as ShotSoundOptions, a0 as SoundClassDef, a1 as SoundStep, a2 as WEAPON_ITEM_PREFIX, a3 as WEIGHT_INTENSITY, a4 as WeaponAudio, a5 as WeaponAudioOptions, a6 as WeaponFx, a7 as WeaponFxOptions, a8 as WeaponModelDef, a9 as WeaponSampleOptions, aa as WeaponsTestModuleOptions, ab as buildItemWeaponModel, ac as buildThrowableModel, ad as buildWeaponModel, ae as computeCasingSound, af as computeFlyby, ag as computeGunshot, ah as computeShotSound, ai as createExplosivesTestModule, aj as createWeaponAudio, ak as createWeaponFx, al as createWeaponsTestModule, am as defaultWeaponProps, an as deriveFrames, ao as explosivesTextOf, ap as hasThrowableModel, aq as itemModelOfWeapon, ar as mechanicalSoundOf, as as modelKit, at as mountFrame, au as registerWeaponItemModel, av as weaponSampleBank, aw as weaponSampleDefaults, ax as weaponsLayout } from './testing-
|
|
1
|
+
import { I as ItemModels, W as WeaponProps, a as WeaponItemModel, M as ModelOptions, b as WeaponModel, c as ModelKit, d as ModelParts, e as ModelFamily, A as AttachmentModelRegistry, L as LaserRaycast } from './testing-Bk34V-6X.js';
|
|
2
|
+
export { f as AttachmentBuildContext, g as AttachmentModel, h as AttachmentModelBuilder, C as CLASS_REFERENCE_ENERGY, i as COUNTER_ITEM_ID, j as CUES_IN_SAMPLE, k as CasingSound, l as CuePlayed, D as DEFAULT_ENERGY_CURVE, m as DEFAULT_EXPLOSIVES_SCENE, n as DistanceCurve, E as EXPLOSIVES_AREA_ID, o as EXPLOSIVES_TEXT, p as EnergyCurve, q as ExplosivesRoom, r as ExplosivesScene, s as ExplosivesTestModuleOptions, t as ExplosivesText, F as FlybySound, u as FxLayers, G as GAME_DISTANCE_CURVE, v as GAME_SOUND_CLASSES, w as GUNSHOT_PROFILES, x as GUNSHOT_SAMPLE, y as GUNSHOT_SAMPLE_IDS, z as Gunshot, B as GunshotInput, H as GunshotPlayed, J as ItemModelRequest, K as LAUNCH_SAMPLE, N as LAUNCH_SOUND_IDS, O as LaunchKind, P as MECHANICAL_SOUNDS, Q as MOUNTED_M134_ITEM_ID, R as MechanicalSoundId, S as ModelMaterials, T as MountFrame, U as RELOAD_SAMPLE, V as RELOAD_SAMPLE_HITS, X as ShotExtras, Y as ShotSound, Z as ShotSoundClass, _ as ShotSoundInput, $ as ShotSoundOptions, a0 as SoundClassDef, a1 as SoundStep, a2 as WEAPON_ITEM_PREFIX, a3 as WEIGHT_INTENSITY, a4 as WeaponAudio, a5 as WeaponAudioOptions, a6 as WeaponFx, a7 as WeaponFxOptions, a8 as WeaponModelDef, a9 as WeaponSampleOptions, aa as WeaponsTestModuleOptions, ab as buildItemWeaponModel, ac as buildThrowableModel, ad as buildWeaponModel, ae as computeCasingSound, af as computeFlyby, ag as computeGunshot, ah as computeShotSound, ai as createExplosivesTestModule, aj as createWeaponAudio, ak as createWeaponFx, al as createWeaponsTestModule, am as defaultWeaponProps, an as deriveFrames, ao as explosivesTextOf, ap as hasThrowableModel, aq as itemModelOfWeapon, ar as mechanicalSoundOf, as as modelKit, at as mountFrame, au as registerWeaponItemModel, av as weaponSampleBank, aw as weaponSampleDefaults, ax as weaponsLayout } from './testing-Bk34V-6X.js';
|
|
3
3
|
import * as THREE_NS from 'three';
|
|
4
4
|
import { TestableItem, Vec3, HostEvent, EffectSink, DestructibleSpec, DeepPartial, ToolClipSet, HandPose, HandTargets } from '@adatechnology/game-contracts';
|
|
5
5
|
import { ExplosiveDef, Arsenal, WeaponDef, CartridgeDims, CaliberDef, CaseType, ReloadFamily, FittedAttachment, AttachmentDef } from '@adatechnology/game-weapons';
|
|
@@ -61,24 +61,6 @@ declare const createWorldExplosiveShells: (THREE: typeof THREE_NS, defId: string
|
|
|
61
61
|
/** An explosive of the arsenal standing in the world: it goes off by a bullet, fire or another blast, after the delay its `chain` gives. */
|
|
62
62
|
declare const worldExplosiveItem: (def: ExplosiveDef, name: string, options?: WorldExplosiveOptions) => TestableItem | undefined;
|
|
63
63
|
|
|
64
|
-
/** What a host asks for a thrown or set down explosive: the weapon in the hand, the explosive it carries and how it is used (`rocket`, `grenade`, `molotov`, `charge`). */
|
|
65
|
-
interface ProjectileQuery {
|
|
66
|
-
readonly weapon: string;
|
|
67
|
-
readonly explosive?: string | undefined;
|
|
68
|
-
readonly kind: string;
|
|
69
|
-
}
|
|
70
|
-
/** The model of a projectile and the axis along its length. */
|
|
71
|
-
interface ProjectileModel {
|
|
72
|
-
readonly model: THREE_NS.Object3D;
|
|
73
|
-
readonly axis: [number, number, number];
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The model of what a weapon throws or fires, drawn by the same code as the weapon itself: the round of a rocket launcher (the RPG-7's PG-7V, the Carl Gustaf's 84 mm round, the rocket of
|
|
77
|
-
* the disposable tubes), long axis +x, and the explosives of the gallery (the M67, the molotov, the pipe bomb, the dynamite, the C4, the Claymore, the flashbang), centred, axis +y.
|
|
78
|
-
* Answers `null` where the gallery has no model (the 40 mm grenade of a launcher), and a host keeps its primitive for it.
|
|
79
|
-
*/
|
|
80
|
-
declare function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null;
|
|
81
|
-
|
|
82
64
|
/** Rolling resistance of the kit's round loose pieces (a casing, a grenade) on a hard floor: the C_rr the gate-0 B2 run settled on. */
|
|
83
65
|
declare const LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
84
66
|
/** What the engine needs to make a loose body from what the gallery drew. */
|
|
@@ -119,6 +101,25 @@ interface LooseReading {
|
|
|
119
101
|
declare function syncLoose(world: SeamWorld, body: LooseBody, object: THREE_NS.Object3D): LooseReading;
|
|
120
102
|
declare function dropLoose(world: SeamWorld, body: LooseBody): void;
|
|
121
103
|
|
|
104
|
+
/** What a host asks for a thrown or set down explosive: the weapon in the hand, the explosive it carries and how it is used (`rocket`, `grenade`, `molotov`, `charge`). */
|
|
105
|
+
interface ProjectileQuery {
|
|
106
|
+
readonly weapon: string;
|
|
107
|
+
readonly explosive?: string | undefined;
|
|
108
|
+
readonly kind: string;
|
|
109
|
+
}
|
|
110
|
+
/** The model of a projectile, the axis along its length and, for a hand grenade the engine can fly, its collider (the model's own parts, centred on it). */
|
|
111
|
+
interface ProjectileModel {
|
|
112
|
+
readonly model: THREE_NS.Object3D;
|
|
113
|
+
readonly axis: [number, number, number];
|
|
114
|
+
readonly body?: LooseCollider;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The model of what a weapon throws or fires, drawn by the same code as the weapon itself: the round of a rocket launcher (the RPG-7's PG-7V, the Carl Gustaf's 84 mm round, the rocket of
|
|
118
|
+
* the disposable tubes), long axis +x, and the explosives of the gallery (the M67, the molotov, the pipe bomb, the dynamite, the C4, the Claymore, the flashbang), centred, axis +y.
|
|
119
|
+
* Answers `null` where the gallery has no model (the 40 mm grenade of a launcher), and a host keeps its primitive for it.
|
|
120
|
+
*/
|
|
121
|
+
declare function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null;
|
|
122
|
+
|
|
122
123
|
/** The effect ids a weapon of a case type shows when it is seen from outside: its muzzle flash and its ejected case (the host's catalogue names them). */
|
|
123
124
|
interface WorldEffectIds {
|
|
124
125
|
readonly muzzle: string;
|
package/dist/index.global.js
CHANGED
|
@@ -67747,6 +67747,30 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67747
67747
|
return { spec: made.spec, build: made.build, top: made.top, size: { w, d, h }, spouts, fixed: made.fixed };
|
|
67748
67748
|
}
|
|
67749
67749
|
|
|
67750
|
+
// ../game-physics/dist/index.js
|
|
67751
|
+
var KIT_WORLD = {
|
|
67752
|
+
fixedStep: 1 / 120,
|
|
67753
|
+
velocityIterations: 32,
|
|
67754
|
+
positionIterations: 2,
|
|
67755
|
+
sleepAfter: 0.5,
|
|
67756
|
+
sleepSpeed: 0.08,
|
|
67757
|
+
penetrationSlop: 2e-3,
|
|
67758
|
+
maxPushOut: 2e-3,
|
|
67759
|
+
slipSpeed: 0.02,
|
|
67760
|
+
contactReportSpeed: 0.5,
|
|
67761
|
+
maxContacts: 4096,
|
|
67762
|
+
maxBodies: 8192
|
|
67763
|
+
};
|
|
67764
|
+
var POSE = new Float64Array(7);
|
|
67765
|
+
var VELOCITY = new Float64Array(6);
|
|
67766
|
+
var POSE2 = new Float64Array(7);
|
|
67767
|
+
var GOLDEN_ANGLE = Math.PI * (1 + Math.sqrt(5));
|
|
67768
|
+
var isPhysicsServices = (value) => {
|
|
67769
|
+
if (typeof value !== "object" || value === null) return false;
|
|
67770
|
+
const candidate = value;
|
|
67771
|
+
return typeof candidate.corpses === "function" && typeof candidate.setInterest === "function" && typeof candidate.blast === "object" && typeof candidate.loop === "object" && typeof candidate.world === "object";
|
|
67772
|
+
};
|
|
67773
|
+
|
|
67750
67774
|
// src/attachments-key.ts
|
|
67751
67775
|
var attachmentsKey = (parts2) => {
|
|
67752
67776
|
if (!parts2) return "";
|
|
@@ -89359,6 +89383,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89359
89383
|
get magazines() {
|
|
89360
89384
|
return bodies.filter((b) => b.kind === "magazine").length;
|
|
89361
89385
|
},
|
|
89386
|
+
clearLoose() {
|
|
89387
|
+
for (const body of [...bodies]) removeBody(body);
|
|
89388
|
+
},
|
|
89362
89389
|
dispose() {
|
|
89363
89390
|
for (const body of [...bodies]) removeBody(body);
|
|
89364
89391
|
hand.removeFromParent();
|
|
@@ -100231,8 +100258,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100231
100258
|
}
|
|
100232
100259
|
},
|
|
100233
100260
|
count: (kind) => list2.filter((particle) => particle.kind === kind).length,
|
|
100234
|
-
|
|
100261
|
+
clear() {
|
|
100235
100262
|
for (const particle of [...list2]) remove(particle);
|
|
100263
|
+
},
|
|
100264
|
+
dispose() {
|
|
100265
|
+
api.clear();
|
|
100236
100266
|
}
|
|
100237
100267
|
};
|
|
100238
100268
|
return api;
|
|
@@ -101427,6 +101457,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101427
101457
|
get magazines() {
|
|
101428
101458
|
return particles.count("magazine");
|
|
101429
101459
|
},
|
|
101460
|
+
clearLoose() {
|
|
101461
|
+
particles.clear();
|
|
101462
|
+
},
|
|
101430
101463
|
dispose() {
|
|
101431
101464
|
release();
|
|
101432
101465
|
particles.dispose();
|
|
@@ -101572,6 +101605,12 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101572
101605
|
get magazines() {
|
|
101573
101606
|
return box5.magazines + model.magazines + (left ? left.box.magazines + left.model.magazines : 0);
|
|
101574
101607
|
},
|
|
101608
|
+
clearLoose() {
|
|
101609
|
+
box5.clearLoose();
|
|
101610
|
+
model.clearLoose();
|
|
101611
|
+
left?.box.clearLoose();
|
|
101612
|
+
left?.model.clearLoose();
|
|
101613
|
+
},
|
|
101575
101614
|
dispose() {
|
|
101576
101615
|
box5.dispose();
|
|
101577
101616
|
model.dispose();
|
|
@@ -103283,6 +103322,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103283
103322
|
motion: () => ({ speed: lent.player().speed, running: lent.player().running }),
|
|
103284
103323
|
...lent.effects ? { effects: lent.effects } : {},
|
|
103285
103324
|
...lent.particleLimit ? { particleLimit: lent.particleLimit } : {},
|
|
103325
|
+
...isPhysicsServices(lent.physics) ? { physics: lent.physics.world } : {},
|
|
103286
103326
|
...isLightBudget(lent.lights) ? { lights: lent.lights } : {},
|
|
103287
103327
|
...isRenderPools(lent.pools) ? { pools: lent.pools } : {},
|
|
103288
103328
|
...options.attachmentModels ? { attachmentModels: options.attachmentModels } : {},
|
|
@@ -103344,6 +103384,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103344
103384
|
});
|
|
103345
103385
|
const offHands = lent.setHandTargets?.(() => holstered?.handTargets() ?? created.handTargets());
|
|
103346
103386
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
103387
|
+
const offClear = lent.onClear?.(() => created.clearLoose());
|
|
103347
103388
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
103348
103389
|
return () => {
|
|
103349
103390
|
accessories.dispose();
|
|
@@ -103354,6 +103395,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
103354
103395
|
offClock();
|
|
103355
103396
|
offHands?.();
|
|
103356
103397
|
offMuzzle?.();
|
|
103398
|
+
offClear?.();
|
|
103357
103399
|
created.dispose();
|
|
103358
103400
|
holstered?.dispose();
|
|
103359
103401
|
audio?.dispose();
|
|
@@ -104430,7 +104472,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
104430
104472
|
holder.name = model.name;
|
|
104431
104473
|
model.position.sub(centre);
|
|
104432
104474
|
holder.add(model);
|
|
104433
|
-
|
|
104475
|
+
const body = query2.kind === "grenade" && query2.explosive !== void 0 ? explosiveCollider(THREE, query2.explosive) : void 0;
|
|
104476
|
+
return { model: holder, axis: [0, 1, 0], ...body ? { body } : {} };
|
|
104434
104477
|
}
|
|
104435
104478
|
|
|
104436
104479
|
// src/weapon-props.ts
|