@adatechnology/game-weapons-three 0.29.9 → 0.30.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 (46) hide show
  1. package/assets/weapon-svg/CREDITS.md +1 -1
  2. package/assets/weapon-svg/credits.html +1 -1
  3. package/assets/weapon-svg/generated/beretta_92fs.svg +1 -1
  4. package/assets/weapon-svg/generated/colt_m1911.svg +1 -1
  5. package/assets/weapon-svg/generated/colt_python.svg +1 -1
  6. package/assets/weapon-svg/generated/cz_75.svg +1 -1
  7. package/assets/weapon-svg/generated/desert_eagle_mark_xix.svg +1 -1
  8. package/assets/weapon-svg/generated/fists.svg +1 -0
  9. package/assets/weapon-svg/generated/fn_five_seven.svg +1 -1
  10. package/assets/weapon-svg/generated/glock_17.svg +1 -1
  11. package/assets/weapon-svg/generated/glock_18.svg +1 -1
  12. package/assets/weapon-svg/generated/glock_19.svg +1 -1
  13. package/assets/weapon-svg/generated/hand.svg +1 -0
  14. package/assets/weapon-svg/generated/hk_usp.svg +1 -1
  15. package/assets/weapon-svg/generated/kel_tec_ksg.svg +1 -1
  16. package/assets/weapon-svg/generated/kick.svg +1 -0
  17. package/assets/weapon-svg/generated/kriss_vector.svg +1 -1
  18. package/assets/weapon-svg/generated/makarov_pm.svg +1 -1
  19. package/assets/weapon-svg/generated/pistol_45.svg +1 -1
  20. package/assets/weapon-svg/generated/pistol_9mm.svg +1 -1
  21. package/assets/weapon-svg/generated/revolver_357.svg +1 -1
  22. package/assets/weapon-svg/generated/revolver_38.svg +1 -1
  23. package/assets/weapon-svg/generated/shove.svg +1 -0
  24. package/assets/weapon-svg/generated/sig_sauer_p226.svg +1 -1
  25. package/assets/weapon-svg/generated/sig_sauer_p320.svg +1 -1
  26. package/assets/weapon-svg/generated/sw_686.svg +1 -1
  27. package/assets/weapon-svg/generated/sw_model_29.svg +1 -1
  28. package/assets/weapon-svg/generated/taurus_82.svg +1 -1
  29. package/assets/weapon-svg/generated/taurus_g2c.svg +1 -1
  30. package/assets/weapon-svg/generated/taurus_pt100.svg +1 -1
  31. package/assets/weapon-svg/generated/taurus_th380.svg +1 -1
  32. package/assets/weapon-svg/generated/taurus_ts9.svg +1 -1
  33. package/assets/weapon-svg/generated/walther_p99.svg +1 -1
  34. package/assets/weapon-svg/manifest.json +16 -0
  35. package/dist/{chunk-5IW5LQG6.js → chunk-RAWW6JTZ.js} +334 -96
  36. package/dist/chunk-RAWW6JTZ.js.map +1 -0
  37. package/dist/index.d.ts +17 -4
  38. package/dist/index.global.js +1473 -664
  39. package/dist/index.global.js.map +1 -1
  40. package/dist/index.js +47 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/{testing-Bk34V-6X.d.ts → testing-44lDo2Cx.d.ts} +34 -1
  43. package/dist/testing.d.ts +1 -1
  44. package/dist/testing.js +1 -1
  45. package/package.json +15 -14
  46. package/dist/chunk-5IW5LQG6.js.map +0 -1
package/dist/index.js CHANGED
@@ -101,7 +101,7 @@ import {
101
101
  worldExplosiveItem,
102
102
  worldExplosiveShell,
103
103
  worldExplosiveValve
104
- } from "./chunk-5IW5LQG6.js";
104
+ } from "./chunk-RAWW6JTZ.js";
105
105
 
106
106
  // src/projectile-model.ts
107
107
  import { markKitOrigin } from "@adatechnology/game-contracts";
@@ -124,6 +124,51 @@ function explosiveProjectile(THREE, query) {
124
124
  return { model: holder, axis: [0, 1, 0], ...body ? { body } : {} };
125
125
  }
126
126
 
