@adatechnology/game-weapons-three 0.27.6 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GXZM4CE6.js → chunk-5IW5LQG6.js} +89 -7
- package/dist/chunk-5IW5LQG6.js.map +1 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.global.js +1679 -942
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +12 -12
- package/dist/chunk-GXZM4CE6.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
EXPLOSIVES_AREA_ID,
|
|
12
12
|
EXPLOSIVES_TEXT,
|
|
13
13
|
EXPLOSIVE_MODEL_IDS,
|
|
14
|
+
FAMILY_MOTIONS,
|
|
14
15
|
GAME_DISTANCE_CURVE,
|
|
15
16
|
GAME_SOUND_CLASSES,
|
|
16
17
|
GROUND_SLOT,
|
|
@@ -100,7 +101,7 @@ import {
|
|
|
100
101
|
worldExplosiveItem,
|
|
101
102
|
worldExplosiveShell,
|
|
102
103
|
worldExplosiveValve
|
|
103
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-5IW5LQG6.js";
|
|
104
105
|
|
|
105
106
|
// src/projectile-model.ts
|
|
106
107
|
import { markKitOrigin } from "@adatechnology/game-contracts";
|
|
@@ -147,6 +148,7 @@ export {
|
|
|
147
148
|
EXPLOSIVES_AREA_ID,
|
|
148
149
|
EXPLOSIVES_TEXT,
|
|
149
150
|
EXPLOSIVE_MODEL_IDS,
|
|
151
|
+
FAMILY_MOTIONS,
|
|
150
152
|
GAME_DISTANCE_CURVE,
|
|
151
153
|
GAME_SOUND_CLASSES,
|
|
152
154
|
GROUND_SLOT,
|
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":"
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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2B,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":[]}
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adatechnology/game-weapons-three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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-
|
|
48
|
-
"@adatechnology/game-
|
|
49
|
-
"@adatechnology/game-items-three": "^0.10.7",
|
|
50
|
-
"@adatechnology/game-contracts": "^0.43.1",
|
|
47
|
+
"@adatechnology/game-floorplan-three": "^4.1.4",
|
|
48
|
+
"@adatechnology/game-items-three": "^0.11.1",
|
|
51
49
|
"@adatechnology/game-physics": "^0.10.0",
|
|
52
|
-
"@adatechnology/game-
|
|
53
|
-
"@adatechnology/game-
|
|
54
|
-
"@adatechnology/game-shapes-three": "^0.4.
|
|
55
|
-
"@adatechnology/game-
|
|
56
|
-
"@adatechnology/game-vfx": "^0.16.0"
|
|
50
|
+
"@adatechnology/game-audio": "^0.15.8",
|
|
51
|
+
"@adatechnology/game-contracts": "^0.44.0",
|
|
52
|
+
"@adatechnology/game-shapes-three": "^0.4.2",
|
|
53
|
+
"@adatechnology/game-render-three": "^0.5.0",
|
|
54
|
+
"@adatechnology/game-vfx": "^0.16.0",
|
|
55
|
+
"@adatechnology/game-vfx-three": "^0.10.12",
|
|
56
|
+
"@adatechnology/game-weapons": "^0.15.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"three": "^0.160.0"
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"tsup": "^8.5.1",
|
|
67
67
|
"typescript": "^5.7.3",
|
|
68
68
|
"vitest": "^3.2.4",
|
|
69
|
-
"@adatechnology/game-characters-three": "^0.
|
|
70
|
-
"@adatechnology/game-test-room": "^1.0.2",
|
|
69
|
+
"@adatechnology/game-characters-three": "^0.15.0",
|
|
71
70
|
"@adatechnology/game-physics-jolt": "^0.7.4",
|
|
71
|
+
"@adatechnology/game-test-room": "^1.2.0",
|
|
72
72
|
"@adatechnology/golden-tool": "^0.0.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|