@adatechnology/game-weapons-three 0.24.2 → 0.24.4

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
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-eyLz_C6A.js';
2
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-eyLz_C6A.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
6
  import { LightBudget } from '@adatechnology/game-render-three';
7
7
  import '@adatechnology/game-audio';
@@ -308,19 +308,62 @@ declare const TOOL_MOTIONS: ReadonlyMap<string, ReadonlyMap<string, ToolMotion>>
308
308
  declare function sampleToolMotion(motion: ToolMotion, at: number): Omit<ToolMotionKey, 'at'>;
309
309
 
310
310
  /**
311
- * 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` a sling) for as long
312
- * as it is away, the pistol muzzle down against the hip, the long gun across the back with the muzzle over the off shoulder; drawn back in hand, it is hidden. The model is the
313
- * weapon's own (the gallery's, or the item model), at its real size; one per weapon, kept for the next time.
311
+ * 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
312
+ * 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
313
  */
315
314
 
316
315
  /**
317
316
  * 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.
317
+ * 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
318
  */
320
319
  declare const HOLSTER_PLACEMENT: Readonly<Record<string, {
321
320
  readonly muzzle: Vec3;
322
321
  readonly out: Vec3;
323
322
  }>>;
323
+ /** 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). */
324
+ declare const SLING_HANG: {
325
+ readonly pivotBehind: 0.3;
326
+ readonly frontSwivel: 0.3;
327
+ readonly shoulder: Vec3;
328
+ readonly strapRadius: 0.008;
329
+ readonly sag: 0.03;
330
+ readonly color: 4146217;
331
+ };
332
+ interface HolsterRig {
333
+ /** Rides the place of the body (world space; its parent is the scene). */
334
+ readonly holder: THREE_NS.Group;
335
+ /** Turned by the swing of a gun on its sling; the holder itself otherwise. */
336
+ readonly swing: THREE_NS.Object3D;
337
+ /** The right hand on the grip, in the holder's frame at rest. */
338
+ readonly grip: {
339
+ readonly position: THREE_NS.Vector3;
340
+ readonly quaternion: THREE_NS.Quaternion;
341
+ };
342
+ readonly strap: readonly THREE_NS.Mesh[];
343
+ }
344
+ /** 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. */
345
+ declare const buildHolsterRig: (THREE: typeof THREE_NS, weapon: string, slot: string, options?: {
346
+ readonly items?: ItemModels;
347
+ readonly strapMaterial?: THREE_NS.Material;
348
+ }) => HolsterRig | undefined;
349
+
350
+ /**
351
+ * 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,
352
+ * `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
353
+ * (`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
354
+ * 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
355
+ * for the next time.
356
+ */
357
+
358
+ /** The place a tossed weapon goes: down to the floor. */
359
+ declare const GROUND_SLOT = "ground";
360
+ /** 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. */
361
+ declare const HOLSTER_TOSS: {
362
+ readonly drop: 0.8;
363
+ readonly ahead: 0.3;
364
+ readonly turn: 1.3;
365
+ readonly release: 0.4;
366
+ };
324
367
  /** 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
368
  declare const holsteredModel: (THREE: typeof THREE_NS, weapon: string, slot: string, items?: ItemModels) => THREE_NS.Group | undefined;
326
369
  interface HolsteredWeaponsOptions {
@@ -330,19 +373,27 @@ interface HolsteredWeaponsOptions {
330
373
  readonly items?: ItemModels;
331
374
  /** The host's places of the body (`ModuleHost.bodySlot`). */
332
375
  readonly bodySlot: (slot: string) => HandPose | null;
376
+ /** 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. */
377
+ readonly holdFrame?: (() => HandPose | null) | undefined;
333
378
  }
334
379
  interface HolsteredWeapons {
335
380
  handle(event: {
336
381
  readonly weapon: string;
337
382
  readonly slot: string;
338
383
  readonly on: boolean;
384
+ readonly from?: HandPose | undefined;
385
+ readonly seconds?: number | undefined;
339
386
  }): void;
340
- /** Puts each weapon away where its place of the body is now. */
341
- update(): void;
387
+ /** The weapon now in the hands (`tool` events): it is not on the body any more. */
388
+ inHand(weapon: string): void;
389
+ /** Puts each weapon where its place of the body is now, moves the ones on their way and swings the slung ones. */
390
+ update(dt?: number): void;
391
+ /** The right hand on a weapon on its way between the hand and the body, or null with none moving. */
392
+ handTargets(): HandTargets | null;
342
393
  /** The weapons drawn on the body now. */
343
394
  readonly drawn: readonly string[];
344
395
  dispose(): void;
345
396
  }
346
397
  declare const createHolsteredWeapons: (options: HolsteredWeaponsOptions) => HolsteredWeapons;
347
398
 
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 };
399
+ 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, LaserRaycast, 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, createHolsteredWeapons, createWeaponProps, createWorldEffects, createWorldExplosiveShells, fitAttachmentModels, hasExplosiveModel, hasWeaponModel, holsteredModel, modeledPropSpec, partRegistry, projectileModel, rigStock, rigUnderbarrel, sampleToolMotion, toWorldLens, weaponProp, weaponThumbnailCredit, weaponThumbnailUrl, worldExplosiveItem, worldExplosiveShell, worldExplosiveValve };