@adatechnology/game-contracts 0.27.0 → 0.28.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/index.d.ts CHANGED
@@ -1559,6 +1559,10 @@ interface HandTargets {
1559
1559
  fingers?: {
1560
1560
  index?: number;
1561
1561
  };
1562
+ /** The same for the left hand (its index on the trigger of a tool of its own, with a tool in each hand); absent, the left hand's fingers all follow `gripL`. */
1563
+ fingersL?: {
1564
+ index?: number;
1565
+ };
1562
1566
  /**
1563
1567
  * Where the elbows go: `view` puts them on screen beside the hand, out to the side, as a tool held out in front (default); `body` lets them hang down and back by the body, as an item
1564
1568
  * carried close (a can, a bottle), where an elbow out to the side would lift it above the shoulder.
@@ -1575,8 +1579,13 @@ interface MuzzlePose {
1575
1579
  /** The module draws the muzzle flash itself: the host draws none of its own. */
1576
1580
  readonly drawsFlash: boolean;
1577
1581
  }
1578
- /** Read by the host at each shot; null while the tool in the hands has no muzzle (a knife, a bare hand). */
1579
- type MuzzleSource = () => MuzzlePose | null;
1582
+ /** A hand of the body: `R` the right, `L` the left. A tool in one hand alone is in the right; the left holds one of its own only with a tool in each hand (`HostTool.offHand`). */
1583
+ type ToolHand = 'R' | 'L';
1584
+ /**
1585
+ * Read by the host at each shot; null while the tool in the hands has no muzzle (a knife, a bare hand). `hand` is the hand that fired (absent: the right one); a source that draws
1586
+ * one tool only answers the same for both.
1587
+ */
1588
+ type MuzzleSource = (hand?: ToolHand) => MuzzlePose | null;
1580
1589
  /**
1581
1590
  * The layer of what the first-person view draws over the world (three.js `Object3D.layers`): the tool in the hands and the arms that hold it. A host with a first-person view draws
1582
1591
  * the world without this layer, then this layer alone over it with the depth cleared and its own field of view (`ModuleHost.setViewmodelFov`), as shooters draw the weapon in the hands:
@@ -1724,6 +1733,13 @@ interface BenchSheet {
1724
1733
  readonly name: string;
1725
1734
  }[];
1726
1735
  readonly note?: string;
1736
+ /** A picture of the real thing the card is about, with its author and licence: the host shows it on the card, linked to `page`. */
1737
+ readonly image?: {
1738
+ readonly url: string;
1739
+ readonly alt: string;
1740
+ readonly credit?: string;
1741
+ readonly page?: string;
1742
+ };
1727
1743
  /** A strip of named segments (seconds), with tick marks and a playhead that follows the module metric `metric`. */
1728
1744
  readonly timeline?: {
1729
1745
  readonly segments: readonly {
@@ -2253,7 +2269,8 @@ interface ModuleArea {
2253
2269
  };
2254
2270
  }
2255
2271
  /**
2256
- * What the player did with the tool in hand, as the host reports it. Hosts emit what they support; modules ignore what they do not need. The
2272
+ * What the player did with the tool in hand, as the host reports it. A tool event names the `hand` whose tool it is when the player holds one in each (`HostTool.offHand`): `L` for the
2273
+ * left; absent is the right, the hand of a tool held alone. A `tool` event with `hand: 'L'` puts the left hand's tool in it, and one with an empty `weapon` lets the left hand go. Hosts emit what they support; modules ignore what they do not need. The
2257
2274
  * names are of a tool's cycle, not of a firearm: a nail gun, a chainsaw or a hose has modes, faults and a safety too.
2258
2275
  */
2259
2276
  type HostEvent =
@@ -2262,6 +2279,7 @@ type HostEvent =
2262
2279
  type: 'tool';
2263
2280
  weapon: string;
2264
2281
  duration?: number;
2282
+ hand?: ToolHand;
2265
2283
  }
