@adatechnology/game-weapons-three 0.22.1 → 0.24.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.
Files changed (126) hide show
  1. package/README.md +2 -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/aa_12.svg +1 -1
  5. package/assets/weapon-svg/generated/ak_12.svg +1 -1
  6. package/assets/weapon-svg/generated/ak_47.svg +1 -1
  7. package/assets/weapon-svg/generated/ak_74.svg +1 -1
  8. package/assets/weapon-svg/generated/akm.svg +1 -1
  9. package/assets/weapon-svg/generated/aks_74u.svg +1 -1
  10. package/assets/weapon-svg/generated/anti_materiel_50.svg +1 -1
  11. package/assets/weapon-svg/generated/barrett_m82a1.svg +1 -1
  12. package/assets/weapon-svg/generated/barrett_mrad.svg +1 -1
  13. package/assets/weapon-svg/generated/benelli_m4.svg +1 -1
  14. package/assets/weapon-svg/generated/beretta_92fs.svg +1 -1
  15. package/assets/weapon-svg/generated/bt_mp9.svg +1 -1
  16. package/assets/weapon-svg/generated/carbine_22.svg +1 -1
  17. package/assets/weapon-svg/generated/cbc_122.svg +1 -1
  18. package/assets/weapon-svg/generated/cbc_7022.svg +1 -1
  19. package/assets/weapon-svg/generated/cbc_pump_military_3_0.svg +1 -1
  20. package/assets/weapon-svg/generated/colt_m16a2.svg +1 -1
  21. package/assets/weapon-svg/generated/colt_m1911.svg +1 -1
  22. package/assets/weapon-svg/generated/colt_m4a1.svg +1 -1
  23. package/assets/weapon-svg/generated/cz_75.svg +1 -1
  24. package/assets/weapon-svg/generated/cz_scorpion_evo_3.svg +1 -1
  25. package/assets/weapon-svg/generated/desert_eagle_mark_xix.svg +1 -1
  26. package/assets/weapon-svg/generated/famas.svg +1 -1
  27. package/assets/weapon-svg/generated/fn_fal.svg +1 -1
  28. package/assets/weapon-svg/generated/fn_five_seven.svg +1 -1
  29. package/assets/weapon-svg/generated/fn_m240b.svg +1 -1
  30. package/assets/weapon-svg/generated/fn_m249.svg +1 -1
  31. package/assets/weapon-svg/generated/fn_mag.svg +1 -1
  32. package/assets/weapon-svg/generated/fn_minimi.svg +1 -1
  33. package/assets/weapon-svg/generated/fn_minimi_para.svg +1 -1
  34. package/assets/weapon-svg/generated/fn_p90.svg +1 -1
  35. package/assets/weapon-svg/generated/fn_parafal.svg +1 -1
  36. package/assets/weapon-svg/generated/fn_scar_h.svg +1 -1
  37. package/assets/weapon-svg/generated/fn_scar_l.svg +1 -1
  38. package/assets/weapon-svg/generated/franchi_spas_12.svg +1 -1
  39. package/assets/weapon-svg/generated/glock_17.svg +1 -1
  40. package/assets/weapon-svg/generated/glock_18.svg +1 -1
  41. package/assets/weapon-svg/generated/glock_19.svg +1 -1
  42. package/assets/weapon-svg/generated/hk416.svg +1 -1
  43. package/assets/weapon-svg/generated/hk_g36.svg +1 -1
  44. package/assets/weapon-svg/generated/hk_g36c.svg +1 -1
  45. package/assets/weapon-svg/generated/hk_g36k.svg +1 -1
  46. package/assets/weapon-svg/generated/hk_g3a3.svg +1 -1
  47. package/assets/weapon-svg/generated/hk_mp5a3.svg +1 -1
  48. package/assets/weapon-svg/generated/hk_mp5k.svg +1 -1
  49. package/assets/weapon-svg/generated/hk_mp5sd3.svg +1 -1
  50. package/assets/weapon-svg/generated/hk_mp7a1.svg +1 -1
  51. package/assets/weapon-svg/generated/hk_psg_1.svg +1 -1
  52. package/assets/weapon-svg/generated/hk_ump9.svg +1 -1
  53. package/assets/weapon-svg/generated/hk_ump_45.svg +1 -1
  54. package/assets/weapon-svg/generated/hk_usp.svg +1 -1
  55. package/assets/weapon-svg/generated/imbel_ia2.svg +1 -1
  56. package/assets/weapon-svg/generated/iwi_tavor.svg +1 -1
  57. package/assets/weapon-svg/generated/kel_tec_ksg.svg +1 -1
  58. package/assets/weapon-svg/generated/knights_sr_25_mk11.svg +1 -1
  59. package/assets/weapon-svg/generated/kriss_vector.svg +1 -1
  60. package/assets/weapon-svg/generated/l85a2.svg +1 -1
  61. package/assets/weapon-svg/generated/m134.svg +1 -1
  62. package/assets/weapon-svg/generated/m14_ebr.svg +1 -1
  63. package/assets/weapon-svg/generated/m1_garand.svg +1 -1
  64. package/assets/weapon-svg/generated/m32_mgl.svg +1 -1
  65. package/assets/weapon-svg/generated/m60.svg +1 -1
  66. package/assets/weapon-svg/generated/m72_law.svg +1 -1
  67. package/assets/weapon-svg/generated/m79.svg +1 -1
  68. package/assets/weapon-svg/generated/mac_10.svg +1 -1
  69. package/assets/weapon-svg/generated/makarov_pm.svg +1 -1
  70. package/assets/weapon-svg/generated/mg3.svg +1 -1
  71. package/assets/weapon-svg/generated/mg42.svg +1 -1
  72. package/assets/weapon-svg/generated/mini_uzi.svg +1 -1
  73. package/assets/weapon-svg/generated/mosin_nagant_91_30.svg +1 -1
  74. package/assets/weapon-svg/generated/mossberg_500.svg +1 -1
  75. package/assets/weapon-svg/generated/mossberg_500_cruiser.svg +1 -1
  76. package/assets/weapon-svg/generated/mossberg_590.svg +1 -1
  77. package/assets/weapon-svg/generated/pistol_45.svg +1 -1
  78. package/assets/weapon-svg/generated/pistol_9mm.svg +1 -1
  79. package/assets/weapon-svg/generated/pkm.svg +1 -1
  80. package/assets/weapon-svg/generated/pp19_bizon.svg +1 -1
  81. package/assets/weapon-svg/generated/ppsh_41.svg +1 -1
  82. package/assets/weapon-svg/generated/remington_870.svg +1 -1
  83. package/assets/weapon-svg/generated/rifle_5_56.svg +1 -1
  84. package/assets/weapon-svg/generated/rifle_7_62x39.svg +1 -1
  85. package/assets/weapon-svg/generated/rifle_bolt_308.svg +1 -1
  86. package/assets/weapon-svg/generated/rossi_puma.svg +1 -1
  87. package/assets/weapon-svg/generated/rpk.svg +1 -1
  88. package/assets/weapon-svg/generated/ruger_10_22.svg +1 -1
  89. package/assets/weapon-svg/generated/saiga_12.svg +1 -1
  90. package/assets/weapon-svg/generated/shotgun_pump_12.svg +1 -1
  91. package/assets/weapon-svg/generated/shotgun_semi_12.svg +1 -1
  92. package/assets/weapon-svg/generated/shovel.svg +1 -0
  93. package/assets/weapon-svg/generated/sig_mpx.svg +1 -1
  94. package/assets/weapon-svg/generated/sig_sauer_p226.svg +1 -1
  95. package/assets/weapon-svg/generated/sig_sauer_p320.svg +1 -1
  96. package/assets/weapon-svg/generated/sks.svg +1 -1
  97. package/assets/weapon-svg/generated/smg_9mm.svg +1 -1
  98. package/assets/weapon-svg/generated/steyr_aug_a1.svg +1 -1
  99. package/assets/weapon-svg/generated/svd_dragunov.svg +1 -1
  100. package/assets/weapon-svg/generated/taurus_g2c.svg +1 -1
  101. package/assets/weapon-svg/generated/taurus_pt100.svg +1 -1
  102. package/assets/weapon-svg/generated/taurus_smt9.svg +1 -1
  103. package/assets/weapon-svg/generated/taurus_t4.svg +1 -1
  104. package/assets/weapon-svg/generated/taurus_t4_civil.svg +1 -1
  105. package/assets/weapon-svg/generated/taurus_th380.svg +1 -1
  106. package/assets/weapon-svg/generated/taurus_ts9.svg +1 -1
  107. package/assets/weapon-svg/generated/thompson_m1a1.svg +1 -1
  108. package/assets/weapon-svg/generated/uzi.svg +1 -1
  109. package/assets/weapon-svg/generated/vss_vintorez.svg +1 -1
  110. package/assets/weapon-svg/generated/vz61.svg +1 -1
  111. package/assets/weapon-svg/generated/walther_p99.svg +1 -1
  112. package/assets/weapon-svg/generated/winchester_1887.svg +1 -1
  113. package/assets/weapon-svg/generated/winchester_1894.svg +1 -1
  114. package/assets/weapon-svg/manifest.json +4 -0
  115. package/dist/{chunk-5M3ANYC5.js → chunk-UUBO6H5O.js} +367 -223
  116. package/dist/chunk-UUBO6H5O.js.map +1 -0
  117. package/dist/index.d.ts +64 -6
  118. package/dist/index.global.js +32398 -5668
  119. package/dist/index.global.js.map +1 -1
  120. package/dist/index.js +11 -5
  121. package/dist/index.js.map +1 -1
  122. package/dist/{testing-CocgzbYC.d.ts → testing-eyLz_C6A.d.ts} +13 -5
  123. package/dist/testing.d.ts +1 -1
  124. package/dist/testing.js +1 -1
  125. package/package.json +14 -13
  126. package/dist/chunk-5M3ANYC5.js.map +0 -1
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  GUNSHOT_PROFILES,
17
17
  GUNSHOT_SAMPLE,
