@adatechnology/game-weapons-three 0.17.1 → 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.
Files changed (46) hide show
  1. package/assets/weapon-references.json +1385 -0
  2. package/assets/weapon-svg/CREDITS.md +1 -1
  3. package/assets/weapon-svg/credits.html +1 -1
  4. package/assets/weapon-svg/generated/accuracy_l96a1.svg +1 -0
  5. package/assets/weapon-svg/generated/aks_74u.svg +1 -0
  6. package/assets/weapon-svg/generated/brass_knuckles.svg +1 -0
  7. package/assets/weapon-svg/generated/bt_mp9.svg +1 -0
  8. package/assets/weapon-svg/generated/colt_python.svg +1 -0
  9. package/assets/weapon-svg/generated/famas.svg +1 -0
  10. package/assets/weapon-svg/generated/fn_m240b.svg +1 -0
  11. package/assets/weapon-svg/generated/fn_ps90.svg +1 -0
  12. package/assets/weapon-svg/generated/fn_scar_l.svg +1 -0
  13. package/assets/weapon-svg/generated/hk_g36.svg +1 -1
  14. package/assets/weapon-svg/generated/hk_g36c.svg +1 -1
  15. package/assets/weapon-svg/generated/hk_g36k.svg +1 -1
  16. package/assets/weapon-svg/generated/hk_usp.svg +1 -0
  17. package/assets/weapon-svg/generated/iwi_tavor.svg +1 -0
  18. package/assets/weapon-svg/generated/kabar.svg +1 -0
  19. package/assets/weapon-svg/generated/katana.svg +1 -0
  20. package/assets/weapon-svg/generated/l85a2.svg +1 -0
  21. package/assets/weapon-svg/generated/m1_garand.svg +1 -0
  22. package/assets/weapon-svg/generated/m32_mgl.svg +1 -0
  23. package/assets/weapon-svg/generated/mauser_kar98k.svg +1 -0
  24. package/assets/weapon-svg/generated/mg42.svg +1 -0
  25. package/assets/weapon-svg/generated/mossberg_590.svg +1 -0
  26. package/assets/weapon-svg/generated/mp40.svg +1 -0
  27. package/assets/weapon-svg/generated/ppsh_41.svg +1 -0
  28. package/assets/weapon-svg/generated/semtex.svg +1 -0
  29. package/assets/weapon-svg/generated/sig_sauer_p320.svg +1 -0
  30. package/assets/weapon-svg/generated/smoke_grenade.svg +1 -0
  31. package/assets/weapon-svg/generated/vss_vintorez.svg +1 -0
  32. package/assets/weapon-svg/generated/walther_p99.svg +1 -0
  33. package/assets/weapon-svg/generated/winchester_1887.svg +1 -0
  34. package/assets/weapon-svg/manifest.json +108 -0
  35. package/dist/{chunk-BDYIF7JD.js → chunk-4HWHC6US.js} +9488 -5841
  36. package/dist/chunk-4HWHC6US.js.map +1 -0
  37. package/dist/index.d.ts +10 -6
  38. package/dist/index.global.js +24137 -18534
  39. package/dist/index.global.js.map +1 -1
  40. package/dist/index.js +9 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/{testing-BKDGK6cq.d.ts → testing-I8H8oNSD.d.ts} +50 -5
  43. package/dist/testing.d.ts +1 -1
  44. package/dist/testing.js +1 -1
  45. package/package.json +9 -9
  46. package/dist/chunk-BDYIF7JD.js.map +0 -1