2266
2284
  /** `shots` are projectiles (a shotgun shell is many), `rounds` the cartridges spent (a burst is several). */
2267
2285
  | {
@@ -2278,11 +2296,13 @@ type HostEvent =
2278
2296
  */
2279
2297
  origin?: Vec3;
2280
2298
  direction?: Vec3;
2299
+ hand?: ToolHand;
2281
2300
  }
2282
2301
  /** The trigger was pulled, the round was spent and nothing left the tool (a dud cartridge): no projectile, no recoil. */
2283
2302
  | {
2284
2303
  type: 'misfire';
2285
2304
  weapon: string;
2305
+ hand?: ToolHand;
2286
2306
  }
2287
2307
  /** `kind` is how the rule reloads (`tactical`, `empty`, `one_by_one`); `duration` the seconds of the whole reload, on `start`. */
2288
2308
  | {
@@ -2291,27 +2311,33 @@ type HostEvent =
2291
2311
  phase: 'start' | 'end';
2292
2312
  kind?: string;
2293
2313
  duration?: number;
2314
+ hand?: ToolHand;
2294
2315
  } | {
2295
2316
  type: 'empty';
2296
2317
  weapon: string;
2318
+ hand?: ToolHand;
2297
2319
  } | {
2298
2320
  type: 'mode';
2299
2321
  weapon: string;
2300
2322
  mode: string;
2323
+ hand?: ToolHand;
2301
2324
  } | {
2302
2325
  type: 'fault';
2303
2326
  weapon: string;
2304
2327
  fault: string;
2328
+ hand?: ToolHand;
2305
2329
  } | {
2306
2330
  type: 'clear';
2307
2331
  weapon: string;
2308
2332
  fault: string;
2309
2333
  phase: 'start' | 'end';
2310
2334
  duration?: number;
2335
+ hand?: ToolHand;
2311
2336
  } | {
2312
2337
  type: 'safety';
2313
2338
  weapon: string;
2314
2339
  on: boolean;
2340
+ hand?: ToolHand;
2315
2341
  }
2316
2342
  /** The action works between shots (a pump, a bolt); `duration` is the seconds of the cycle, on `start`. */
2317
2343
  | {
@@ -2319,17 +2345,20 @@ type HostEvent =
2319
2345
  weapon: string;
2320
2346
  phase: 'start' | 'end';
2321
2347
  duration?: number;
2348
+ hand?: ToolHand;
2322
2349
  }
2323
2350
  /** A step of a longer phase (a reload's magazine out, magazine in, charge), at the moment the rule reaches it. */
2324
2351
  | {
2325
2352
  type: 'stage';
2326
2353
  weapon: string;
2327
2354
  stage: string;
2355
+ hand?: ToolHand;
2328
2356
  }
2329
2357
  /** One more round went into the tool while it loads round by round. */
2330
2358
  | {
2331
2359
  type: 'feed';
2332
2360
  weapon: string;
2361
+ hand?: ToolHand;
2333
2362
  }
2334
2363
  /**
2335
2364
  * A throwable with a timer fuse is cooked: the trigger pulls the pin (`start`, `fuse` is the whole fuse), releasing throws it with what is left of
@@ -2340,6 +2369,7 @@ type HostEvent =
2340
2369
  weapon: string;
2341
2370
  phase: 'start' | 'throw' | 'burst';
2342
2371
  fuse: number;
2372
+ hand?: ToolHand;
2343
2373
  }
2344
2374
  /** An accessory went on (`fit`), came off (`remove`) or broke (`break`) at `mount`; `duration` is the seconds the work takes, on `fit` and `remove`. */
2345
2375
  | {
@@ -2349,6 +2379,7 @@ type HostEvent =
2349
2379
  attachment: string;
2350
2380
  mount: string;
2351
2381
  duration?: number;
2382
+ hand?: ToolHand;
2352
2383
  }
2353
2384
  /** A light or a laser was turned on or off. */
