@adatechnology/game-weapons-three 0.24.3 → 0.25.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/README.md +7 -1
- package/dist/{chunk-UUBO6H5O.js → chunk-DCMD54HC.js} +331 -89
- package/dist/chunk-DCMD54HC.js.map +1 -0
- package/dist/index.d.ts +97 -10
- package/dist/index.global.js +461 -181
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-eyLz_C6A.d.ts → testing-C9yn3tJI.d.ts} +3 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/package.json +14 -12
- package/dist/chunk-UUBO6H5O.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { I as ItemModels, W as WeaponProps, a as WeaponItemModel, M as ModelOptions, b as WeaponModel, c as ModelKit, d as ModelParts, e as ModelFamily, A as AttachmentModelRegistry, L as LaserRaycast } from './testing-
|
|
2
|
-
export { f as AttachmentBuildContext, g as AttachmentModel, h as AttachmentModelBuilder, C as CLASS_REFERENCE_ENERGY, i as COUNTER_ITEM_ID, j as CUES_IN_SAMPLE, k as CasingSound, l as CuePlayed, D as DEFAULT_ENERGY_CURVE, m as DEFAULT_EXPLOSIVES_SCENE, n as DistanceCurve, E as EXPLOSIVES_AREA_ID, o as EXPLOSIVES_TEXT, p as EnergyCurve, q as ExplosivesRoom, r as ExplosivesScene, s as ExplosivesTestModuleOptions, t as ExplosivesText, F as FlybySound, u as FxLayers, G as GAME_DISTANCE_CURVE, v as GAME_SOUND_CLASSES, w as GUNSHOT_PROFILES, x as GUNSHOT_SAMPLE, y as GUNSHOT_SAMPLE_IDS, z as Gunshot, B as GunshotInput, H as GunshotPlayed, J as ItemModelRequest, K as LAUNCH_SAMPLE, N as LAUNCH_SOUND_IDS, O as LaunchKind, P as MECHANICAL_SOUNDS, Q as MOUNTED_M134_ITEM_ID, R as MechanicalSoundId, S as ModelMaterials, T as MountFrame, U as RELOAD_SAMPLE, V as RELOAD_SAMPLE_HITS, X as ShotExtras, Y as ShotSound, Z as ShotSoundClass, _ as ShotSoundInput, $ as ShotSoundOptions, a0 as SoundClassDef, a1 as SoundStep, a2 as WEAPON_ITEM_PREFIX, a3 as WEIGHT_INTENSITY, a4 as WeaponAudio, a5 as WeaponAudioOptions, a6 as WeaponFx, a7 as WeaponFxOptions, a8 as WeaponModelDef, a9 as WeaponSampleOptions, aa as WeaponsTestModuleOptions, ab as buildItemWeaponModel, ac as buildThrowableModel, ad as buildWeaponModel, ae as computeCasingSound, af as computeFlyby, ag as computeGunshot, ah as computeShotSound, ai as createExplosivesTestModule, aj as createWeaponAudio, ak as createWeaponFx, al as createWeaponsTestModule, am as defaultWeaponProps, an as deriveFrames, ao as explosivesTextOf, ap as hasThrowableModel, aq as itemModelOfWeapon, ar as mechanicalSoundOf, as as modelKit, at as mountFrame, au as registerWeaponItemModel, av as weaponSampleBank, aw as weaponSampleDefaults, ax as weaponsLayout } from './testing-
|
|
1
|
+
import { I as ItemModels, W as WeaponProps, a as WeaponItemModel, M as ModelOptions, b as WeaponModel, c as ModelKit, d as ModelParts, e as ModelFamily, A as AttachmentModelRegistry, L as LaserRaycast } from './testing-C9yn3tJI.js';
|
|
2
|
+
export { f as AttachmentBuildContext, g as AttachmentModel, h as AttachmentModelBuilder, C as CLASS_REFERENCE_ENERGY, i as COUNTER_ITEM_ID, j as CUES_IN_SAMPLE, k as CasingSound, l as CuePlayed, D as DEFAULT_ENERGY_CURVE, m as DEFAULT_EXPLOSIVES_SCENE, n as DistanceCurve, E as EXPLOSIVES_AREA_ID, o as EXPLOSIVES_TEXT, p as EnergyCurve, q as ExplosivesRoom, r as ExplosivesScene, s as ExplosivesTestModuleOptions, t as ExplosivesText, F as FlybySound, u as FxLayers, G as GAME_DISTANCE_CURVE, v as GAME_SOUND_CLASSES, w as GUNSHOT_PROFILES, x as GUNSHOT_SAMPLE, y as GUNSHOT_SAMPLE_IDS, z as Gunshot, B as GunshotInput, H as GunshotPlayed, J as ItemModelRequest, K as LAUNCH_SAMPLE, N as LAUNCH_SOUND_IDS, O as LaunchKind, P as MECHANICAL_SOUNDS, Q as MOUNTED_M134_ITEM_ID, R as MechanicalSoundId, S as ModelMaterials, T as MountFrame, U as RELOAD_SAMPLE, V as RELOAD_SAMPLE_HITS, X as ShotExtras, Y as ShotSound, Z as ShotSoundClass, _ as ShotSoundInput, $ as ShotSoundOptions, a0 as SoundClassDef, a1 as SoundStep, a2 as WEAPON_ITEM_PREFIX, a3 as WEIGHT_INTENSITY, a4 as WeaponAudio, a5 as WeaponAudioOptions, a6 as WeaponFx, a7 as WeaponFxOptions, a8 as WeaponModelDef, a9 as WeaponSampleOptions, aa as WeaponsTestModuleOptions, ab as buildItemWeaponModel, ac as buildThrowableModel, ad as buildWeaponModel, ae as computeCasingSound, af as computeFlyby, ag as computeGunshot, ah as computeShotSound, ai as createExplosivesTestModule, aj as createWeaponAudio, ak as createWeaponFx, al as createWeaponsTestModule, am as defaultWeaponProps, an as deriveFrames, ao as explosivesTextOf, ap as hasThrowableModel, aq as itemModelOfWeapon, ar as mechanicalSoundOf, as as modelKit, at as mountFrame, au as registerWeaponItemModel, av as weaponSampleBank, aw as weaponSampleDefaults, ax as weaponsLayout } from './testing-C9yn3tJI.js';
|
|
3
3
|
import * as THREE_NS from 'three';
|
|
4
|
-
import { TestableItem, Vec3, HostEvent, EffectSink, DestructibleSpec, DeepPartial, ToolClipSet, HandPose } from '@adatechnology/game-contracts';
|
|
4
|
+
import { TestableItem, Vec3, HostEvent, EffectSink, DestructibleSpec, DeepPartial, ToolClipSet, HandPose, HandTargets } from '@adatechnology/game-contracts';
|
|
5
5
|
import { ExplosiveDef, Arsenal, WeaponDef, CartridgeDims, CaliberDef, CaseType, ReloadFamily, FittedAttachment, AttachmentDef } from '@adatechnology/game-weapons';
|
|
6
|
+
import { BodyId, ShapeDesc, Material, Rolling, SeamWorld } from '@adatechnology/game-physics';
|
|
6
7
|
import { LightBudget } from '@adatechnology/game-render-three';
|
|
7
8
|
import '@adatechnology/game-audio';
|
|
8
9
|
|
|
@@ -78,6 +79,41 @@ interface ProjectileModel {
|
|
|
78
79
|
*/
|
|
79
80
|
declare function projectileModel(THREE: typeof THREE_NS, query: ProjectileQuery): ProjectileModel | null;
|
|
80
81
|
|
|
82
|
+
/** Rolling resistance of the kit's round loose pieces (a casing) on a hard floor: the C_rr the gate-0 B2 run settled on. */
|
|
83
|
+
declare const LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
84
|
+
/** What the engine needs to make a loose body from what the gallery drew. */
|
|
85
|
+
interface LooseCollider {
|
|
86
|
+
readonly shape: ShapeDesc;
|
|
87
|
+
readonly mass: number;
|
|
88
|
+
readonly material: Material;
|
|
89
|
+
readonly rolling: Rolling;
|
|
90
|
+
readonly user: number;
|
|
91
|
+
}
|
|
92
|
+
/** A casing lying along x as `buildCasing` draws it (the engine's cylinder stands on y, so its child is turned a quarter about z), rolling on its own radius. */
|
|
93
|
+
declare function casingCollider(radius: number, length: number): LooseCollider;
|
|
94
|
+
/** A loose body in the engine: what the costura keeps between frames. */
|
|
95
|
+
interface LooseBody {
|
|
96
|
+
readonly id: BodyId;
|
|
97
|
+
bounces: number;
|
|
98
|
+
fallSpeed: number;
|
|
99
|
+
}
|
|
100
|
+
interface LooseLaunch {
|
|
101
|
+
readonly position: THREE_NS.Vector3;
|
|
102
|
+
readonly rotation: THREE_NS.Quaternion;
|
|
103
|
+
readonly velocity: THREE_NS.Vector3;
|
|
104
|
+
readonly spin: THREE_NS.Vector3;
|
|
105
|
+
}
|
|
106
|
+
/** Puts a loose piece in the world, swept (it is small and fast) and with the rolling resistance of its collider. */
|
|
107
|
+
declare function spawnLoose(world: SeamWorld, collider: LooseCollider, launch: LooseLaunch): LooseBody;
|
|
108
|
+
/** What a frame of a loose body told: it is asleep, and the speed of a bounce it made (m/s, vertical) or undefined. */
|
|
109
|
+
interface LooseReading {
|
|
110
|
+
readonly asleep: boolean;
|
|
111
|
+
readonly bounceSpeed: number | undefined;
|
|
112
|
+
}
|
|
113
|
+
/** Copies the engine's pose of a loose body onto its object and reports whether it bounced or fell asleep. */
|
|
114
|
+
declare function syncLoose(world: SeamWorld, body: LooseBody, object: THREE_NS.Object3D): LooseReading;
|
|
115
|
+
declare function dropLoose(world: SeamWorld, body: LooseBody): void;
|
|
116
|
+
|
|
81
117
|
/** The effect ids a weapon of a case type shows when it is seen from outside: its muzzle flash and its ejected case (the host's catalogue names them). */
|
|
82
118
|
interface WorldEffectIds {
|
|
83
119
|
readonly muzzle: string;
|
|
@@ -308,19 +344,62 @@ declare const TOOL_MOTIONS: ReadonlyMap<string, ReadonlyMap<string, ToolMotion>>
|
|
|
308
344
|
declare function sampleToolMotion(motion: ToolMotion, at: number): Omit<ToolMotionKey, 'at'>;
|
|
309
345
|
|
|
310
346
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* weapon's own (the gallery's, or the item model), at its real size; one per weapon, kept for the next time.
|
|
347
|
+
* What a weapon put away on the body is made of (`createHolsteredWeapons`): the holder that rides the place of the body, the weapon's model laid in it, the point of its grip the
|
|
348
|
+
* hand holds while it moves there (the same point the weapon in the hands gives the right hand, `holdOfModel`), and for a long gun on its sling the swinging part and the strap.
|
|
314
349
|
*/
|
|
315
350
|
|
|
316
351
|
/**
|
|
317
352
|
* How a weapon lies in each place, in the frame of the body's socket (+z the body's front, -x the weapon side, y up): `muzzle` the way the barrel points, `out` the way off the body
|
|
318
|
-
* the weapon's side faces. The model's muzzle is its +x, its top +y, its side z.
|
|
353
|
+
* the weapon's side faces. The model's muzzle is its +x, its top +y, its side z. On the sling the barrel hangs down and toward the off side, its side flat on the chest.
|
|
319
354
|
*/
|
|
320
355
|
declare const HOLSTER_PLACEMENT: Readonly<Record<string, {
|
|
321
356
|
readonly muzzle: Vec3;
|
|
322
357
|
readonly out: Vec3;
|
|
323
358
|
}>>;
|
|
359
|
+
/** A long gun on its sling: its sling point this share of its length behind its middle; the front swivel this share ahead; the strap over the off shoulder (socket frame, m). */
|
|
360
|
+
declare const SLING_HANG: {
|
|
361
|
+
readonly pivotBehind: 0.3;
|
|
362
|
+
readonly frontSwivel: 0.3;
|
|
363
|
+
readonly shoulder: Vec3;
|
|
364
|
+
readonly strapRadius: 0.008;
|
|
365
|
+
readonly sag: 0.03;
|
|
366
|
+
readonly color: 4146217;
|
|
367
|
+
};
|
|
368
|
+
interface HolsterRig {
|
|
369
|
+
/** Rides the place of the body (world space; its parent is the scene). */
|
|
370
|
+
readonly holder: THREE_NS.Group;
|
|
371
|
+
/** Turned by the swing of a gun on its sling; the holder itself otherwise. */
|
|
372
|
+
readonly swing: THREE_NS.Object3D;
|
|
373
|
+
/** The right hand on the grip, in the holder's frame at rest. */
|
|
374
|
+
readonly grip: {
|
|
375
|
+
readonly position: THREE_NS.Vector3;
|
|
376
|
+
readonly quaternion: THREE_NS.Quaternion;
|
|
377
|
+
};
|
|
378
|
+
readonly strap: readonly THREE_NS.Mesh[];
|
|
379
|
+
}
|
|
380
|
+
/** A weapon's model laid in a place of the body, with the hand's grip on it. Undefined for a place this does not know or a weapon with no model. */
|
|
381
|
+
declare const buildHolsterRig: (THREE: typeof THREE_NS, weapon: string, slot: string, options?: {
|
|
382
|
+
readonly items?: ItemModels;
|
|
383
|
+
readonly strapMaterial?: THREE_NS.Material;
|
|
384
|
+
}) => HolsterRig | undefined;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* The weapons put away on the body (`HostEvent` `holster`): each is drawn at the place of the body that took it (`ModuleHost.bodySlot`: `hip` a holster, `back` across the back,
|
|
388
|
+
* `sling` hanging on its sling) for as long as it is away, and hidden once it is back in hand. With `seconds` the move is seen (owner, 2026-11-25): the weapon goes from the hand
|
|
389
|
+
* (`from`) to its place with the right hand on its grip (`handTargets`), and back the same way; `ground` tosses it, the hand letting go on the way down, for the host to drop the
|
|
390
|
+
* weapon's world item where it lands. A long gun on its sling hangs from the chest and swings with the body (`createSlingSwing` of game-weapons). One model per weapon and place, kept
|
|
391
|
+
* for the next time.
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
/** The place a tossed weapon goes: down to the floor. */
|
|
395
|
+
declare const GROUND_SLOT = "ground";
|
|
396
|
+
/** A toss: the weapon falls this far (m) and this far ahead of the hand, turning by `turn` (radians); the hand lets go at `release` of the way. */
|
|
397
|
+
declare const HOLSTER_TOSS: {
|
|
398
|
+
readonly drop: 0.8;
|
|
399
|
+
readonly ahead: 0.3;
|
|
400
|
+
readonly turn: 1.3;
|
|
401
|
+
readonly release: 0.4;
|
|
402
|
+
};
|
|
324
403
|
/** A weapon's model laid in a place of the body: its side on the socket, its middle over it. Undefined for a place this does not know or a weapon with no model. */
|
|
325
404
|
declare const holsteredModel: (THREE: typeof THREE_NS, weapon: string, slot: string, items?: ItemModels) => THREE_NS.Group | undefined;
|
|
326
405
|
interface HolsteredWeaponsOptions {
|
|
@@ -330,19 +409,27 @@ interface HolsteredWeaponsOptions {
|
|
|
330
409
|
readonly items?: ItemModels;
|
|
331
410
|
/** The host's places of the body (`ModuleHost.bodySlot`). */
|
|
332
411
|
readonly bodySlot: (slot: string) => HandPose | null;
|
|
412
|
+
/** The frame the weapon in the hands is held in (`ModuleHost.holdFrame`): a weapon drawn back goes to where it was taken from in this frame. */
|
|
413
|
+
readonly holdFrame?: (() => HandPose | null) | undefined;
|
|
333
414
|
}
|
|
334
415
|
interface HolsteredWeapons {
|
|
335
416
|
handle(event: {
|
|
336
417
|
readonly weapon: string;
|
|
337
418
|
readonly slot: string;
|
|
338
419
|
readonly on: boolean;
|
|
420
|
+
readonly from?: HandPose | undefined;
|
|
421
|
+
readonly seconds?: number | undefined;
|
|
339
422
|
}): void;
|
|
340
|
-
/**
|
|
341
|
-
|
|
423
|
+
/** The weapon now in the hands (`tool` events): it is not on the body any more. */
|
|
424
|
+
inHand(weapon: string): void;
|
|
425
|
+
/** Puts each weapon where its place of the body is now, moves the ones on their way and swings the slung ones. */
|
|
426
|
+
update(dt?: number): void;
|
|
427
|
+
/** The right hand on a weapon on its way between the hand and the body, or null with none moving. */
|
|
428
|
+
handTargets(): HandTargets | null;
|
|
342
429
|
/** The weapons drawn on the body now. */
|
|
343
430
|
readonly drawn: readonly string[];
|
|
344
431
|
dispose(): void;
|
|
345
432
|
}
|
|
346
433
|
declare const createHolsteredWeapons: (options: HolsteredWeaponsOptions) => HolsteredWeapons;
|
|
347
434
|
|
|
348
|
-
export { ARCHETYPE_MODELS, ATTACHMENT_MODELS, AttachmentModelRegistry, type AttachmentRig, BODY_ACTIONS, type CartridgeShape, type ClipContext, DEFAULT_THUMBNAIL_BASE, EXPLOSIVE_MODEL_IDS, type FitAttachmentOptions, HOLSTER_PLACEMENT, type HolsteredWeapons, type HolsteredWeaponsOptions, ItemModels, LaserRaycast, MODEL_ENTRIES, type ModelEntry, ModelFamily, ModelKit, ModelOptions, ModelParts, P13_VALVE_MESH, type ProjectileModel, type ProjectileQuery, TOOL_MOTIONS, type ToolMotion, type ToolMotionKey, VIEW_HOLD, VIEW_MOTION, type ViewHoldKind, WEAPON_THUMBNAILS, WORLD_EFFECTS, WORLD_EXPLOSIVE_IDS, WORLD_EXPLOSIVE_PREFIX, WeaponItemModel, WeaponModel, type WeaponProp, WeaponProps, type WeaponPropsOptions, type WeaponThumbnailEntry, type WorldEffectIds, type WorldEffectsOptions, type WorldExplosiveOptions, type WorldExplosiveShells, applyCondition, buildCartridge, buildCasing, buildExplosiveModel, buildModeledProp, buildProp, buildRound, buildToolClips, buildTripodMountedProp, buildWeaponModelById, cartridgeShape, createHolsteredWeapons, createWeaponProps, createWorldEffects, createWorldExplosiveShells, fitAttachmentModels, hasExplosiveModel, hasWeaponModel, holsteredModel, modeledPropSpec, partRegistry, projectileModel, rigStock, rigUnderbarrel, sampleToolMotion, toWorldLens, weaponProp, weaponThumbnailCredit, weaponThumbnailUrl, worldExplosiveItem, worldExplosiveShell, worldExplosiveValve };
|
|
435
|
+
export { ARCHETYPE_MODELS, ATTACHMENT_MODELS, AttachmentModelRegistry, type AttachmentRig, BODY_ACTIONS, type CartridgeShape, type ClipContext, DEFAULT_THUMBNAIL_BASE, EXPLOSIVE_MODEL_IDS, type FitAttachmentOptions, GROUND_SLOT, HOLSTER_PLACEMENT, HOLSTER_TOSS, type HolsterRig, type HolsteredWeapons, type HolsteredWeaponsOptions, ItemModels, LOOSE_ROLLING_RESISTANCE, LaserRaycast, type LooseBody, type LooseCollider, type LooseLaunch, type LooseReading, MODEL_ENTRIES, type ModelEntry, ModelFamily, ModelKit, ModelOptions, ModelParts, P13_VALVE_MESH, type ProjectileModel, type ProjectileQuery, SLING_HANG, TOOL_MOTIONS, type ToolMotion, type ToolMotionKey, VIEW_HOLD, VIEW_MOTION, type ViewHoldKind, WEAPON_THUMBNAILS, WORLD_EFFECTS, WORLD_EXPLOSIVE_IDS, WORLD_EXPLOSIVE_PREFIX, WeaponItemModel, WeaponModel, type WeaponProp, WeaponProps, type WeaponPropsOptions, type WeaponThumbnailEntry, type WorldEffectIds, type WorldEffectsOptions, type WorldExplosiveOptions, type WorldExplosiveShells, applyCondition, buildCartridge, buildCasing, buildExplosiveModel, buildHolsterRig, buildModeledProp, buildProp, buildRound, buildToolClips, buildTripodMountedProp, buildWeaponModelById, cartridgeShape, casingCollider, createHolsteredWeapons, createWeaponProps, createWorldEffects, createWorldExplosiveShells, dropLoose, fitAttachmentModels, hasExplosiveModel, hasWeaponModel, holsteredModel, modeledPropSpec, partRegistry, projectileModel, rigStock, rigUnderbarrel, sampleToolMotion, spawnLoose, syncLoose, toWorldLens, weaponProp, weaponThumbnailCredit, weaponThumbnailUrl, worldExplosiveItem, worldExplosiveShell, worldExplosiveValve };
|