package/dist/index.js CHANGED
@@ -16,6 +16,8 @@ import {
16
16
  GUNSHOT_PROFILES,
17
17
  GUNSHOT_SAMPLE,
18
18
  GUNSHOT_SAMPLE_IDS,
19
+ LAUNCH_SAMPLE,
20
+ LAUNCH_SOUND_IDS,
19
21
  MECHANICAL_SOUNDS,
20
22
  MODEL_ENTRIES,
21
23
  MOUNTED_M134_ITEM_ID,
@@ -36,6 +38,7 @@ import {
36
38
  buildCasing,
37
39
  buildExplosiveModel,
38
40
  buildFlyingRocket,
41
+ buildHandheldModel,
39
42
  buildItemWeaponModel,
40
43
  buildModeledProp,
41
44
  buildProp,
@@ -60,6 +63,7 @@ import {
60
63
  explosivesTextOf,
61
64
  fitAttachmentModels,
62
65
  hasExplosiveModel,
66
+ hasHandheldModel,
63
67
  hasThrowableModel,
64
68
  hasWeaponModel,
65
69
  itemModelOfWeapon,
@@ -82,7 +86,7 @@ import {
82
86
  worldExplosiveItem,
83
87
  worldExplosiveShell,
84
88
  worldExplosiveValve
85
- } from "./chunk-BDYIF7JD.js";
89
+ } from "./chunk-4HWHC6US.js";
86
90
 
87
91
  // src/projectile-model.ts
88
92
  import { markKitOrigin } from "@adatechnology/game-contracts";
@@ -133,6 +137,8 @@ export {
133
137
  GUNSHOT_PROFILES,
134
138
  GUNSHOT_SAMPLE,
135
139
  GUNSHOT_SAMPLE_IDS,
140
+ LAUNCH_SAMPLE,
141
+ LAUNCH_SOUND_IDS,
136
142
  MECHANICAL_SOUNDS,
137
143
  MODEL_ENTRIES,
138
144
  MOUNTED_M134_ITEM_ID,
@@ -151,6 +157,7 @@ export {
151
157
  buildCartridge,
152
158
  buildCasing,
153
159
  buildExplosiveModel,
160
+ buildHandheldModel,
154
161
  buildItemWeaponModel,
155
162
  buildModeledProp,
156
163
  buildProp,
@@ -176,6 +183,7 @@ export {
176
183
  explosivesTextOf,
177
184
  fitAttachmentModels,
178
185
  hasExplosiveModel,
186
+ hasHandheldModel,
179
187
  hasThrowableModel,
180
188
  hasWeaponModel,
181
189
  itemModelOfWeapon,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/projectile-model.ts","../src/weapon-props.ts"],"sourcesContent":["import { markKitOrigin } from '@adatechnology/game-contracts'\nimport type * as THREE_NS from 'three'\n\nimport { buildWeaponModelById } from './models'\nimport { buildExplosiveModel } from './models/explosives'\nimport { modelKit } from './models/kit'\nimport { buildFlyingRocket } from './models/launcher-rounds'\n\n/** 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`). */\nexport interface ProjectileQuery {\n readonly weapon: string\n readonly explosive?: string | undefined\n readonly kind: string\n}\n\n/** The model of a projectile and the axis along its length. */\nexport interface ProjectileModel {\n readonly model: THREE_NS.Object3D\n readonly axis: [number, number, number]\n}\n\n/**\n * 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\n * 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.\n * Answers `null` where the gallery has no model (the 40 mm grenade of a launcher), and a host keeps its primitive for it.\n */\nexport function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null {\n if (query.kind !== 'rocket') return explosiveProjectile(THREE, query)\n const launcher = buildWeaponModelById(THREE, query.weapon)\n if (!launcher || launcher.parts.family !== 'rocket') return null\n const round = launcher.parts.makeRound ? launcher.parts.makeRound() : buildFlyingRocket(modelKit(THREE), launcher.parts.launcherType)\n return { model: round, axis: [1, 0, 0] }\n}\n\n// a thrown or set down explosive the gallery drew: its model centred on its middle (it tumbles about it in flight), standing axis +y\nfunction explosiveProjectile(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null {\n const model = query.explosive === undefined ? undefined : buildExplosiveModel(THREE, query.explosive)\n if (!model) return null\n const centre = new THREE.Box3().setFromObject(model).getCenter(new THREE.Vector3())\n const holder = markKitOrigin(new THREE.Group(), { owner: 'game-weapons-three', kind: 'explosive', id: model.name })\n holder.name = model.name\n model.position.sub(centre)\n holder.add(model)\n return { model: holder, axis: [0, 1, 0] }\n}\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\n\nimport { SHIPPED_WEAPON_ITEM_MODELS, weaponPropsOver } from './weapon-item-model'\nimport type { WeaponItemModel, WeaponProps } from './weapon-item-model'\n\nexport interface WeaponPropsOptions {\n /** Item model overrides by weapon id, added to the shipped ones (`null` keeps the low-poly prop); later packs replace earlier ones. */\n readonly packs?: readonly Readonly<Record<string, WeaponItemModel | null>>[]\n /** Changes to an override by weapon id, merged field by field. */\n readonly patch?: Readonly<Record<string, DeepPartial<WeaponItemModel>>>\n /** Weapon ids whose override is taken out (the weapon id itself is then the item model id). */\n readonly remove?: readonly string[]\n}\n\ntype Entry = { readonly id: string; readonly model: WeaponItemModel }\n\n/** A set of weapon prop overrides of its own: the shipped ones plus `packs`, `patch` and `remove`. Nothing is shared with any other set on the page. */\nexport function createWeaponProps(options: WeaponPropsOptions = {}): WeaponProps {\n const entryOf = ([id, model]: readonly [string, WeaponItemModel | null]): Entry => ({ id, model: model ?? { item: '' } })\n const entries = mergeById<Entry>(SHIPPED_WEAPON_ITEM_MODELS.map(entryOf), (options.packs ?? []).flatMap((pack) => Object.entries(pack).map(entryOf)))\n const patches: Record<string, { model: DeepPartial<WeaponItemModel> }> = {}\n for (const [id, model] of Object.entries(options.patch ?? {})) patches[id] = { model }\n applyPatches(entries, patches)\n removeIds(entries, options.remove)\n return weaponPropsOver(new Map([...entries].map(([id, entry]) => [id, entry.model])))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AA0BvB,SAAS,gBAAgB,OAAwB,OAAgD;AACtG,MAAI,MAAM,SAAS,SAAU,QAAO,oBAAoB,OAAO,KAAK;AACpE,QAAM,WAAW,qBAAqB,OAAO,MAAM,MAAM;AACzD,MAAI,CAAC,YAAY,SAAS,MAAM,WAAW,SAAU,QAAO;AAC5D,QAAM,QAAQ,SAAS,MAAM,YAAY,SAAS,MAAM,UAAU,IAAI,kBAAkB,SAAS,KAAK,GAAG,SAAS,MAAM,YAAY;AACpI,SAAO,EAAE,OAAO,OAAO,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE;AACzC;AAGA,SAAS,oBAAoB,OAAwB,OAAgD;AACnG,QAAM,QAAQ,MAAM,cAAc,SAAY,SAAY,oBAAoB,OAAO,MAAM,SAAS;AACpG,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,SAAS,IAAI,MAAM,KAAK,EAAE,cAAc,KAAK,EAAE,UAAU,IAAI,MAAM,QAAQ,CAAC;AAClF,QAAM,SAAS,cAAc,IAAI,MAAM,MAAM,GAAG,EAAE,OAAO,sBAAsB,MAAM,aAAa,IAAI,MAAM,KAAK,CAAC;AAClH,SAAO,OAAO,MAAM;AACpB,QAAM,SAAS,IAAI,MAAM;AACzB,SAAO,IAAI,KAAK;AAChB,SAAO,EAAE,OAAO,QAAQ,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE;AAC1C;;;AC5CA,SAAS,cAAc,WAAW,iBAAiB;AAkB5C,SAAS,kBAAkB,UAA8B,CAAC,GAAgB;AAC/E,QAAM,UAAU,CAAC,CAAC,IAAI,KAAK,OAAyD,EAAE,IAAI,OAAO,SAAS,EAAE,MAAM,GAAG,EAAE;AACvH,QAAM,UAAU,UAAiB,2BAA2B,IAAI,OAAO,IAAI,QAAQ,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,OAAO,QAAQ,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC;AACpJ,QAAM,UAAmE,CAAC;AAC1E,aAAW,CAAC,IAAI,KAAK,KAAK,OAAO,QAAQ,QAAQ,SAAS,CAAC,CAAC,EAAG,SAAQ,EAAE,IAAI,EAAE,MAAM;AACrF,eAAa,SAAS,OAAO;AAC7B,YAAU,SAAS,QAAQ,MAAM;AACjC,SAAO,gBAAgB,IAAI,IAAI,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC;AACtF;","names":[]}
1
+ {"version":3,"sources":["../src/projectile-model.ts","../src/weapon-props.ts"],"sourcesContent":["import { markKitOrigin } from '@adatechnology/game-contracts'\nimport type * as THREE_NS from 'three'\n\nimport { buildWeaponModelById } from './models'\nimport { buildExplosiveModel } from './models/explosives'\nimport { modelKit } from './models/kit'\nimport { buildFlyingRocket } from './models/launcher-rounds'\n\n/** 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`). */\nexport interface ProjectileQuery {\n readonly weapon: string\n readonly explosive?: string | undefined\n readonly kind: string\n}\n\n/** The model of a projectile and the axis along its length. */\nexport interface ProjectileModel {\n readonly model: THREE_NS.Object3D\n readonly axis: [number, number, number]\n}\n\n/**\n * 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\n * 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.\n * Answers `null` where the gallery has no model (the 40 mm grenade of a launcher), and a host keeps its primitive for it.\n */\nexport function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null {\n if (query.kind !== 'rocket') return explosiveProjectile(THREE, query)\n const launcher = buildWeaponModelById(THREE, query.weapon)\n if (!launcher || launcher.parts.family !== 'rocket') return null\n const round = launcher.parts.makeRound ? launcher.parts.makeRound() : buildFlyingRocket(modelKit(THREE), launcher.parts.launcherType)\n return { model: round, axis: [1, 0, 0] }\n}\n\n// a thrown or set down explosive the gallery drew: its model centred on its middle (it tumbles about it in flight), standing axis +y\nfunction explosiveProjectile(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null {\n const model = query.explosive === undefined ? undefined : buildExplosiveModel(THREE, query.explosive)\n if (!model) return null\n const centre = new THREE.Box3().setFromObject(model).getCenter(new THREE.Vector3())\n const holder = markKitOrigin(new THREE.Group(), { owner: 'game-weapons-three', kind: 'explosive', id: model.name })\n holder.name = model.name\n model.position.sub(centre)\n holder.add(model)\n return { model: holder, axis: [0, 1, 0] }\n}\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\n\nimport { SHIPPED_WEAPON_ITEM_MODELS, weaponPropsOver } from './weapon-item-model'\nimport type { WeaponItemModel, WeaponProps } from './weapon-item-model'\n\nexport interface WeaponPropsOptions {\n /** Item model overrides by weapon id, added to the shipped ones (`null` keeps the low-poly prop); later packs replace earlier ones. */\n readonly packs?: readonly Readonly<Record<string, WeaponItemModel | null>>[]\n /** Changes to an override by weapon id, merged field by field. */\n readonly patch?: Readonly<Record<string, DeepPartial<WeaponItemModel>>>\n /** Weapon ids whose override is taken out (the weapon id itself is then the item model id). */\n readonly remove?: readonly string[]\n}\n\ntype Entry = { readonly id: string; readonly model: WeaponItemModel }\n\n/** A set of weapon prop overrides of its own: the shipped ones plus `packs`, `patch` and `remove`. Nothing is shared with any other set on the page. */\nexport function createWeaponProps(options: WeaponPropsOptions = {}): WeaponProps {\n const entryOf = ([id, model]: readonly [string, WeaponItemModel | null]): Entry => ({ id, model: model ?? { item: '' } })\n const entries = mergeById<Entry>(SHIPPED_WEAPON_ITEM_MODELS.map(entryOf), (options.packs ?? []).flatMap((pack) => Object.entries(pack).map(entryOf)))\n const patches: Record<string, { model: DeepPartial<WeaponItemModel> }> = {}\n for (const [id, model] of Object.entries(options.patch ?? {})) patches[id] = { model }\n applyPatches(entries, patches)\n removeIds(entries, options.remove)\n return weaponPropsOver(new Map([...entries].map(([id, entry]) => [id, entry.model])))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AA0BvB,SAAS,gBAAgB,OAAwB,OAAgD;AACtG,MAAI,MAAM,SAAS,SAAU,QAAO,oBAAoB,OAAO,KAAK;AACpE,QAAM,WAAW,qBAAqB,OAAO,MAAM,MAAM;AACzD,MAAI,CAAC,YAAY,SAAS,MAAM,WAAW,SAAU,QAAO;AAC5D,QAAM,QAAQ,SAAS,MAAM,YAAY,SAAS,MAAM,UAAU,IAAI,kBAAkB,SAAS,KAAK,GAAG,SAAS,MAAM,YAAY;AACpI,SAAO,EAAE,OAAO,OAAO,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE;AACzC;AAGA,SAAS,oBAAoB,OAAwB,OAAgD;AACnG,QAAM,QAAQ,MAAM,cAAc,SAAY,SAAY,oBAAoB,OAAO,MAAM,SAAS;AACpG,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,SAAS,IAAI,MAAM,KAAK,EAAE,cAAc,KAAK,EAAE,UAAU,IAAI,MAAM,QAAQ,CAAC;AAClF,QAAM,SAAS,cAAc,IAAI,MAAM,MAAM,GAAG,EAAE,OAAO,sBAAsB,MAAM,aAAa,IAAI,MAAM,KAAK,CAAC;AAClH,SAAO,OAAO,MAAM;AACpB,QAAM,SAAS,IAAI,MAAM;AACzB,SAAO,IAAI,KAAK;AAChB,SAAO,EAAE,OAAO,QAAQ,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE;AAC1C;;;AC5CA,SAAS,cAAc,WAAW,iBAAiB;AAkB5C,SAAS,kBAAkB,UAA8B,CAAC,GAAgB;AAC/E,QAAM,UAAU,CAAC,CAAC,IAAI,KAAK,OAAyD,EAAE,IAAI,OAAO,SAAS,EAAE,MAAM,GAAG,EAAE;AACvH,QAAM,UAAU,UAAiB,2BAA2B,IAAI,OAAO,IAAI,QAAQ,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,OAAO,QAAQ,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC;AACpJ,QAAM,UAAmE,CAAC;AAC1E,aAAW,CAAC,IAAI,KAAK,KAAK,OAAO,QAAQ,QAAQ,SAAS,CAAC,CAAC,EAAG,SAAQ,EAAE,IAAI,EAAE,MAAM;AACrF,eAAa,SAAS,OAAO;AAC7B,YAAU,SAAS,QAAQ,MAAM;AACjC,SAAO,gBAAgB,IAAI,IAAI,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC;AACtF;","names":[]}
@@ -1,4 +1,4 @@
1
- import { HostTool, HandPose, EffectSink, HostEvent, HandTargets, MuzzlePose, TestableModule, AreaPlacement, DestructionEvent, Hit, Vec3 as Vec3$1, ModuleControl, ModuleLayer, ModuleMetric, ModuleHost } from '@adatechnology/game-contracts';
1
+ import { HostTool, HandPose, EffectSink, ToolHand, HostEvent, HandTargets, MuzzlePose, 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
3
  import { SampleDefaults, SfxManifest, SoundBank, AudioEngine } from '@adatechnology/game-audio';
4
4
  import * as THREE_NS from 'three';
@@ -784,6 +784,8 @@ declare const GUNSHOT_SAMPLE_IDS: readonly string[];
784
784
  * by shot.
785
785
  */
786
786
  declare const GUNSHOT_SAMPLE: SampleDefaults;
787
+ /** A launcher firing (`launcher_40mm`, `rocket_launch`): a near take only, carried far like a shot but below its level. */
788
+ declare const LAUNCH_SAMPLE: SampleDefaults;
787
789
  /** A reload step: heard at the hands, about a third of a shot's level after the converter's peak normalization. */
788
790
  declare const RELOAD_SAMPLE: SampleDefaults;
789
791
  /** Seconds from the start of each recorded reload step to its hit (`data/reload-sample-hits.json`, measured on the files). */
@@ -902,10 +904,19 @@ interface WeaponAudio {
902
904
  }): void;
903
905
  /** A magazine landing on the floor: the floor material, the speed and which bounce (all optional). */
904
906
  thud(input?: MagazineDropInput): void;
907
+ /**
908
+ * A launcher firing: the "thoomp" of a 40 mm grenade leaving the tube (`grenade`) or the roar of a rocket leaving it (`rocket`), at `distance`
909
+ * metres. The host's recording (`LAUNCH_SOUND_IDS`) once it is loaded; a synthesized thump or whoosh until then, never the blast of an explosion.
910
+ */
911
+ launch(kind: LaunchKind, volume?: number, distance?: number): void;
905
912
  /** Master volume, 0 to 1. */
906
913
  setVolume(volume: number): void;
907
914
  dispose(): void;
908
915
  }
916
+ /** What leaves a launcher: a 40 mm grenade (M79, M32, M203) or a rocket (RPG-7, AT4, Carl Gustaf). */
917
+ type LaunchKind = 'grenade' | 'rocket';
918
+ /** The recorded sound of each launch (game-audio's sfx manifest, category armas). */
919
+ declare const LAUNCH_SOUND_IDS: Readonly<Record<LaunchKind, string>>;
909
920
  declare function createWeaponAudio(volume?: number, options?: WeaponAudioOptions): WeaponAudio;
910
921
 
911
922
  /** What the bench turns on or off in the presentation of the weapon: the ejected casings, the dropped magazines, the muzzle flash, the accessory models and the light and laser beams. */
@@ -928,6 +939,8 @@ interface ModelOptions {
928
939
  h?: number;
929
940
  gl?: number;
930
941
  deagle?: number;
942
+ /** A pistol drawn from its photo instead of by style: `p320`, `usp` or `p99` (see `pistol-design.ts`). */
943
+ design?: string;
931
944
  /** Metal and furniture finish. */
932
945
  steel?: number;
933
946
  stain?: number;
@@ -963,6 +976,8 @@ interface ModelOptions {
963
976
  ar?: number;
964
977
  ak?: number;
965
978
  g3?: number;
979
+ /** The Heckler & Koch G36 family: its polymer receiver, skeletal stock (`stock: 'g36'`), handguard, and on top the carry handle with optics (`carry`) or the long rail. */
980
+ g36?: number;
966
981
  charge?: number;
967
982
  rail?: number;
968
983
  jacket?: number;
@@ -977,10 +992,16 @@ interface ModelOptions {
977
992
  heat?: number;
978
993
  /** Chambers of the revolver cylinder (default 6): the capacity of the weapon. */
979
994
  chambers?: number;
995
+ /** The Colt Python: ventilated rib, full underlug, walnut grip (see `revolver-python.ts`). */
996
+ python?: number;
980
997
  bayo?: number;
981
998
  rod?: number;
982
999
  bands?: number;
983
1000
  shot?: number;
1001
+ /** The body a bullpup is drawn with when it is not the Steyr AUG (`famas`, `tavor`, `sa80`). */
1002
+ look?: string;
1003
+ /** The Winchester 1887 lever-action shotgun (its own receiver, lever loop and stock). */
1004
+ m1887?: number;
984
1005
  /** Launcher type: `rpg`, `m72`, `at4`, `carl`, `flame`, `flameDIY`. */
985
1006
  lt?: string;
986
1007
  }
@@ -1005,7 +1026,7 @@ interface ModelFrames {
1005
1026
  underbarrel?: readonly [number, number];
1006
1027
  }
1007
1028
  /** The moving mechanism of a model, which picks its fire, reload and clear motion. */
1008
- type ModelFamily = 'pistol' | 'revolver' | 'rifle' | 'semiint' | 'semi12' | 'p90' | 'belt' | 'pump' | 'lever' | 'bolt' | 'boltmag' | 'break' | 'rocket' | 'flame';
1029
+ type ModelFamily = 'pistol' | 'revolver' | 'rifle' | 'semiint' | 'semi12' | 'p90' | 'belt' | 'pump' | 'lever' | 'bolt' | 'boltmag' | 'break' | 'rocket' | 'flame' | 'cylinder';
1009
1030
  /** The named parts a model exposes to the animation: pivots and marks inside the model, never copies. */
1010
1031
  interface ModelParts {
1011
1032
  family: ModelFamily;
@@ -1035,6 +1056,8 @@ interface ModelParts {
1035
1056
  cover?: THREE_NS.Object3D;
1036
1057
  crane?: THREE_NS.Object3D;
1037
1058
  cylinder?: THREE_NS.Object3D;
1059
+ /** The vertical grip under the barrel where the support hand takes a long gun that has one (the MGL). */
1060
+ foreGrip?: THREE_NS.Object3D;
1038
1061
  chambers?: THREE_NS.Object3D[];
1039
1062
  barrels?: THREE_NS.Object3D;
1040
1063
  breech?: THREE_NS.Object3D[];
@@ -1095,6 +1118,7 @@ declare const createMaterials: (THREE: Three) => {
1095
1118
  olive: THREE_NS.MeshStandardMaterial;
1096
1119
  tan: THREE_NS.MeshStandardMaterial;
1097
1120
  wood: THREE_NS.MeshStandardMaterial;
1121
+ beech: THREE_NS.MeshStandardMaterial;
1098
1122
  woodL: THREE_NS.MeshStandardMaterial;
1099
1123
  brass: THREE_NS.MeshStandardMaterial;
1100
1124
  copper: THREE_NS.MeshStandardMaterial;
@@ -1126,9 +1150,14 @@ declare const createMaterials: (THREE: Three) => {
1126
1150
  dynamite: THREE_NS.MeshStandardMaterial;
1127
1151
  c4: THREE_NS.MeshStandardMaterial;
1128
1152
  wire: THREE_NS.MeshStandardMaterial;
1153
+ /** The Semtex putty and the green band of an M18 smoke canister. */
1154
+ semtex: THREE_NS.MeshStandardMaterial;
1155
+ smokeBand: THREE_NS.MeshStandardMaterial;
1156
+ cellophane: THREE_NS.MeshStandardMaterial;
1129
1157
  /** Magazine finishes named by the options. */
1130
1158
  bakelite: THREE_NS.MeshStandardMaterial;
1131
1159
  polyMag: THREE_NS.MeshStandardMaterial;
1160
+ smoke: THREE_NS.MeshStandardMaterial;
1132
1161
  };
1133
1162
  type ModelMaterials = ReturnType<typeof createMaterials>;
1134
1163
  /**
@@ -1287,6 +1316,8 @@ interface WeaponFxOptions {
1287
1316
  contact?: LaserRaycast;
1288
1317
  /** Where the body holds the tool (`ModuleHost.holdFrame`): third person draws it there at its real size. */
1289
1318
  bodyHold?: () => HandPose | null;
1319
+ /** Where the body holds a tool in the left hand (`ModuleHost.holdFrame('L')`), for the left hand's weapon with a weapon in each hand; without it, a body's left shoulder under the eye. */
1320
+ leftBodyHold?: () => HandPose | null;
1290
1321
  /** Whether the view is the player's own eye: the gallery's guns are then framed in the view (`VIEW_HOLD`) instead of held on the body. */
1291
1322
  firstPerson?: () => boolean;
1292
1323
  /** The lens the host draws the first-person layer with (`ModuleHost.setViewmodelFov`): the gun in the hands sets the one of its family, and null when it leaves the view. */
@@ -1306,6 +1337,10 @@ interface WeaponFxOptions {
1306
1337
  lights?: LightBudget;
1307
1338
  /** The host's pools (`host.pools`): the burning droplets and the ground flames of a flamethrower take their geometry and material from them; without them each makes its own (deprecated, removed in the next major). */
1308
1339
  pools?: RenderPools;
1340
+ /** The hand this presentation draws the tool in (default `R`); `L` is the left hand's tool with a tool in each hand (`HostTool.offHand`): held out to the left, the hand on the mirror of the grip. */
1341
+ hand?: ToolHand;
1342
+ /** True while the other hand holds a tool of its own: the tool is held in this hand alone, out to its side, and never brought to the eye. */
1343
+ oneHand?: () => boolean;
1309
1344
  }
1310
1345
 
1311
1346
  /** The weapon in the hands, its fire and reload motion, ejected casings and dropped magazines, and their sounds. */
@@ -1317,12 +1352,17 @@ interface WeaponFx {
1317
1352
  setCondition(condition: string): void;
1318
1353
  /** Where the hands take the weapon (world space, read every frame after `update`): the grip and the forend of the model, or the handle of the generic prop; null with nothing in the hands. */
1319
1354
  handTargets(): HandTargets | null;
1320
- /** The muzzle of the weapon in the hands as drawn now (world space): the gallery model's mark, or the front of the generic prop; null for a tool that fires no shot. */
1321
- muzzle(): MuzzlePose | null;
1355
+ /**
1356
+ * The muzzle of the weapon in the hands as drawn now (world space): the gallery model's mark, or the front of the generic prop; null for a tool that fires no shot. `hand: 'L'` is the
1357
+ * one of the left hand's weapon with a weapon in each hand.
1358
+ */
1359
+ muzzle(hand?: ToolHand): MuzzlePose | null;
1322
1360
  /** What is drawn (casings, magazines, muzzle flash): change a field and the next event follows it. */
1323
1361
  readonly layers: FxLayers;
1324
1362
  /** Weapon shown in the hands, or null. */
1325
1363
  readonly inHand: string | null;
1364
+ /** Weapon shown in the left hand with a weapon in each hand (`HostTool.offHand`), or null. */
1365
+ readonly inLeftHand: string | null;
1326
1366
  /** The clips of the model playing now with the seconds each lasts (scaled to the rule's duration): which reload variant went (`reload` or `reload_empty`...). */
1327
1367
  readonly clips: ReadonlyArray<{
1328
1368
  name: string;
@@ -1336,6 +1376,7 @@ interface WeaponFx {
1336
1376
  /**
1337
1377
  * The presentation of the tool in the hands. The weapons the gallery drew (`MODEL_ENTRIES`) get their model and the clips the rule's events call for
1338
1378
  * (fire, cycle, jam, clear, safety, the seven reloads); the generic archetypes keep their low-poly prop.
1379
+ * With a tool in each hand (`HostTool.offHand`, events with `hand: 'L'`) the left hand gets presentations of its own.
1339
1380
  */
1340
1381
  declare function createWeaponFx(options: WeaponFxOptions): WeaponFx;
1341
1382
 
@@ -1366,6 +1407,10 @@ type WeaponModelDef = Pick<WeaponDef, 'id' | 'category' | 'mass'> & Partial<Pick
1366
1407
  /** The gallery model of the explosive a throwable carries (the frag grenade's M67, the molotov, the dynamite...), or undefined for any other weapon. */
1367
1408
  /** Whether the gallery drew the explosive a throwable carries. */
1368
1409
  declare const hasThrowableModel: (def: Partial<Pick<WeaponDef, "action">>) => boolean;
1410
+ /** Whether the kit drew the melee weapon itself (the KA-BAR, the katana, the brass knuckles). */
1411
+ declare const hasHandheldModel: (def: Pick<WeaponDef, "id">) => boolean;
1412
+ /** The model of a melee weapon the kit drew, lying as the item models do (see `buildMeleeModel`), or undefined for any other weapon. */
1413
+ declare const buildHandheldModel: (THREE: typeof THREE_NS, def: Pick<WeaponDef, "id">) => THREE_NS.Group | undefined;
1369
1414
  declare const buildThrowableModel: (THREE: typeof THREE_NS, def: Partial<Pick<WeaponDef, "action">>) => THREE_NS.Group | undefined;
1370
1415
  /** The set behind `registerWeaponItemModel`, `itemModelOfWeapon`, `buildItemWeaponModel` and `buildWeaponModel`, created on first use. */
1371
1416
  declare const defaultWeaponProps: () => WeaponProps;
@@ -1728,4 +1773,4 @@ declare function createExplosivesTestModule(options?: ExplosivesTestModuleOption
1728
1773
  readonly bench: ReturnType<typeof createExplosivesBench>;
1729
1774
  };
1730
1775
 
1731
- export { WEAPON_ITEM_PREFIX 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 ModelOptions as M, MOUNTED_M134_ITEM_ID as N, type MechanicalSoundId as O, type ModelMaterials as P, type MountFrame as Q, RELOAD_SAMPLE as R, RELOAD_SAMPLE_HITS as S, type ShotExtras as T, type ShotSound as U, type ShotSoundClass as V, type WeaponProps as W, type ShotSoundInput as X, type ShotSoundOptions as Y, type SoundClassDef as Z, type SoundStep as _, type WeaponItemModel as a, WEIGHT_INTENSITY as a0, type WeaponAudio as a1, type WeaponAudioOptions as a2, type WeaponFx as a3, type WeaponFxOptions as a4, type WeaponModelDef as a5, type WeaponSampleOptions as a6, type WeaponsTestModuleOptions as a7, buildItemWeaponModel as a8, buildThrowableModel as a9, buildWeaponModel as aa, computeCasingSound as ab, computeFlyby as ac, computeGunshot as ad, computeShotSound as ae, createExplosivesTestModule as af, createWeaponAudio as ag, createWeaponFx as ah, createWeaponsTestModule as ai, defaultWeaponProps as aj, deriveFrames as ak, explosivesTextOf as al, hasThrowableModel as am, itemModelOfWeapon as an, mechanicalSoundOf as ao, modelKit as ap, mountFrame as aq, registerWeaponItemModel as ar, weaponSampleBank as as, weaponSampleDefaults as at, weaponsLayout as au, type WeaponModel as b, type ModelKit as c, type ModelParts as d, type ModelFamily 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 };
1776
+ 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, LAUNCH_SAMPLE as K, type LaserRaycast as L, type ModelOptions as M, LAUNCH_SOUND_IDS as N, type LaunchKind as O, MECHANICAL_SOUNDS as P, MOUNTED_M134_ITEM_ID as Q, type MechanicalSoundId as R, type ModelMaterials 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 WeaponModelDef as a8, type WeaponSampleOptions as a9, type WeaponsTestModuleOptions as aa, buildHandheldModel as ab, buildItemWeaponModel as ac, buildThrowableModel as ad, buildWeaponModel as ae, computeCasingSound as af, computeFlyby as ag, computeGunshot as ah, computeShotSound as ai, createExplosivesTestModule as aj, createWeaponAudio as ak, createWeaponFx as al, createWeaponsTestModule as am, defaultWeaponProps as an, deriveFrames as ao, explosivesTextOf as ap, hasHandheldModel as aq, hasThrowableModel as ar, itemModelOfWeapon as as, mechanicalSoundOf as at, modelKit as au, mountFrame as av, registerWeaponItemModel as aw, weaponSampleBank as ax, weaponSampleDefaults as ay, weaponsLayout as az, type WeaponModel as b, type ModelKit as c, type ModelParts as d, type ModelFamily 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, 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, N as MOUNTED_M134_ITEM_ID, $ as WEAPON_ITEM_PREFIX, a7 as WeaponsTestModuleOptions, af as createExplosivesTestModule, ai as createWeaponsTestModule, al as explosivesTextOf, au as weaponsLayout } from './testing-BKDGK6cq.js';
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, Q as MOUNTED_M134_ITEM_ID, a2 as WEAPON_ITEM_PREFIX, aa as WeaponsTestModuleOptions, aj as createExplosivesTestModule, am as createWeaponsTestModule, ap as explosivesTextOf, az as weaponsLayout } from './testing-I8H8oNSD.js';
2
2
  import '@adatechnology/game-contracts';
3
3
  import '@adatechnology/game-weapons';
4
4
  import '@adatechnology/game-audio';
package/dist/testing.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  createWeaponsTestModule,
10
10
  explosivesTextOf,
11
11
  weaponsLayout
12
- } from "./chunk-BDYIF7JD.js";
12
+ } from "./chunk-4HWHC6US.js";
13
13
  export {
14
14
  COUNTER_ITEM_ID,
15
15
  DEFAULT_EXPLOSIVES_SCENE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/game-weapons-three",
3
- "version": "0.17.1",
3
+ "version": "0.18.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-audio": "^0.9.1",
48
- "@adatechnology/game-contracts": "^0.27.0",
49
- "@adatechnology/game-floorplan-three": "^0.10.2",
50
- "@adatechnology/game-items-three": "^0.7.5",
47
+ "@adatechnology/game-audio": "^0.9.3",
48
+ "@adatechnology/game-contracts": "^0.29.0",
49
+ "@adatechnology/game-floorplan-three": "^0.11.0",
50
+ "@adatechnology/game-items-three": "^0.7.7",
51
51
  "@adatechnology/game-render-three": "^0.2.0",
52
52
  "@adatechnology/game-shapes-three": "^0.3.1",
53
- "@adatechnology/game-vfx": "^0.9.0",
54
- "@adatechnology/game-vfx-three": "^0.7.3",
55
- "@adatechnology/game-weapons": "^0.8.0"
53
+ "@adatechnology/game-vfx": "^0.10.1",
54
+ "@adatechnology/game-vfx-three": "^0.7.5",
55
+ "@adatechnology/game-weapons": "^0.9.1"
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.28.1",
68
+ "@adatechnology/game-test-room": "^0.29.1",
69
69
  "@adatechnology/golden-tool": "^0.0.0"
70
70
  },
71
71
  "scripts": {