2354
2385
  | {
@@ -2356,6 +2387,7 @@ type HostEvent =
2356
2387
  weapon: string;
2357
2388
  attachment: string;
2358
2389
  on: boolean;
2390
+ hand?: ToolHand;
2359
2391
  }
2360
2392
  /** The stock was folded or slid in (`collapsed`) or opened (`extended`); `kind` is how it moves (`fold`, `retract`), `duration` the seconds it takes. */
2361
2393
  | {
@@ -2364,6 +2396,7 @@ type HostEvent =
2364
2396
  state: 'collapsed' | 'extended';
2365
2397
  kind?: string;
2366
2398
  duration?: number;
2399
+ hand?: ToolHand;
2367
2400
  }
2368
2401
  /** The weapon in hand changed between the main weapon and the one under its barrel (`on`: the under-barrel one is in use); `duration` is the seconds of the switch. */
2369
2402
  | {
@@ -2371,6 +2404,7 @@ type HostEvent =
2371
2404
  weapon: string;
2372
2405
  on: boolean;
2373
2406
  duration?: number;
2407
+ hand?: ToolHand;
2374
2408
  }
2375
2409
  /**
2376
2410
  * Something blew up: a thrown or launched explosive, a charge, or a part of the world (a fuel barrel); `source` is the weapon or the object, `cause` what set it off.
@@ -2389,6 +2423,16 @@ type HostEvent =
2389
2423
  /** Inside this radius (metres) the blast is lethal to a body it reaches. */
2390
2424
  lethalRadius?: number;
2391
2425
  }
2426
+ /**
2427
+ * With a tool in each hand, the tool of `hand` is put away against the body (`on`) to free that hand for the other tool, or taken back in hand; `duration` is the seconds the move takes.
2428
+ */
2429
+ | {
2430
+ type: 'stow';
2431
+ weapon: string;
2432
+ on: boolean;
2433
+ duration?: number;
2434
+ hand?: ToolHand;
2435
+ }
2392
2436
  /** The player crouched or stood up, or the camera mode changed; read the new state with `host.player()`. */
