@khr3/launchers 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +43 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/launcherKhr.d.ts +56 -0
- package/dist/launcherKhr.js +119 -0
- package/dist/launcherParts.d.ts +58 -0
- package/dist/launcherParts.js +119 -0
- package/dist/recipes.d.ts +6 -0
- package/dist/recipes.js +138 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/runtime.js +60 -0
- package/dist/schema.d.ts +36 -0
- package/dist/schema.js +50 -0
- package/package.json +48 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 khr3 contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@khr3/launchers`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Zero-dependency KHR firearm & launcher moving-part planner (`receiver`, `bolt`, `pump`, `trigger`, `magazine`, `barrel`, `stock`, `screen_rect`), rail/character mount sockets, data-driven ammo catalog, and deterministic 60Hz cycle state machine for `@khr3/core` and `Kolmo`.
|
|
4
|
+
|
|
5
|
+
- **Zero dependencies & zero `koota`**: Pure TypeScript ESM with `.d.ts` declarations.
|
|
6
|
+
- **Articulated KHR output**: `planLauncher(recipe)` lumps fixed parts into `Receiver_Root` (with exact parallel-axis mass & box inertia) and emits prismatic/revolute `KHR_physics_rigid_bodies` joints + spring drives for `Bolt`, `Trigger`, and `Pump`, ready for `@khr3/core` `exportKhrGlb`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @khr3/launchers
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Main Exports
|
|
15
|
+
|
|
16
|
+
| Area | Exports |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| **Schema & Ammo** | `LAUNCHER_PART_ROLES`, `LAUNCHER_SOCKETS`, `RAIL_SOCKETS`, `CHARACTER_SOCKETS`, `DEFAULT_AMMO_CATALOG`, `validateLauncherSpec` |
|
|
19
|
+
| **Recipes & Multi-Body Planner** | `KOLMOGOROV_PISTOL`, `KOLMOGOROV_CARBINE`, `KOLMOGOROV_SHOTGUN`, `LAUNCHER_RECIPES`, `findLauncherRecipe`, `buildLauncherParts`, `resolveLauncherSockets`, `planLauncher` |
|
|
20
|
+
| **Deterministic Runtime** | `createLauncherState`, `stepLauncher`, `attachModule`, `detachModule` (fire cadence, bolt/pump cycling, magazine depletion, timed reload, recoil impulse, rail attachments) |
|
|
21
|
+
|
|
22
|
+
## 1. Plan an Articulated KHR3 Launcher `.glb`
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { KOLMOGOROV_CARBINE, planLauncher } from "@khr3/launchers";
|
|
26
|
+
|
|
27
|
+
const plan = planLauncher(KOLMOGOROV_CARBINE);
|
|
28
|
+
// plan.nodes -> scene hierarchy (Receiver_Root + articulated Bolt/Trigger + Socket_* nodes)
|
|
29
|
+
// plan.specs -> KhrExportNodeSpec-compatible rigid bodies, colliders, and prismatic/revolute joints
|
|
30
|
+
// plan.sceneExtras -> { launcher: plan.spec } for `@khr3/core` exportKhrGlb(root, plan.specs, plan.sceneExtras)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 2. Step the Deterministic Firing & Reload Cycle
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { KOLMOGOROV_PISTOL, createLauncherState, stepLauncher } from "@khr3/launchers";
|
|
37
|
+
|
|
38
|
+
const state = createLauncherState(KOLMOGOROV_PISTOL.spec);
|
|
39
|
+
const step = stepLauncher(state, { trigger: true, reload: false }, 1 / 60);
|
|
40
|
+
|
|
41
|
+
if (step.fired) {
|
|
42
|
+
// Spawn round from `muzzle` socket with `step.ammo.muzzleSpeedMs` and apply `step.recoilImpulseNs`
|
|
43
|
+
}
|
|
44
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a parametric launcher recipe into the scene node tree and `KhrExportNodeSpecLike[]`
|
|
3
|
+
* consumed by `@khr3/core` `exportKhrGlb`.
|
|
4
|
+
* Fixed parts lump into `Receiver_Root`; articulated parts (`Bolt`, `Trigger`, `Pump`) emit
|
|
5
|
+
* `KHR_physics_rigid_bodies` prismatic/revolute joints with spring drives.
|
|
6
|
+
*/
|
|
7
|
+
import { type LauncherPart, type LauncherRecipe, type Vec3 } from "./launcherParts.js";
|
|
8
|
+
import type { LauncherSocketName, LauncherSpec, Vec3Tuple } from "./schema.js";
|
|
9
|
+
export interface LauncherNode {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly parent: string;
|
|
12
|
+
readonly position: Vec3;
|
|
13
|
+
readonly size: Vec3;
|
|
14
|
+
}
|
|
15
|
+
export interface KhrLauncherNodeSpecLike {
|
|
16
|
+
readonly nodeName: string;
|
|
17
|
+
readonly motion?: {
|
|
18
|
+
readonly isKinematic?: boolean;
|
|
19
|
+
readonly mass?: number;
|
|
20
|
+
readonly centerOfMass?: Vec3;
|
|
21
|
+
readonly inertiaDiagonal?: Vec3;
|
|
22
|
+
};
|
|
23
|
+
readonly collider?: {
|
|
24
|
+
readonly shape: {
|
|
25
|
+
readonly type: "box";
|
|
26
|
+
readonly size: Vec3;
|
|
27
|
+
};
|
|
28
|
+
readonly friction?: number;
|
|
29
|
+
};
|
|
30
|
+
readonly joint?: {
|
|
31
|
+
readonly connectedNodeName: string;
|
|
32
|
+
readonly kind: "revolute" | "prismatic";
|
|
33
|
+
readonly axis: Vec3;
|
|
34
|
+
readonly limits: [number, number];
|
|
35
|
+
readonly drive: {
|
|
36
|
+
readonly mode: "acceleration";
|
|
37
|
+
readonly stiffness: number;
|
|
38
|
+
readonly damping: number;
|
|
39
|
+
readonly positionTarget: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly extras?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
export interface LauncherPlan {
|
|
45
|
+
readonly recipeId: string;
|
|
46
|
+
readonly spec: LauncherSpec;
|
|
47
|
+
readonly parts: LauncherPart[];
|
|
48
|
+
readonly totalMassKg: number;
|
|
49
|
+
readonly fixedMassKg: number;
|
|
50
|
+
readonly centerOfMass: Vec3;
|
|
51
|
+
readonly inertiaDiagonal: Vec3;
|
|
52
|
+
readonly sockets: Record<LauncherSocketName, Vec3Tuple>;
|
|
53
|
+
readonly nodes: LauncherNode[];
|
|
54
|
+
readonly specs: KhrLauncherNodeSpecLike[];
|
|
55
|
+
}
|
|
56
|
+
export declare function planLauncher(recipe: LauncherRecipe, friction?: number): LauncherPlan;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a parametric launcher recipe into the scene node tree and `KhrExportNodeSpecLike[]`
|
|
3
|
+
* consumed by `@khr3/core` `exportKhrGlb`.
|
|
4
|
+
* Fixed parts lump into `Receiver_Root`; articulated parts (`Bolt`, `Trigger`, `Pump`) emit
|
|
5
|
+
* `KHR_physics_rigid_bodies` prismatic/revolute joints with spring drives.
|
|
6
|
+
*/
|
|
7
|
+
import { boxInertiaDiagonal, buildLauncherParts, resolveLauncherSockets, } from "./launcherParts.js";
|
|
8
|
+
function sumLauncherBoxes(parts) {
|
|
9
|
+
let m = 0;
|
|
10
|
+
const c = [0, 0, 0];
|
|
11
|
+
for (const p of parts) {
|
|
12
|
+
m += p.massKg;
|
|
13
|
+
c[0] += p.massKg * p.center[0];
|
|
14
|
+
c[1] += p.massKg * p.center[1];
|
|
15
|
+
c[2] += p.massKg * p.center[2];
|
|
16
|
+
}
|
|
17
|
+
c[0] /= m;
|
|
18
|
+
c[1] /= m;
|
|
19
|
+
c[2] /= m;
|
|
20
|
+
const diag = [0, 0, 0];
|
|
21
|
+
for (const p of parts) {
|
|
22
|
+
const own = boxInertiaDiagonal(p.massKg, p.size);
|
|
23
|
+
const dx = p.center[0] - c[0], dy = p.center[1] - c[1], dz = p.center[2] - c[2];
|
|
24
|
+
diag[0] += own[0] + p.massKg * (dy * dy + dz * dz);
|
|
25
|
+
diag[1] += own[1] + p.massKg * (dx * dx + dz * dz);
|
|
26
|
+
diag[2] += own[2] + p.massKg * (dx * dx + dy * dy);
|
|
27
|
+
}
|
|
28
|
+
return { massKg: m, centerOfMass: c, inertiaDiagonal: diag };
|
|
29
|
+
}
|
|
30
|
+
export function planLauncher(recipe, friction = 0.5) {
|
|
31
|
+
const parts = buildLauncherParts(recipe);
|
|
32
|
+
const fixed = parts.filter((p) => !p.joint);
|
|
33
|
+
const moving = parts.filter((p) => p.joint);
|
|
34
|
+
const total = sumLauncherBoxes(parts);
|
|
35
|
+
const rootProps = sumLauncherBoxes(fixed);
|
|
36
|
+
const sockets = resolveLauncherSockets(recipe);
|
|
37
|
+
const nodes = [
|
|
38
|
+
{ name: "Receiver_Root", parent: "root", position: [0, 0, 0], size: [0, 0, 0] },
|
|
39
|
+
];
|
|
40
|
+
const specs = [
|
|
41
|
+
{
|
|
42
|
+
nodeName: "Receiver_Root",
|
|
43
|
+
motion: {
|
|
44
|
+
isKinematic: false,
|
|
45
|
+
mass: rootProps.massKg,
|
|
46
|
+
centerOfMass: rootProps.centerOfMass,
|
|
47
|
+
inertiaDiagonal: rootProps.inertiaDiagonal,
|
|
48
|
+
},
|
|
49
|
+
extras: {
|
|
50
|
+
role: "receiver",
|
|
51
|
+
launcherId: recipe.id,
|
|
52
|
+
ammoId: recipe.spec.ammoId,
|
|
53
|
+
fireRateHz: recipe.spec.fireRateHz,
|
|
54
|
+
magazineCapacity: recipe.spec.magazineCapacity,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
for (const p of fixed) {
|
|
59
|
+
nodes.push({ name: p.name, parent: "Receiver_Root", position: p.center, size: p.size });
|
|
60
|
+
specs.push({
|
|
61
|
+
nodeName: p.name,
|
|
62
|
+
collider: { shape: { type: "box", size: p.size }, friction },
|
|
63
|
+
extras: { role: p.role },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
for (const p of moving) {
|
|
67
|
+
const j = p.joint;
|
|
68
|
+
const localOffset = [p.center[0] - j.anchor[0], p.center[1] - j.anchor[1], p.center[2] - j.anchor[2]];
|
|
69
|
+
const ownDiag = boxInertiaDiagonal(p.massKg, p.size);
|
|
70
|
+
nodes.push({ name: p.name, parent: "Receiver_Root", position: j.anchor, size: [0, 0, 0] });
|
|
71
|
+
nodes.push({ name: `${p.name}_Collider`, parent: p.name, position: localOffset, size: p.size });
|
|
72
|
+
specs.push({
|
|
73
|
+
nodeName: `${p.name}_Collider`,
|
|
74
|
+
collider: { shape: { type: "box", size: p.size }, friction },
|
|
75
|
+
});
|
|
76
|
+
specs.push({
|
|
77
|
+
nodeName: p.name,
|
|
78
|
+
motion: {
|
|
79
|
+
isKinematic: false,
|
|
80
|
+
mass: p.massKg,
|
|
81
|
+
centerOfMass: localOffset,
|
|
82
|
+
inertiaDiagonal: ownDiag,
|
|
83
|
+
},
|
|
84
|
+
joint: {
|
|
85
|
+
connectedNodeName: "Receiver_Root",
|
|
86
|
+
kind: j.kind,
|
|
87
|
+
axis: j.axis,
|
|
88
|
+
limits: j.limits,
|
|
89
|
+
drive: {
|
|
90
|
+
mode: "acceleration",
|
|
91
|
+
stiffness: j.stiffness,
|
|
92
|
+
damping: j.damping,
|
|
93
|
+
positionTarget: 0,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
extras: { role: p.role },
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
for (const [sockName, pos] of Object.entries(sockets)) {
|
|
100
|
+
const nodeName = `Socket_${sockName}`;
|
|
101
|
+
nodes.push({ name: nodeName, parent: "Receiver_Root", position: [pos[0], pos[1], pos[2]], size: [0, 0, 0] });
|
|
102
|
+
specs.push({
|
|
103
|
+
nodeName,
|
|
104
|
+
extras: { socketId: sockName, isIkAnchor: sockName.startsWith("grip_") },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
recipeId: recipe.id,
|
|
109
|
+
spec: recipe.spec,
|
|
110
|
+
parts,
|
|
111
|
+
totalMassKg: total.massKg,
|
|
112
|
+
fixedMassKg: rootProps.massKg,
|
|
113
|
+
centerOfMass: total.centerOfMass,
|
|
114
|
+
inertiaDiagonal: total.inertiaDiagonal,
|
|
115
|
+
sockets,
|
|
116
|
+
nodes,
|
|
117
|
+
specs,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parametric multi-part launcher definition: receiver, barrel, bolt/slide, pump, trigger, magazine, stock.
|
|
3
|
+
* Frame: SI metres, +Y up, +Z muzzle forward (or -Z muzzle in Khronos emitter space; socket `muzzle` gives exact local point).
|
|
4
|
+
* Zero runtime dependencies.
|
|
5
|
+
*/
|
|
6
|
+
import type { LauncherPartRole, LauncherSocketName, LauncherSpec, Vec3Tuple } from "./schema.js";
|
|
7
|
+
export type Vec3 = [number, number, number];
|
|
8
|
+
export interface LauncherJointSpec {
|
|
9
|
+
readonly kind: "prismatic" | "revolute";
|
|
10
|
+
readonly anchor: Vec3;
|
|
11
|
+
readonly axis: Vec3;
|
|
12
|
+
/** Metres for prismatic, radians for revolute. */
|
|
13
|
+
readonly limits: [number, number];
|
|
14
|
+
readonly stiffness: number;
|
|
15
|
+
readonly damping: number;
|
|
16
|
+
}
|
|
17
|
+
export interface LauncherPart {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly role: LauncherPartRole;
|
|
20
|
+
readonly massKg: number;
|
|
21
|
+
readonly center: Vec3;
|
|
22
|
+
readonly size: Vec3;
|
|
23
|
+
readonly joint?: LauncherJointSpec;
|
|
24
|
+
}
|
|
25
|
+
export interface LauncherDims {
|
|
26
|
+
readonly receiverLength: number;
|
|
27
|
+
readonly receiverWidth: number;
|
|
28
|
+
readonly receiverHeight: number;
|
|
29
|
+
readonly barrelLength: number;
|
|
30
|
+
readonly barrelDiameter: number;
|
|
31
|
+
readonly gripHeight: number;
|
|
32
|
+
readonly magLength: number;
|
|
33
|
+
readonly boltStroke: number;
|
|
34
|
+
readonly hasStock: boolean;
|
|
35
|
+
readonly hasPump: boolean;
|
|
36
|
+
readonly hasScreen?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface LauncherMasses {
|
|
39
|
+
readonly receiver: number;
|
|
40
|
+
readonly barrel: number;
|
|
41
|
+
readonly bolt: number;
|
|
42
|
+
readonly trigger: number;
|
|
43
|
+
readonly magazine: number;
|
|
44
|
+
readonly stock: number;
|
|
45
|
+
readonly pump: number;
|
|
46
|
+
readonly screen?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface LauncherRecipe {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly label: string;
|
|
51
|
+
readonly r2Key: string;
|
|
52
|
+
readonly spec: LauncherSpec;
|
|
53
|
+
readonly dims: LauncherDims;
|
|
54
|
+
readonly masses: LauncherMasses;
|
|
55
|
+
}
|
|
56
|
+
export declare function boxInertiaDiagonal(massKg: number, size: Vec3): Vec3;
|
|
57
|
+
export declare function buildLauncherParts(recipe: LauncherRecipe): LauncherPart[];
|
|
58
|
+
export declare function resolveLauncherSockets(recipe: LauncherRecipe): Record<LauncherSocketName, Vec3Tuple>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export function boxInertiaDiagonal(massKg, size) {
|
|
2
|
+
const [x, y, z] = size;
|
|
3
|
+
const k = massKg / 12;
|
|
4
|
+
return [k * (y * y + z * z), k * (x * x + z * z), k * (x * x + y * y)];
|
|
5
|
+
}
|
|
6
|
+
export function buildLauncherParts(recipe) {
|
|
7
|
+
const d = recipe.dims;
|
|
8
|
+
const m = recipe.masses;
|
|
9
|
+
if (!(d.receiverLength > 0 && d.receiverWidth > 0 && d.receiverHeight > 0 && d.barrelLength > 0)) {
|
|
10
|
+
throw new RangeError(`launcherParts(${recipe.id}): dimensions must be > 0`);
|
|
11
|
+
}
|
|
12
|
+
const zBarrelCenter = d.receiverLength * 0.5 + d.barrelLength * 0.5;
|
|
13
|
+
const yBarrel = d.receiverHeight * 0.25;
|
|
14
|
+
const parts = [
|
|
15
|
+
{
|
|
16
|
+
name: "Receiver",
|
|
17
|
+
role: "receiver",
|
|
18
|
+
massKg: m.receiver,
|
|
19
|
+
center: [0, 0, 0],
|
|
20
|
+
size: [d.receiverWidth, d.receiverHeight, d.receiverLength],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "Barrel",
|
|
24
|
+
role: "barrel",
|
|
25
|
+
massKg: m.barrel,
|
|
26
|
+
center: [0, yBarrel, zBarrelCenter],
|
|
27
|
+
size: [d.barrelDiameter, d.barrelDiameter, d.barrelLength],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Bolt",
|
|
31
|
+
role: "bolt",
|
|
32
|
+
massKg: m.bolt,
|
|
33
|
+
center: [0, d.receiverHeight * 0.35, 0],
|
|
34
|
+
size: [d.receiverWidth * 0.82, d.receiverHeight * 0.42, d.receiverLength * 0.55],
|
|
35
|
+
joint: {
|
|
36
|
+
kind: "prismatic",
|
|
37
|
+
anchor: [0, d.receiverHeight * 0.35, 0],
|
|
38
|
+
axis: [0, 0, 1],
|
|
39
|
+
limits: [-d.boltStroke, 0],
|
|
40
|
+
stiffness: 420,
|
|
41
|
+
damping: 24,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Trigger",
|
|
46
|
+
role: "trigger",
|
|
47
|
+
massKg: m.trigger,
|
|
48
|
+
center: [0, -d.receiverHeight * 0.55, -d.receiverLength * 0.12],
|
|
49
|
+
size: [d.receiverWidth * 0.28, 0.028, 0.016],
|
|
50
|
+
joint: {
|
|
51
|
+
kind: "revolute",
|
|
52
|
+
anchor: [0, -d.receiverHeight * 0.42, -d.receiverLength * 0.12],
|
|
53
|
+
axis: [1, 0, 0],
|
|
54
|
+
limits: [0, 0.45],
|
|
55
|
+
stiffness: 80,
|
|
56
|
+
damping: 8,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "Magazine",
|
|
61
|
+
role: "magazine",
|
|
62
|
+
massKg: m.magazine,
|
|
63
|
+
center: [0, -d.receiverHeight * 0.5 - d.magLength * 0.45, d.hasStock ? 0.04 : -d.receiverLength * 0.18],
|
|
64
|
+
size: [d.receiverWidth * 0.68, d.magLength, 0.045],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
if (d.hasStock && m.stock > 0) {
|
|
68
|
+
const stockLen = d.receiverLength * 0.75;
|
|
69
|
+
parts.push({
|
|
70
|
+
name: "Stock",
|
|
71
|
+
role: "stock",
|
|
72
|
+
massKg: m.stock,
|
|
73
|
+
center: [0, -d.receiverHeight * 0.1, -d.receiverLength * 0.5 - stockLen * 0.5],
|
|
74
|
+
size: [d.receiverWidth * 0.85, d.receiverHeight * 1.1, stockLen],
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (d.hasPump && m.pump > 0) {
|
|
78
|
+
const pumpZ = d.receiverLength * 0.5 + d.barrelLength * 0.38;
|
|
79
|
+
parts.push({
|
|
80
|
+
name: "Pump",
|
|
81
|
+
role: "pump",
|
|
82
|
+
massKg: m.pump,
|
|
83
|
+
center: [0, -d.receiverHeight * 0.1, pumpZ],
|
|
84
|
+
size: [d.receiverWidth * 1.15, d.receiverHeight * 0.65, 0.14],
|
|
85
|
+
joint: {
|
|
86
|
+
kind: "prismatic",
|
|
87
|
+
anchor: [0, -d.receiverHeight * 0.1, pumpZ],
|
|
88
|
+
axis: [0, 0, 1],
|
|
89
|
+
limits: [-0.095, 0],
|
|
90
|
+
stiffness: 320,
|
|
91
|
+
damping: 20,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (d.hasScreen && (m.screen ?? 0.03) > 0) {
|
|
96
|
+
parts.push({
|
|
97
|
+
name: "Screen_Rect",
|
|
98
|
+
role: "screen_rect",
|
|
99
|
+
massKg: m.screen ?? 0.03,
|
|
100
|
+
center: [0, d.receiverHeight * 0.52, -d.receiverLength * 0.32],
|
|
101
|
+
size: [d.receiverWidth * 0.72, 0.024, 0.006],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return parts;
|
|
105
|
+
}
|
|
106
|
+
export function resolveLauncherSockets(recipe) {
|
|
107
|
+
const d = recipe.dims;
|
|
108
|
+
const s = recipe.spec.sockets;
|
|
109
|
+
const zMuzzle = d.receiverLength * 0.5 + d.barrelLength;
|
|
110
|
+
return {
|
|
111
|
+
grip_primary: s.grip_primary ?? [0, -d.receiverHeight * 0.5 - d.gripHeight * 0.5, -d.receiverLength * 0.2],
|
|
112
|
+
grip_secondary: s.grip_secondary ?? [0, -d.receiverHeight * 0.25, d.receiverLength * 0.5 + d.barrelLength * 0.35],
|
|
113
|
+
rail_top: s.rail_top ?? [0, d.receiverHeight * 0.5 + 0.008, 0],
|
|
114
|
+
rail_under: s.rail_under ?? [0, -d.receiverHeight * 0.5 - 0.008, d.receiverLength * 0.35],
|
|
115
|
+
muzzle: s.muzzle ?? [0, d.receiverHeight * 0.25, zMuzzle],
|
|
116
|
+
eject_port: s.eject_port ?? [d.receiverWidth * 0.52, d.receiverHeight * 0.25, 0.02],
|
|
117
|
+
sight_align: s.sight_align ?? [0, d.receiverHeight * 0.5 + 0.022, -d.receiverLength * 0.25],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LauncherRecipe } from "./launcherParts.js";
|
|
2
|
+
export declare const KOLMOGOROV_PISTOL: LauncherRecipe;
|
|
3
|
+
export declare const KOLMOGOROV_CARBINE: LauncherRecipe;
|
|
4
|
+
export declare const KOLMOGOROV_SHOTGUN: LauncherRecipe;
|
|
5
|
+
export declare const LAUNCHER_RECIPES: readonly LauncherRecipe[];
|
|
6
|
+
export declare function findLauncherRecipe(id: string): LauncherRecipe;
|
package/dist/recipes.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { DEFAULT_AMMO_CATALOG } from "./schema.js";
|
|
2
|
+
export const KOLMOGOROV_PISTOL = Object.freeze({
|
|
3
|
+
id: "kolmogorov_pistol",
|
|
4
|
+
label: "Kolmogorov 9mm Sidearm",
|
|
5
|
+
r2Key: "weapons/kolmogorov_pistol.glb",
|
|
6
|
+
spec: Object.freeze({
|
|
7
|
+
id: "kolmogorov_pistol",
|
|
8
|
+
ammoId: DEFAULT_AMMO_CATALOG.pistol.id,
|
|
9
|
+
fireRateHz: 6.5,
|
|
10
|
+
magazineCapacity: 15,
|
|
11
|
+
reloadSec: 1.4,
|
|
12
|
+
recoilImpulseNs: 2.4,
|
|
13
|
+
sockets: Object.freeze({
|
|
14
|
+
grip_primary: [0, -0.06, -0.04],
|
|
15
|
+
rail_under: [0, -0.015, 0.08],
|
|
16
|
+
muzzle: [0, 0.02, 0.19],
|
|
17
|
+
eject_port: [0.016, 0.024, 0.02],
|
|
18
|
+
sight_align: [0, 0.038, -0.06],
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
dims: Object.freeze({
|
|
22
|
+
receiverLength: 0.16,
|
|
23
|
+
receiverWidth: 0.032,
|
|
24
|
+
receiverHeight: 0.042,
|
|
25
|
+
barrelLength: 0.11,
|
|
26
|
+
barrelDiameter: 0.018,
|
|
27
|
+
gripHeight: 0.10,
|
|
28
|
+
magLength: 0.11,
|
|
29
|
+
boltStroke: 0.042,
|
|
30
|
+
hasStock: false,
|
|
31
|
+
hasPump: false,
|
|
32
|
+
}),
|
|
33
|
+
masses: Object.freeze({
|
|
34
|
+
receiver: 0.48,
|
|
35
|
+
barrel: 0.14,
|
|
36
|
+
bolt: 0.24,
|
|
37
|
+
trigger: 0.02,
|
|
38
|
+
magazine: 0.18,
|
|
39
|
+
stock: 0,
|
|
40
|
+
pump: 0,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
export const KOLMOGOROV_CARBINE = Object.freeze({
|
|
44
|
+
id: "kolmogorov_carbine",
|
|
45
|
+
label: "Kolmogorov 5.56 Modular Carbine",
|
|
46
|
+
r2Key: "weapons/kolmogorov_carbine.glb",
|
|
47
|
+
spec: Object.freeze({
|
|
48
|
+
id: "kolmogorov_carbine",
|
|
49
|
+
ammoId: DEFAULT_AMMO_CATALOG.rifle.id,
|
|
50
|
+
fireRateHz: 11.5,
|
|
51
|
+
magazineCapacity: 30,
|
|
52
|
+
reloadSec: 1.9,
|
|
53
|
+
recoilImpulseNs: 4.1,
|
|
54
|
+
sockets: Object.freeze({
|
|
55
|
+
grip_primary: [0, -0.08, -0.07],
|
|
56
|
+
grip_secondary: [0, -0.03, 0.28],
|
|
57
|
+
rail_top: [0, 0.042, 0.04],
|
|
58
|
+
rail_under: [0, -0.032, 0.24],
|
|
59
|
+
muzzle: [0, 0.015, 0.56],
|
|
60
|
+
eject_port: [0.024, 0.018, 0.04],
|
|
61
|
+
sight_align: [0, 0.062, -0.08],
|
|
62
|
+
}),
|
|
63
|
+
}),
|
|
64
|
+
dims: Object.freeze({
|
|
65
|
+
receiverLength: 0.26,
|
|
66
|
+
receiverWidth: 0.046,
|
|
67
|
+
receiverHeight: 0.068,
|
|
68
|
+
barrelLength: 0.37,
|
|
69
|
+
barrelDiameter: 0.024,
|
|
70
|
+
gripHeight: 0.11,
|
|
71
|
+
magLength: 0.18,
|
|
72
|
+
boltStroke: 0.075,
|
|
73
|
+
hasStock: true,
|
|
74
|
+
hasPump: false,
|
|
75
|
+
}),
|
|
76
|
+
masses: Object.freeze({
|
|
77
|
+
receiver: 1.35,
|
|
78
|
+
barrel: 0.68,
|
|
79
|
+
bolt: 0.38,
|
|
80
|
+
trigger: 0.03,
|
|
81
|
+
magazine: 0.36,
|
|
82
|
+
stock: 0.45,
|
|
83
|
+
pump: 0,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
export const KOLMOGOROV_SHOTGUN = Object.freeze({
|
|
87
|
+
id: "kolmogorov_shotgun",
|
|
88
|
+
label: "Kolmogorov 12G Pump Breacher",
|
|
89
|
+
r2Key: "weapons/kolmogorov_shotgun.glb",
|
|
90
|
+
spec: Object.freeze({
|
|
91
|
+
id: "kolmogorov_shotgun",
|
|
92
|
+
ammoId: DEFAULT_AMMO_CATALOG.orb.id,
|
|
93
|
+
fireRateHz: 1.4,
|
|
94
|
+
magazineCapacity: 8,
|
|
95
|
+
reloadSec: 2.6,
|
|
96
|
+
recoilImpulseNs: 9.5,
|
|
97
|
+
sockets: Object.freeze({
|
|
98
|
+
grip_primary: [0, -0.07, -0.08],
|
|
99
|
+
grip_secondary: [0, -0.02, 0.34],
|
|
100
|
+
rail_top: [0, 0.04, 0.02],
|
|
101
|
+
muzzle: [0, 0.018, 0.64],
|
|
102
|
+
eject_port: [0.025, 0.018, 0.05],
|
|
103
|
+
sight_align: [0, 0.052, -0.09],
|
|
104
|
+
}),
|
|
105
|
+
}),
|
|
106
|
+
dims: Object.freeze({
|
|
107
|
+
receiverLength: 0.24,
|
|
108
|
+
receiverWidth: 0.048,
|
|
109
|
+
receiverHeight: 0.064,
|
|
110
|
+
barrelLength: 0.46,
|
|
111
|
+
barrelDiameter: 0.028,
|
|
112
|
+
gripHeight: 0.10,
|
|
113
|
+
magLength: 0.08,
|
|
114
|
+
boltStroke: 0.085,
|
|
115
|
+
hasStock: true,
|
|
116
|
+
hasPump: true,
|
|
117
|
+
}),
|
|
118
|
+
masses: Object.freeze({
|
|
119
|
+
receiver: 1.45,
|
|
120
|
+
barrel: 0.85,
|
|
121
|
+
bolt: 0.32,
|
|
122
|
+
trigger: 0.03,
|
|
123
|
+
magazine: 0.22,
|
|
124
|
+
stock: 0.52,
|
|
125
|
+
pump: 0.28,
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
128
|
+
export const LAUNCHER_RECIPES = Object.freeze([
|
|
129
|
+
KOLMOGOROV_PISTOL,
|
|
130
|
+
KOLMOGOROV_CARBINE,
|
|
131
|
+
KOLMOGOROV_SHOTGUN,
|
|
132
|
+
]);
|
|
133
|
+
export function findLauncherRecipe(id) {
|
|
134
|
+
const hit = LAUNCHER_RECIPES.find((r) => r.id === id);
|
|
135
|
+
if (!hit)
|
|
136
|
+
throw new RangeError(`@khr3/launchers: unknown recipe "${id}"`);
|
|
137
|
+
return hit;
|
|
138
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AttachmentSpec, type LauncherSpec, type RailSocketName, type Vec3Tuple } from "./schema.js";
|
|
2
|
+
export interface LauncherInput {
|
|
3
|
+
trigger: boolean;
|
|
4
|
+
reload?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface LaunchEvent {
|
|
7
|
+
readonly launcherId: string;
|
|
8
|
+
readonly ammoId: string;
|
|
9
|
+
readonly muzzleLocal: Vec3Tuple;
|
|
10
|
+
readonly ejectLocal: Vec3Tuple | null;
|
|
11
|
+
readonly recoilImpulseNs: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LauncherState {
|
|
14
|
+
readonly spec: LauncherSpec;
|
|
15
|
+
ammoInMag: number;
|
|
16
|
+
cooldownSec: number;
|
|
17
|
+
reloadRemainingSec: number;
|
|
18
|
+
/** 0 = closed/resting, 1 = full rearward bolt/pump stroke */
|
|
19
|
+
cyclePhase: number;
|
|
20
|
+
totalFired: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function createLauncherState(spec: LauncherSpec): LauncherState;
|
|
23
|
+
export declare function stepLauncher(state: LauncherState, input: LauncherInput, dt: number): LaunchEvent | null;
|
|
24
|
+
export declare function attachModule(spec: LauncherSpec, attachment: AttachmentSpec): LauncherSpec;
|
|
25
|
+
export declare function detachModule(spec: LauncherSpec, rail: RailSocketName): LauncherSpec;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { validateLauncherSpec, } from "./schema.js";
|
|
2
|
+
export function createLauncherState(spec) {
|
|
3
|
+
validateLauncherSpec(spec);
|
|
4
|
+
return {
|
|
5
|
+
spec,
|
|
6
|
+
ammoInMag: spec.magazineCapacity,
|
|
7
|
+
cooldownSec: 0,
|
|
8
|
+
reloadRemainingSec: 0,
|
|
9
|
+
cyclePhase: 0,
|
|
10
|
+
totalFired: 0,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function stepLauncher(state, input, dt) {
|
|
14
|
+
const stepDt = Math.max(0, dt);
|
|
15
|
+
if (state.cooldownSec > 0)
|
|
16
|
+
state.cooldownSec = Math.max(0, state.cooldownSec - stepDt);
|
|
17
|
+
if (state.reloadRemainingSec > 0) {
|
|
18
|
+
state.reloadRemainingSec = Math.max(0, state.reloadRemainingSec - stepDt);
|
|
19
|
+
if (state.reloadRemainingSec === 0)
|
|
20
|
+
state.ammoInMag = state.spec.magazineCapacity;
|
|
21
|
+
}
|
|
22
|
+
else if (input.reload && state.ammoInMag < state.spec.magazineCapacity) {
|
|
23
|
+
state.reloadRemainingSec = state.spec.reloadSec;
|
|
24
|
+
if (state.reloadRemainingSec === 0)
|
|
25
|
+
state.ammoInMag = state.spec.magazineCapacity;
|
|
26
|
+
}
|
|
27
|
+
const cyclePeriod = 1 / state.spec.fireRateHz;
|
|
28
|
+
state.cyclePhase = state.cooldownSec > 0 ? Math.sin((state.cooldownSec / cyclePeriod) * Math.PI) : 0;
|
|
29
|
+
if (input.trigger && state.reloadRemainingSec === 0 && state.cooldownSec === 0) {
|
|
30
|
+
if (state.ammoInMag > 0) {
|
|
31
|
+
state.ammoInMag -= 1;
|
|
32
|
+
state.totalFired += 1;
|
|
33
|
+
state.cooldownSec = cyclePeriod;
|
|
34
|
+
state.cyclePhase = 1;
|
|
35
|
+
return {
|
|
36
|
+
launcherId: state.spec.id,
|
|
37
|
+
ammoId: state.spec.ammoId,
|
|
38
|
+
muzzleLocal: state.spec.sockets.muzzle,
|
|
39
|
+
ejectLocal: state.spec.sockets.eject_port ?? null,
|
|
40
|
+
recoilImpulseNs: state.spec.recoilImpulseNs,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
state.reloadRemainingSec = state.spec.reloadSec;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
export function attachModule(spec, attachment) {
|
|
48
|
+
return {
|
|
49
|
+
...spec,
|
|
50
|
+
attachments: {
|
|
51
|
+
...spec.attachments,
|
|
52
|
+
[attachment.rail]: attachment,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function detachModule(spec, rail) {
|
|
57
|
+
const next = { ...spec.attachments };
|
|
58
|
+
delete next[rail];
|
|
59
|
+
return { ...spec, attachments: next };
|
|
60
|
+
}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const LAUNCHER_PART_ROLES: readonly ["receiver", "bolt", "pump", "trigger", "magazine", "barrel", "stock", "screen_rect"];
|
|
2
|
+
export type LauncherPartRole = (typeof LAUNCHER_PART_ROLES)[number];
|
|
3
|
+
export declare const LAUNCHER_SOCKETS: readonly ["grip_primary", "grip_secondary", "rail_top", "rail_under", "muzzle", "eject_port", "sight_align"];
|
|
4
|
+
export type LauncherSocketName = (typeof LAUNCHER_SOCKETS)[number];
|
|
5
|
+
export declare const RAIL_SOCKETS: readonly ["rail_top", "rail_under", "muzzle"];
|
|
6
|
+
export type RailSocketName = (typeof RAIL_SOCKETS)[number];
|
|
7
|
+
export declare const CHARACTER_SOCKETS: readonly ["Socket_Hand_R", "Socket_Hand_L", "Socket_Head", "Socket_Back"];
|
|
8
|
+
export type CharacterSocketName = (typeof CHARACTER_SOCKETS)[number];
|
|
9
|
+
export type Vec3Tuple = readonly [number, number, number];
|
|
10
|
+
export interface AmmoSpec {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly muzzleSpeedMs: number;
|
|
13
|
+
readonly massKg: number;
|
|
14
|
+
readonly casingRadiusM: number;
|
|
15
|
+
readonly casingLengthM: number;
|
|
16
|
+
readonly tipRatio: number;
|
|
17
|
+
readonly color: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AttachmentSpec {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly rail: RailSocketName;
|
|
22
|
+
readonly massKg: number;
|
|
23
|
+
readonly glbKey?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface LauncherSpec {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly ammoId: string;
|
|
28
|
+
readonly fireRateHz: number;
|
|
29
|
+
readonly magazineCapacity: number;
|
|
30
|
+
readonly reloadSec: number;
|
|
31
|
+
readonly recoilImpulseNs: number;
|
|
32
|
+
readonly sockets: Partial<Record<LauncherSocketName, Vec3Tuple>>;
|
|
33
|
+
readonly attachments?: Partial<Record<RailSocketName, AttachmentSpec>>;
|
|
34
|
+
}
|
|
35
|
+
export declare const DEFAULT_AMMO_CATALOG: Readonly<Record<string, AmmoSpec>>;
|
|
36
|
+
export declare function validateLauncherSpec(spec: LauncherSpec): void;
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const LAUNCHER_PART_ROLES = [
|
|
2
|
+
"receiver",
|
|
3
|
+
"bolt",
|
|
4
|
+
"pump",
|
|
5
|
+
"trigger",
|
|
6
|
+
"magazine",
|
|
7
|
+
"barrel",
|
|
8
|
+
"stock",
|
|
9
|
+
"screen_rect",
|
|
10
|
+
];
|
|
11
|
+
export const LAUNCHER_SOCKETS = [
|
|
12
|
+
"grip_primary",
|
|
13
|
+
"grip_secondary",
|
|
14
|
+
"rail_top",
|
|
15
|
+
"rail_under",
|
|
16
|
+
"muzzle",
|
|
17
|
+
"eject_port",
|
|
18
|
+
"sight_align",
|
|
19
|
+
];
|
|
20
|
+
export const RAIL_SOCKETS = ["rail_top", "rail_under", "muzzle"];
|
|
21
|
+
export const CHARACTER_SOCKETS = [
|
|
22
|
+
"Socket_Hand_R",
|
|
23
|
+
"Socket_Hand_L",
|
|
24
|
+
"Socket_Head",
|
|
25
|
+
"Socket_Back",
|
|
26
|
+
];
|
|
27
|
+
export const DEFAULT_AMMO_CATALOG = {
|
|
28
|
+
pistol: { id: "pistol", muzzleSpeedMs: 360, massKg: 0.008, casingRadiusM: 0.0049, casingLengthM: 0.019, tipRatio: 0.35, color: "#E3A83B" },
|
|
29
|
+
rifle: { id: "rifle", muzzleSpeedMs: 880, massKg: 0.004, casingRadiusM: 0.0048, casingLengthM: 0.045, tipRatio: 0.45, color: "#D68A28" },
|
|
30
|
+
laser: { id: "laser", muzzleSpeedMs: 1200, massKg: 0.0001, casingRadiusM: 0, casingLengthM: 0, tipRatio: 0, color: "#26E3E8" },
|
|
31
|
+
orb: { id: "orb", muzzleSpeedMs: 42, massKg: 0.12, casingRadiusM: 0, casingLengthM: 0, tipRatio: 0, color: "#E3782A" },
|
|
32
|
+
rocket: { id: "rocket", muzzleSpeedMs: 95, massKg: 1.4, casingRadiusM: 0.035, casingLengthM: 0.32, tipRatio: 0.3, color: "#D93832" },
|
|
33
|
+
};
|
|
34
|
+
export function validateLauncherSpec(spec) {
|
|
35
|
+
if (!spec.id)
|
|
36
|
+
throw new Error("LauncherSpec: missing id");
|
|
37
|
+
if (!spec.ammoId)
|
|
38
|
+
throw new Error(`LauncherSpec(${spec.id}): missing ammoId`);
|
|
39
|
+
if (!(spec.fireRateHz > 0))
|
|
40
|
+
throw new Error(`LauncherSpec(${spec.id}): fireRateHz must be > 0`);
|
|
41
|
+
if (!(spec.magazineCapacity >= 1 && Number.isInteger(spec.magazineCapacity))) {
|
|
42
|
+
throw new Error(`LauncherSpec(${spec.id}): magazineCapacity must be a positive integer`);
|
|
43
|
+
}
|
|
44
|
+
if (!(spec.reloadSec >= 0))
|
|
45
|
+
throw new Error(`LauncherSpec(${spec.id}): reloadSec must be >= 0`);
|
|
46
|
+
if (!spec.sockets.grip_primary)
|
|
47
|
+
throw new Error(`LauncherSpec(${spec.id}): missing grip_primary socket`);
|
|
48
|
+
if (!spec.sockets.muzzle)
|
|
49
|
+
throw new Error(`LauncherSpec(${spec.id}): missing muzzle socket`);
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khr3/launchers",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Zero-dependency KHR launcher moving-part schema, rail attachment sockets, data-driven ammo catalog, and deterministic cycle state machine for khr3.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"khr3",
|
|
24
|
+
"launchers",
|
|
25
|
+
"sockets",
|
|
26
|
+
"gltf",
|
|
27
|
+
"glb",
|
|
28
|
+
"threejs",
|
|
29
|
+
"r3f",
|
|
30
|
+
"gamedev"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/pinkAphant/khr3-launchers.git"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"build": "rm -rf dist && tsc && rm -f dist/*.test.*",
|
|
42
|
+
"test": "rm -rf dist && tsc && node --test dist/launchers.test.js && rm -f dist/*.test.*",
|
|
43
|
+
"prepack": "npm run build",
|
|
44
|
+
"pack:dry": "npm pack --dry-run"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^22.0.0",
|
|
48
|
+
"typescript": "^5.8.0"
|
|
49
|
+
}
|
|
50
|
+
}
|