127
+ // src/body-action-models.ts
128
+ var SKIN = 14263420;
129
+ var CLOTH = 3099514;
130
+ var SOLE = 8947848;
131
+ var block = (THREE, group, [width, height, depth, x, y, z = 0, turn = 0], color, metalness = 0) => {
132
+ const mesh = new THREE.Mesh(new THREE.BoxGeometry(width, height, depth), new THREE.MeshStandardMaterial({ color, metalness }));
133
+ mesh.position.set(x, y, z);
134
+ mesh.rotation.z = turn;
135
+ group.add(mesh);
136
+ };
137
+ var forearm = (THREE, group, y) => block(THREE, group, [0.34, 0.075, 0.07, -0.17, y], CLOTH);
138
+ var openHand = (THREE, group) => {
139
+ forearm(THREE, group, 0);
140
+ block(THREE, group, [0.1, 0.09, 0.03, 0.05, 0], SKIN);
141
+ for (const [index, y] of [-0.033, -0.011, 0.011, 0.033].entries()) block(THREE, group, [0.085 - (index === 0 || index === 3 ? 0.012 : 0), 0.019, 0.025, 0.145, y + (index - 1.5) * 4e-3, 0, (index - 1.5) * 0.09], SKIN);
142
+ block(THREE, group, [0.06, 0.022, 0.025, 0.07, 0.07, 0, 0.7], SKIN);
143
+ };
144
+ var fists = (THREE, group) => {
145
+ for (const y of [-0.075, 0.075]) {
146
+ forearm(THREE, group, y);
147
+ block(THREE, group, [0.095, 0.085, 0.08, 0.05, y], SKIN);
148
+ for (const step of [-1.5, -0.5, 0.5, 1.5]) block(THREE, group, [0.025, 0.018, 0.02, 0.105, y + step * 0.02], SKIN);
149
+ }
150
+ };
151
+ var shove = (THREE, group) => {
152
+ forearm(THREE, group, 0);
153
+ block(THREE, group, [0.035, 0.16, 0.11, 0.05, 0.04], SKIN);
154
+ block(THREE, group, [0.05, 0.03, 0.03, 0.02, -0.06, 0, 0.5], SKIN);
155
+ };
156
+ var kick = (THREE, group) => {
157
+ block(THREE, group, [0.5, 0.11, 0.11, -0.25, 0], CLOTH);
158
+ block(THREE, group, [0.07, 0.3, 0.12, 0.035, 0.04], CLOTH);
159
+ block(THREE, group, [0.03, 0.3, 0.125, 0.085, 0.04], SOLE, 0.8);
160
+ block(THREE, group, [0.07, 0.07, 0.12, 0.05, 0.2, 0, 0.3], CLOTH);
161
+ };
162
+ var BUILDERS = { hand: openHand, fists, shove, kick };
163
+ function buildBodyActionModel(THREE, id) {
164
+ const draw = BUILDERS[id];
165
+ if (!draw) return void 0;
166
+ const group = new THREE.Group();
167
+ group.name = id;
168
+ draw(THREE, group);
169
+ return group;
170
+ }
171
+
127
172
  // src/weapon-props.ts
128
173
  import { applyPatches, mergeById, removeIds } from "@adatechnology/game-contracts";