2393
2437
  | {
2394
2438
  type: 'player';
@@ -2426,10 +2470,20 @@ interface HostTool {
2426
2470
  suppressed?: boolean;
2427
2471
  /** True while the trigger and the reload go to the launcher under the barrel. */
2428
2472
  underbarrelActive?: boolean;
2473
+ /**
2474
+ * True while the tool is put away against the body (tucked in the belt, under the arm) to free its hand for the tool in the other hand: a magazine changed with the free hand, with a
2475
+ * tool in each hand. It does not fire then; the host says when it goes and comes back with a `stow` event.
2476
+ */
2477
+ stowed?: boolean;
2429
2478
  /** Kg: the tool with what is on it. */
2430
2479
  mass?: number;
2431
2480
  /** Seconds to bring the tool to the sights, with what is on it. */
2432
2481
  aimSeconds?: number;
2482
+ /**
2483
+ * The tool in the left hand when the player holds one in each (a pistol in each hand): its own rounds, reload and state. Absent with one tool, which is in the right hand. A tool
2484
+ * in each hand is held out, never brought to the eye: the second button pulls the left one's trigger instead.
2485
+ */
2486
+ offHand?: HostTool;
2433
2487
  }
2434
2488
  interface HostToolAttachment {
2435
2489
  readonly id: string;
@@ -2610,9 +2664,9 @@ interface ModuleHost {
2610
2664
  /**
2611
2665
  * Where the player's body holds a tool now (world space), in every view (the weapon is the body's own): `position` is the pocket of the right shoulder a stock rests on, `quaternion` turns
2612
2666
  * to the aim (-z the aim, x right, y up, as a camera). A module draws the tool there at its real size. Null for a host with no body (the module puts the same pocket under the camera's eye);
2613
- * a host without a body leaves it out.
2667
+ * a host without a body leaves it out. With `hand: 'L'` it is the pocket of the left shoulder (the same frame mirrored), where a tool in the left hand is held.
2614
2668
  */
2615
- holdFrame?(): HandPose | null;
2669
+ holdFrame?(hand?: ToolHand): HandPose | null;
2616
2670
  /**
2617
2671
  * Puts the player's hand on a leaf the module moves itself (a door of a house): the host plays the reach to `handle()`, calls `onGrip` when the hand is on it (the module then turns
2618
2672
  * the handle and swings the leaf), keeps the hand on `handle()` for `seconds` as it moves, and takes it back; the body pulls or pushes (`pull`) or shakes a locked one (`locked`).
@@ -2922,4 +2976,4 @@ declare function footprintBlocker(object: FootprintObject | (() => FootprintObje
2922
2976
  /** @deprecated Import it from `@adatechnology/game-contracts/testing`. */
2923
2977
  declare const resetWarnOnce: () => void;
2924
2978
 
2925
- export { type ActionControl, type AnimationClipSpec, type AnimationEventSpec, type AnimationKey, type AnimationPose, type AreaPlacement, type AudioListener, type AudioSink, BLOW_IDS, BODY_FOLEY_IDS, BODY_SOUND_IDS, type BallisticExtras, type BenchChange, type BenchDeclaration, type BenchReport, type BenchSheet, type BlastImpulseOptions, type BlastOptions, type BlastReport, type BlastShove, type BlastShoveOptions, type BlastSource, type BlowId, type BlowTarget, type BodyFoleyId, type BodyRegion, type BodySlot, type BodySoundId, type BooleanControl, type BusyOptions, type BusySink, type BusyTask, type CategorizedOptions, type CategorizedReport, type CategoryDef, type CategoryOptions, type CategoryRegistry, type ChainDelay, type CheckOptions, type CheckSpecOptions, type ChoiceControl, type ChoiceOption, type ConfinementOptions, type ContainerSpec, type ContractChecker, type ContractContext, type ControlPatch, type ControlValue, type CostOptions, type Crack, DEFAULT_BLAST_IMPULSE, DEFAULT_BLAST_SHOVE, DEFAULT_ENVIRONMENT, DEFAULT_IGNITION_RULES, DEFAULT_SURFACE, DEFERRED_PRIORITY, DEFERRED_QUEUE_ID, type DamageStage, type DamageType, type DebrisKind, type DeepPartial, type DeferredQueue, type DeferredQueueOptions, type DeferredQueueReport, type Dent, type DestructibleImpl, type DestructibleSpec, type DestructionEvent, type DestructionEventType, type EffectHandle, type EffectRequest, type EffectSink, type Enclosure, type EnclosureBox, type EnvironmentBus, type EnvironmentKey, type EnvironmentState, type ExplosionChain, FIRST_PERSON_LAYER, FOOTSTEP_SOUND_IDS, FRAGMENT_COVER, FRAME_PHASES, type FluidKind, type Footprint, type FootprintObject, type FootstepSoundId, type FractureStyle, type Fragment, type FragmentHitOptions, type FragmentMark, type FrameOptions, type FramePhase, GAIT_IDS, type GaitId, type GroundLayout, type GroundZone, HEAVY_LANDING_SPEED, type HandPose, type HandTargetSource, type HandTargets, type Hit, type HitIgnition, type HitResult, type Hole, type HostEvent, type HostGraphics, type HostReach, type HostTool, type HostToolAttachment, IMPACT_CONTRACT, type IgnitionRules, type ImpactContract, type ItemAnimationContract, type ItemSeat, type ItemSounds, type ItemUseDef, type JointKind, type JointSpec, type JointState, KIT_ORIGIN_KEY, KNOCKED_DOWN_ANGLE, KNOCK_CHEST, KNOCK_DOWN_SPEED, type KitOrigin, type Knock, LANDING_IDS, LAND_SOUND_IDS, type LandSoundId, type LandingId, type LiquidId, type LoopHandle, MATERIAL_SURFACES, MISSING_BITS, type MaterialId, type ModuleArea, type ModuleBench, type ModuleControl, type ModuleHost, type ModuleItemFluid, type ModuleItemSeal, type ModuleLayer, type ModuleMetric, type ModuleScenario, type ModuleView, type MuzzlePose, type MuzzleSource, type NumberControl, type ObjectState, type PartBreach, type PartShape, type PartSpec, type PartState, type PartStatus, type PartUnits, type PileSpec, type PlayerState, type Quat, type RayHit, type Reinforcement, STAGE_EVENT, SURFACE_IDS, SWING_LEAD_SECONDS, type SealBlock, type SealSpec, type SealState, type SegmentKind, type ShelterOptions, type Shot, type SoilLayer, type SoilProfile, type SoilState, type SoundHandle, type SoundRequest, type SpecReport, type StructureRole, type SurfaceId, type SurfaceLayer, type SurfaceRay, type SurfaceRayHit, TOOL_CLIP, TWIST_LIFT, type TensionRebar, type TestableItem, type TestableModule, type Thumbnail, type ToolAnimationStep, type ToolAnimator, type ToolClipId, type ToolClipPlayer, type ToolClipPlayerOptions, type ToolClipSet, type ToolCommand, type ToolCommandResult, type ToolKind, type ToolRig, type TunedMassDamper, type TwistOptions, type TwistStroke, type UnmarkedDrawing, type Use, type Vec3, type WarmUpProbes, type WindExposure, type WindState, applyPatches, blastBodySpeed, blastShove, bodyImpulse, bodyMass, checkAnimation, checkBench, checkCategorized, checkDeferredQueue, checkDestructible, checkHit, checkSpec, checkToolClips, createEnvironmentBus, createToolClipPlayer, deepMerge, defineCategories, fillFactor, footprintBlocker, footstepSoundId, hitSoundId, ignitionChance, isSurfaceId, kitOriginOf, knockOf, landSoundId, launchBody, leadClipEvents, markKitOrigin, mergeById, removeIds, resetWarnOnce, resolveEntry, resolveIgnitionRules, sampleClip, scaleClip, sealBlock, sealOpener, shotExtras, shotToHit, sideOnImpulse, sparkTargetFactor, stepKnock, surfaceOfMaterial, swingSoundId, takeLaunch, toolAnimationStep, twistStroke, unmarkedDrawings, useToHit };
2979
+ export { type ActionControl, type AnimationClipSpec, type AnimationEventSpec, type AnimationKey, type AnimationPose, type AreaPlacement, type AudioListener, type AudioSink, BLOW_IDS, BODY_FOLEY_IDS, BODY_SOUND_IDS, type BallisticExtras, type BenchChange, type BenchDeclaration, type BenchReport, type BenchSheet, type BlastImpulseOptions, type BlastOptions, type BlastReport, type BlastShove, type BlastShoveOptions, type BlastSource, type BlowId, type BlowTarget, type BodyFoleyId, type BodyRegion, type BodySlot, type BodySoundId, type BooleanControl, type BusyOptions, type BusySink, type BusyTask, type CategorizedOptions, type CategorizedReport, type CategoryDef, type CategoryOptions, type CategoryRegistry, type ChainDelay, type CheckOptions, type CheckSpecOptions, type ChoiceControl, type ChoiceOption, type ConfinementOptions, type ContainerSpec, type ContractChecker, type ContractContext, type ControlPatch, type ControlValue, type CostOptions, type Crack, DEFAULT_BLAST_IMPULSE, DEFAULT_BLAST_SHOVE, DEFAULT_ENVIRONMENT, DEFAULT_IGNITION_RULES, DEFAULT_SURFACE, DEFERRED_PRIORITY, DEFERRED_QUEUE_ID, type DamageStage, type DamageType, type DebrisKind, type DeepPartial, type DeferredQueue, type DeferredQueueOptions, type DeferredQueueReport, type Dent, type DestructibleImpl, type DestructibleSpec, type DestructionEvent, type DestructionEventType, type EffectHandle, type EffectRequest, type EffectSink, type Enclosure, type EnclosureBox, type EnvironmentBus, type EnvironmentKey, type EnvironmentState, type ExplosionChain, FIRST_PERSON_LAYER, FOOTSTEP_SOUND_IDS, FRAGMENT_COVER, FRAME_PHASES, type FluidKind, type Footprint, type FootprintObject, type FootstepSoundId, type FractureStyle, type Fragment, type FragmentHitOptions, type FragmentMark, type FrameOptions, type FramePhase, GAIT_IDS, type GaitId, type GroundLayout, type GroundZone, HEAVY_LANDING_SPEED, type HandPose, type HandTargetSource, type HandTargets, type Hit, type HitIgnition, type HitResult, type Hole, type HostEvent, type HostGraphics, type HostReach, type HostTool, type HostToolAttachment, IMPACT_CONTRACT, type IgnitionRules, type ImpactContract, type ItemAnimationContract, type ItemSeat, type ItemSounds, type ItemUseDef, type JointKind, type JointSpec, type JointState, KIT_ORIGIN_KEY, KNOCKED_DOWN_ANGLE, KNOCK_CHEST, KNOCK_DOWN_SPEED, type KitOrigin, type Knock, LANDING_IDS, LAND_SOUND_IDS, type LandSoundId, type LandingId, type LiquidId, type LoopHandle, MATERIAL_SURFACES, MISSING_BITS, type MaterialId, type ModuleArea, type ModuleBench, type ModuleControl, type ModuleHost, type ModuleItemFluid, type ModuleItemSeal, type ModuleLayer, type ModuleMetric, type ModuleScenario, type ModuleView, type MuzzlePose, type MuzzleSource, type NumberControl, type ObjectState, type PartBreach, type PartShape, type PartSpec, type PartState, type PartStatus, type PartUnits, type PileSpec, type PlayerState, type Quat, type RayHit, type Reinforcement, STAGE_EVENT, SURFACE_IDS, SWING_LEAD_SECONDS, type SealBlock, type SealSpec, type SealState, type SegmentKind, type ShelterOptions, type Shot, type SoilLayer, type SoilProfile, type SoilState, type SoundHandle, type SoundRequest, type SpecReport, type StructureRole, type SurfaceId, type SurfaceLayer, type SurfaceRay, type SurfaceRayHit, TOOL_CLIP, TWIST_LIFT, type TensionRebar, type TestableItem, type TestableModule, type Thumbnail, type ToolAnimationStep, type ToolAnimator, type ToolClipId, type ToolClipPlayer, type ToolClipPlayerOptions, type ToolClipSet, type ToolCommand, type ToolCommandResult, type ToolHand, type ToolKind, type ToolRig, type TunedMassDamper, type TwistOptions, type TwistStroke, type UnmarkedDrawing, type Use, type Vec3, type WarmUpProbes, type WindExposure, type WindState, applyPatches, blastBodySpeed, blastShove, bodyImpulse, bodyMass, checkAnimation, checkBench, checkCategorized, checkDeferredQueue, checkDestructible, checkHit, checkSpec, checkToolClips, createEnvironmentBus, createToolClipPlayer, deepMerge, defineCategories, fillFactor, footprintBlocker, footstepSoundId, hitSoundId, ignitionChance, isSurfaceId, kitOriginOf, knockOf, landSoundId, launchBody, leadClipEvents, markKitOrigin, mergeById, removeIds, resetWarnOnce, resolveEntry, resolveIgnitionRules, sampleClip, scaleClip, sealBlock, sealOpener, shotExtras, shotToHit, sideOnImpulse, sparkTargetFactor, stepKnock, surfaceOfMaterial, swingSoundId, takeLaunch, toolAnimationStep, twistStroke, unmarkedDrawings, useToHit };