18
18
  GUNSHOT_SAMPLE_IDS,
19
+ HOLSTER_PLACEMENT,
19
20
  LAUNCH_SAMPLE,
20
21
  LAUNCH_SOUND_IDS,
21
22
  MECHANICAL_SOUNDS,
@@ -25,6 +26,7 @@ import {
25
26
  RELOAD_SAMPLE,
26
27
  RELOAD_SAMPLE_HITS,
27
28
  SHIPPED_WEAPON_ITEM_MODELS,
29
+ TOOL_MOTIONS,
28
30
  VIEW_HOLD,
29
31
  VIEW_MOTION,
30
32
  WEAPON_ITEM_PREFIX,
@@ -38,7 +40,6 @@ import {
38
40
  buildCasing,
39
41
  buildExplosiveModel,
40
42
  buildFlyingRocket,
41
- buildHandheldModel,
42
43
  buildItemWeaponModel,
43
44
  buildModeledProp,
44
45
  buildProp,
@@ -54,6 +55,7 @@ import {
54
55
  computeGunshot,
55
56
  computeShotSound,
56
57
  createExplosivesTestModule,
58
+ createHolsteredWeapons,
57
59
  createWeaponAudio,
58
60
  createWeaponFx,
59
61
  createWeaponsTestModule,
@@ -64,9 +66,9 @@ import {
64
66
  explosivesTextOf,
65
67
  fitAttachmentModels,
66
68
  hasExplosiveModel,
67
- hasHandheldModel,
68
69
  hasThrowableModel,
69
70
  hasWeaponModel,
71
+ holsteredModel,
70
72
  itemModelOfWeapon,
71
73
  mechanicalSoundOf,
72
74
  modelKit,
@@ -76,6 +78,7 @@ import {
76
78
  registerWeaponItemModel,
77
79
  rigStock,
78
80
  rigUnderbarrel,
81
+ sampleToolMotion,
79
82
  toWorldLens,
80
83
  weaponProp,
81
84
  weaponPropsOver,
@@ -87,7 +90,7 @@ import {
87
90
  worldExplosiveItem,
88
91
  worldExplosiveShell,
89
92
  worldExplosiveValve
90
- } from "./chunk-5M3ANYC5.js";
93
+ } from "./chunk-UUBO6H5O.js";
91
94
 
92
95
  // src/projectile-model.ts
93
96
  import { markKitOrigin } from "@adatechnology/game-contracts";
@@ -138,6 +141,7 @@ export {
138
141
  GUNSHOT_PROFILES,
139
142
  GUNSHOT_SAMPLE,
140
143
  GUNSHOT_SAMPLE_IDS,
144
+ HOLSTER_PLACEMENT,
141
145
  LAUNCH_SAMPLE,
142
146
  LAUNCH_SOUND_IDS,
143
147
  MECHANICAL_SOUNDS,
@@ -146,6 +150,7 @@ export {
146
150
  P13_VALVE_MESH,
147
151
  RELOAD_SAMPLE,
148
152
  RELOAD_SAMPLE_HITS,
153
+ TOOL_MOTIONS,
149
154
  VIEW_HOLD,
150
155
  VIEW_MOTION,
151
156
  WEAPON_ITEM_PREFIX,
@@ -158,7 +163,6 @@ export {
158
163
  buildCartridge,
159
164
  buildCasing,
160
165
  buildExplosiveModel,
161
- buildHandheldModel,
162
166
  buildItemWeaponModel,
163
167
  buildModeledProp,
164
168
  buildProp,
@@ -174,6 +178,7 @@ export {
174
178
  computeGunshot,
175
179
  computeShotSound,
176
180
  createExplosivesTestModule,
181
+ createHolsteredWeapons,
177
182
  createWeaponAudio,
178
183
  createWeaponFx,
179
184
  createWeaponProps,
@@ -185,9 +190,9 @@ export {
185
190
  explosivesTextOf,
186
191
  fitAttachmentModels,
187
192
  hasExplosiveModel,
188
- hasHandheldModel,
189
193
  hasThrowableModel,
190
194
  hasWeaponModel,
195
+ holsteredModel,
191
196
  itemModelOfWeapon,
192
197
  mechanicalSoundOf,
193
198
  modelKit,
@@ -198,6 +203,7 @@ export {
198
203
  registerWeaponItemModel,
199
204
  rigStock,
200
205
  rigUnderbarrel,
206
+ sampleToolMotion,
201
207
  toWorldLens,
202
208
  weaponProp,
203
209
  weaponSampleBank,
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;AA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AAE,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA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AW,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":[]}
@@ -1387,14 +1387,26 @@ interface WeaponFx {
1387
1387
  */
1388
1388
  declare function createWeaponFx(options: WeaponFxOptions): WeaponFx;
1389
1389
 
1390
+ /** The hands on a long tool held in both: the right hand's grip and the left hand's, as fractions of the length from its middle (-0.5 the tail, 0.5 the head). */
1391
+ interface WeaponGrips {
1392
+ readonly handle: number;
1393
+ readonly support?: number;
1394
+ /** Where the right hand closes when a fraction of the length is not enough: metres along the weapon from its centre and above its underside (the brass knuckles gripped through their rings). */
1395
+ readonly handleAt?: readonly [number, number];
1396
+ }
1397
+
1390
1398
  /** How a weapon is drawn from an item model of game-items-three: the item (default the weapon id), and the turns the laying-down rule gets wrong. */
1391
1399
  interface WeaponItemModel {
1392
1400
  /** Catalog id of the item model; the weapon id when absent. */
1393
1401
  readonly item?: string;
1394
1402
  /** Quarter turns about y after the long axis is laid along x (a crossbow's stock is shorter than its limbs). */
1395
1403
  readonly turn?: number;
1404
+ /** Quarter turns about z after `turn`, standing the item on its edge (the brass knuckles are worn with the rings facing forward). */
1405
+ readonly roll?: number;
1396
1406
  /** Turn it end for end after the head is found (the head is the narrow end: a knife's blade, a screwdriver's tip, an extinguisher's nozzle). */
1397
1407
  readonly flip?: boolean;
1408
+ /** Where the hands close on a long tool (both hands on a shovel's shaft); one hand on its handle when absent. */
1409
+ readonly grips?: WeaponGrips;
1398
1410
  }
1399
1411
  /** The weapons whose item model has another id or turns another way, with the draw that reads them: one set, with no other set sharing it. */
1400
1412
  interface WeaponProps {
@@ -1414,10 +1426,6 @@ type WeaponModelDef = Pick<WeaponDef, 'id' | 'category' | 'mass'> & Partial<Pick
1414
1426
  /** The gallery model of the explosive a throwable carries (the frag grenade's M67, the molotov, the dynamite...), or undefined for any other weapon. */
1415
1427
  /** Whether the gallery drew the explosive a throwable carries. */
1416
1428
  declare const hasThrowableModel: (def: Partial<Pick<WeaponDef, "action">>) => boolean;
1417
- /** Whether the kit drew the melee weapon itself (the KA-BAR, the katana, the brass knuckles). */
1418
- declare const hasHandheldModel: (def: Pick<WeaponDef, "id">) => boolean;
1419
- /** The model of a melee weapon the kit drew, lying as the item models do (see `buildMeleeModel`), or undefined for any other weapon. */
1420
- declare const buildHandheldModel: (THREE: typeof THREE_NS, def: Pick<WeaponDef, "id">) => THREE_NS.Group | undefined;
1421
1429
  declare const buildThrowableModel: (THREE: typeof THREE_NS, def: Partial<Pick<WeaponDef, "action">>) => THREE_NS.Group | undefined;
1422
1430
  /** The set behind `registerWeaponItemModel`, `itemModelOfWeapon`, `buildItemWeaponModel` and `buildWeaponModel`, created on first use. */
1423
1431
  declare const defaultWeaponProps: () => WeaponProps;
@@ -1785,4 +1793,4 @@ declare function createExplosivesTestModule(options?: ExplosivesTestModuleOption
1785
1793
  readonly bench: ReturnType<typeof createExplosivesBench>;
1786
1794
  };
1787
1795
 
1788
- 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 };
1796
+ 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, buildItemWeaponModel as ab, buildThrowableModel as ac, buildWeaponModel as ad, computeCasingSound as ae, computeFlyby as af, computeGunshot as ag, computeShotSound as ah, createExplosivesTestModule as ai, createWeaponAudio as aj, createWeaponFx as ak, createWeaponsTestModule as al, defaultWeaponProps as am, deriveFrames as an, explosivesTextOf as ao, hasThrowableModel as ap, itemModelOfWeapon as aq, mechanicalSoundOf as ar, modelKit as as, mountFrame as at, registerWeaponItemModel as au, weaponSampleBank as av, weaponSampleDefaults as aw, weaponsLayout as ax, 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, 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-CocgzbYC.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, ai as createExplosivesTestModule, al as createWeaponsTestModule, ao as explosivesTextOf, ax as weaponsLayout } from './testing-eyLz_C6A.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-5M3ANYC5.js";
12
+ } from "./chunk-UUBO6H5O.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.22.1",
3
+ "version": "0.24.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-audio": "^0.14.0",
48
- "@adatechnology/game-contracts": "^0.35.0",
49
- "@adatechnology/game-floorplan-three": "^0.14.2",
50
- "@adatechnology/game-items-three": "^0.8.5",
51
- "@adatechnology/game-render-three": "^0.3.0",
52
- "@adatechnology/game-shapes-three": "^0.4.0",
53
- "@adatechnology/game-vfx": "^0.15.0",
54
- "@adatechnology/game-vfx-three": "^0.10.3",
55
- "@adatechnology/game-weapons": "^0.12.1"
47
+ "@adatechnology/game-audio": "^0.15.1",
48
+ "@adatechnology/game-contracts": "^0.37.0",
49
+ "@adatechnology/game-items-three": "^0.9.1",
50
+ "@adatechnology/game-render-three": "^0.4.1",
51
+ "@adatechnology/game-floorplan-three": "^1.2.0",
52
+ "@adatechnology/game-shapes-three": "^0.4.1",
53
+ "@adatechnology/game-vfx-three": "^0.10.5",
54
+ "@adatechnology/game-weapons": "^0.13.0",
55
+ "@adatechnology/game-vfx": "^0.16.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "three": "^0.160.0"
@@ -65,11 +65,12 @@
65
65
  "tsup": "^8.5.1",
66
66
  "typescript": "^5.7.3",
67
67
  "vitest": "^3.2.4",
68
- "@adatechnology/game-test-room": "^0.35.4",
69
- "@adatechnology/golden-tool": "^0.0.0"
68
+ "@adatechnology/game-characters-three": "^0.12.0",
69
+ "@adatechnology/golden-tool": "^0.0.0",
70
+ "@adatechnology/game-test-room": "^0.37.0"
70
71
  },
71
72
  "scripts": {
72
- "build": "tsup",
73
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
73
74
  "typecheck": "tsc -p tsconfig.json --noEmit",
74
75
  "test": "vitest run"
75
76
  }