129
174
  function createWeaponProps(options = {}) {
@@ -177,6 +222,7 @@ export {
177
222
  WORLD_EXPLOSIVE_IDS,
178
223
  WORLD_EXPLOSIVE_PREFIX,
179
224
  applyCondition,
225
+ buildBodyActionModel,
180
226
  buildCartridge,
181
227
  buildCasing,
182
228
  buildExplosiveModel,
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 { explosiveCollider } from './engine-loose'\nimport type { LooseCollider } from './engine-loose'\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, the axis along its length and, for a hand grenade the engine can fly, its collider (the model's own parts, centred on it). */\nexport interface ProjectileModel {\n readonly model: THREE_NS.Object3D\n readonly axis: [number, number, number]\n readonly body?: LooseCollider\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 const body = query.kind === 'grenade' && query.explosive !== undefined ? explosiveCollider(THREE, query.explosive) : undefined\n return { model: holder, axis: [0, 1, 0], ...(body ? { body } : {}) }\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;AA6BvB,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,QAAM,OAAO,MAAM,SAAS,aAAa,MAAM,cAAc,SAAY,kBAAkB,OAAO,MAAM,SAAS,IAAI;AACrH,SAAO,EAAE,OAAO,QAAQ,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC,EAAG;AACrE;;;AChDA,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/body-action-models.ts","../src/weapon-props.ts"],"sourcesContent":["import { markKitOrigin } from '@adatechnology/game-contracts'\nimport type * as THREE_NS from 'three'\n\nimport { explosiveCollider } from './engine-loose'\nimport type { LooseCollider } from './engine-loose'\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, the axis along its length and, for a hand grenade the engine can fly, its collider (the model's own parts, centred on it). */\nexport interface ProjectileModel {\n readonly model: THREE_NS.Object3D\n readonly axis: [number, number, number]\n readonly body?: LooseCollider\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 const body = query.kind === 'grenade' && query.explosive !== undefined ? explosiveCollider(THREE, query.explosive) : undefined\n return { model: holder, axis: [0, 1, 0], ...(body ? { body } : {}) }\n}\n","/**\n * What the player does with the body instead of a gun (`BODY_ACTIONS`): the open hand, the fists, the shove and the kick, drawn the way a hotbar shows a tool, as one low-poly piece lying\n * along x (the reaching end to the right) so the thumbnail tool traces it like any weapon. They are pictures, not what the hands hold: the body already has arms and legs.\n */\nimport type * as THREE_NS from 'three'\n\ntype Three = typeof THREE_NS\ntype Block = readonly [width: number, height: number, depth: number, x: number, y: number, z?: number, turn?: number]\n\n/** Skin tone of the arms and hands. */\nconst SKIN = 0xd9a47c\n/** Cloth of the sleeve and the boot. */\nconst CLOTH = 0x2f4b7a\n/** The sole of the boot: the only part drawn as metal, so the thumbnail gives it the lighter tone. */\nconst SOLE = 0x888888\n\nconst block = (THREE: Three, group: THREE_NS.Group, [width, height, depth, x, y, z = 0, turn = 0]: Block, color: number, metalness = 0): void => {\n const mesh = new THREE.Mesh(new THREE.BoxGeometry(width, height, depth), new THREE.MeshStandardMaterial({ color, metalness }))\n mesh.position.set(x, y, z)\n mesh.rotation.z = turn\n group.add(mesh)\n}\n\n/** The forearm in its sleeve, ending at `x` = 0 with the wrist, at height `y`. */\nconst forearm = (THREE: Three, group: THREE_NS.Group, y: number): void => block(THREE, group, [0.34, 0.075, 0.07, -0.17, y], CLOTH)\n\nconst openHand = (THREE: Three, group: THREE_NS.Group): void => {\n forearm(THREE, group, 0)\n block(THREE, group, [0.1, 0.09, 0.03, 0.05, 0], SKIN)\n // the four fingers fanned a little, the thumb out to the side\n for (const [index, y] of [-0.033, -0.011, 0.011, 0.033].entries()) block(THREE, group, [0.085 - (index === 0 || index === 3 ? 0.012 : 0), 0.019, 0.025, 0.145, y + (index - 1.5) * 0.004, 0, (index - 1.5) * 0.09], SKIN)\n block(THREE, group, [0.06, 0.022, 0.025, 0.07, 0.07, 0, 0.7], SKIN)\n}\n\nconst fists = (THREE: Three, group: THREE_NS.Group): void => {\n for (const y of [-0.075, 0.075]) {\n forearm(THREE, group, y)\n block(THREE, group, [0.095, 0.085, 0.08, 0.05, y], SKIN)\n // the knuckles of the closed hand\n for (const step of [-1.5, -0.5, 0.5, 1.5]) block(THREE, group, [0.025, 0.018, 0.02, 0.105, y + step * 0.02], SKIN)\n }\n}\n\nconst shove = (THREE: Three, group: THREE_NS.Group): void => {\n forearm(THREE, group, 0)\n // the palm flat to the front, the fingers up and the thumb out\n block(THREE, group, [0.035, 0.16, 0.11, 0.05, 0.04], SKIN)\n block(THREE, group, [0.05, 0.03, 0.03, 0.02, -0.06, 0, 0.5], SKIN)\n}\n\nconst kick = (THREE: Three, group: THREE_NS.Group): void => {\n // the leg out ahead, the boot at its end with its sole to the front and its toe up\n block(THREE, group, [0.5, 0.11, 0.11, -0.25, 0], CLOTH)\n block(THREE, group, [0.07, 0.3, 0.12, 0.035, 0.04], CLOTH)\n block(THREE, group, [0.03, 0.3, 0.125, 0.085, 0.04], SOLE, 0.8)\n block(THREE, group, [0.07, 0.07, 0.12, 0.05, 0.2, 0, 0.3], CLOTH)\n}\n\nconst BUILDERS: Readonly<Record<string, (THREE: Three, group: THREE_NS.Group) => void>> = { hand: openHand, fists, shove, kick }\n\n/** The picture of a body action, or undefined for an id that is not one. */\nexport function buildBodyActionModel(THREE: Three, id: string): THREE_NS.Group | undefined {\n const draw = BUILDERS[id]\n if (!draw) return undefined\n const group = new THREE.Group()\n group.name = id\n draw(THREE, group)\n return group\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;AA6BvB,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,K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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, ToolHand, 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, HandSeat, 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';
@@ -929,6 +929,9 @@ interface FxLayers {
929
929
  beams: boolean;
930
930
  }
931
931
 
932
+ /** The sides a model's port can be on (the others belong to the chambers and the breech). */
933
+ type PortSide = 'right' | 'up' | 'down';
934
+
932
935
  /** How the gallery builders describe a weapon: the short keys of `data/models.json` (the page's own option names), all optional. */
933
936
  interface ModelOptions {
934
937
  /** Total length and barrel length in mm, and the calibre text, as the weapons table gives them. */
@@ -975,6 +978,8 @@ interface ModelOptions {
975
978
  scope?: number;
976
979
  brake?: number;
977
980
  ejectBack?: number;
981
+ /** Which way the ejection port throws the case when it is not the right side (`down`: under the receiver, `up`). */
982
+ eject?: PortSide;
978
983
  round?: number;
979
984
  ar?: number;
980
985
  ak?: number;
@@ -1011,6 +1016,8 @@ interface ModelOptions {
1011
1016
  m1887?: number;
1012
1017
  /** Launcher type: `rpg`, `m72`, `at4`, `carl`, `flame`, `flameDIY`. */
1013
1018
  lt?: string;
1019
+ /** A pack the body wears (the tanks of a flamethrower) is built apart from the gun (`ModelParts.worn`) instead of as part of it. */
1020
+ separateWorn?: boolean;
1014
1021
  }
1015
1022
  /**
1016
1023
  * Numbers the builders write down while they draw, in the space of `inner` (metres along the barrel, before `fitLength` stretches it): where the accessories go.
@@ -1072,8 +1079,12 @@ interface ModelParts {
1072
1079
  grip?: THREE_NS.Object3D;
1073
1080
  /** The existing selector or safety mesh; the gallery draws it but does not move it. */
1074
1081
  safety?: THREE_NS.Object3D;
1082
+ /** The front and rear sight blocks that stand on the weapon's top: each rests on the surface of the part it is a child of (the slide's, the barrel's, the frame's). */
1083
+ sights?: THREE_NS.Object3D[];
1075
1084
  muzzle?: THREE_NS.Object3D;
1076
1085
  eject?: THREE_NS.Object3D;
1086
+ /** The side the ejection port faces (default `right`). */
1087
+ ejectSide?: PortSide;
1077
1088
  loadPort?: THREE_NS.Object3D;
1078
1089
  topLoad?: THREE_NS.Object3D;
1079
1090
  /** Parts that glow with barrel heat; each owns a clone of its material. */
@@ -1098,6 +1109,24 @@ interface ModelParts {
1098
1109
  /** The pivot a launcher under the barrel sits in (made by `rigUnderbarrel`), and its muzzle mark once one is fitted. */
1099
1110
  ugl?: THREE_NS.Object3D;
1100
1111
  uglMuzzle?: THREE_NS.Object3D;
1112
+ /** What the body wears and the hand does not hold (the fuel tanks of a flamethrower); see `WornPack`. */
1113
+ worn?: WornPack;
1114
+ }
1115
+ /**
1116
+ * A pack the body wears on its back, joined to the hand-held part by a hose. Built apart from the weapon (`buildWeaponModelById(id, { worn: 'separate' })`): the gun in the hands is the wand
1117
+ * alone and the viewmodel hangs the pack on the body's `back` slot, drawing the hose between the two ends. Without the option the gun is one piece, as the gallery draws it.
1118
+ */
1119
+ interface WornPack {
1120
+ /** The pack's own group (+x points away from the body when worn, +y up). */
1121
+ root: THREE_NS.Group;
1122
+ /** Where the pack rests on the back, in `root`. */
1123
+ mount: THREE_NS.Object3D;
1124
+ /** The end of the hose on the pack, in `root`. */
1125
+ port: THREE_NS.Object3D;
1126
+ /** The end of the hose on the wand, in the model of the gun. */
1127
+ wandEnd: THREE_NS.Object3D;
1128
+ /** The material of the hose. */
1129
+ hoseMaterial: THREE_NS.Material;
1101
1130
  }
1102
1131
  /** How the stock moves when it collapses: a slide of `travel` metres along the weapon (in `inner` units), or a half turn about `axis` (`foldAxis` of the rule). */
1103
1132
  interface StockMove {
@@ -1326,6 +1355,8 @@ interface WeaponFxOptions {
1326
1355
  contact?: LaserRaycast;
1327
1356
  /** Where the body holds the tool (`ModuleHost.holdFrame`): third person draws it there at its real size. */
1328
1357
  bodyHold?: () => HandPose | null;
1358
+ /** The places of the body (`ModuleHost.bodySlot`): a pack the body wears (the tanks of a flamethrower) hangs on its `back` while the gun is in the hands. */
1359
+ bodySlot?: (slot: string) => HandPose | null;
1329
1360
  /** 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. */
1330
1361
  leftBodyHold?: () => HandPose | null;
1331
1362
  /** 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. */
@@ -1362,6 +1393,8 @@ interface WeaponFx {
1362
1393
  setCondition(condition: string): void;
1363
1394
  /** 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. */
1364
1395
  handTargets(): HandTargets | null;
1396
+ /** Where the arms really took the hands (`HandSeat`): a tool rigid in the hand goes with it; a gun keeps its aim. */
1397
+ seat(reached: Parameters<HandSeat>[0]): boolean;
1365
1398
  /**
1366
1399
  * 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
1367
1400
  * one of the left hand's weapon with a weapon in each hand.
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, ai as createExplosivesTestModule, al as createWeaponsTestModule, ao as explosivesTextOf, ax as weaponsLayout } from './testing-Bk34V-6X.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-44lDo2Cx.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-5IW5LQG6.js";
12
+ } from "./chunk-RAWW6JTZ.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.29.9",
3
+ "version": "0.30.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,16 +44,16 @@
44
44
  "assets"
45
45
  ],
46
46
  "dependencies": {
47
- "@adatechnology/game-audio": "^0.15.12",
48
- "@adatechnology/game-contracts": "^0.48.0",
49
- "@adatechnology/game-floorplan-three": "^9.0.1",
50
- "@adatechnology/game-items-three": "^0.11.8",
51
- "@adatechnology/game-physics": "^0.11.1",
52
- "@adatechnology/game-render-three": "^0.5.4",
53
- "@adatechnology/game-shapes-three": "^0.4.2",
54
- "@adatechnology/game-vfx": "^0.19.0",
55
- "@adatechnology/game-vfx-three": "^0.11.2",
56
- "@adatechnology/game-weapons": "^0.15.4"
47
+ "@adatechnology/game-contracts": "^0.49.0",
48
+ "@adatechnology/game-audio": "^0.15.13",
49
+ "@adatechnology/game-floorplan-three": "^10.0.0",
50
+ "@adatechnology/game-items-three": "^0.12.0",
51
+ "@adatechnology/game-render-three": "^0.5.5",
52
+ "@adatechnology/game-physics": "^0.11.2",
53
+ "@adatechnology/game-shapes-three": "^0.5.0",
54
+ "@adatechnology/game-vfx": "^0.20.0",
55
+ "@adatechnology/game-vfx-three": "^0.11.4",
56
+ "@adatechnology/game-weapons": "^0.15.5"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "three": "^0.160.0"
@@ -66,9 +66,10 @@
66
66
  "tsup": "^8.5.1",
67
67
  "typescript": "^5.7.3",
68
68
  "vitest": "^3.2.4",
69
- "@adatechnology/game-characters-three": "^0.17.0",
70
- "@adatechnology/game-physics-jolt": "^0.7.7",
71
- "@adatechnology/game-test-room": "^1.10.4",
69
+ "@adatechnology/game-characters-people": "^0.6.0",
70
+ "@adatechnology/game-characters-three": "^0.18.0",
71
+ "@adatechnology/game-physics-jolt": "^0.7.8",
72
+ "@adatechnology/game-test-room": "^1.11.0",
72
73
  "@adatechnology/golden-tool": "^0.0.0"
73
74
  },
74
75
  "scripts": {