@adatechnology/game-test-room 0.21.0 → 0.22.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
@@ -4,9 +4,9 @@ import { AudioEngine } from '@adatechnology/game-audio';
4
4
  import { Vec3 as Vec3$1, DestructionWorld, BlastOptions, DestructibleSpec, DestructionOptions, DestructionEvent } from '@adatechnology/game-destruction';
5
5
  export { DestructionEvent, Vec3 } from '@adatechnology/game-destruction';
6
6
  import { DoorUsePhase, FurniturePushPhase, FurniturePushBlock, FurniturePushRules, DoorUseRules } from '@adatechnology/game-player';
7
- import { BusySink, ItemSeat, Vec3, HandTargets, ModuleControl, ControlValue, ModuleLayer, EnvironmentBus, BusyTask, BusyOptions, TestableModule, ModuleItemSeal, DestructibleImpl, AnimationClipSpec, GroundLayout, BlastShoveOptions } from '@adatechnology/game-contracts';
7
+ import { BusySink, ItemSeat, Vec3, HandTargets, ModuleControl, ControlValue, ModuleLayer, EnvironmentBus, Knock, BusyTask, BusyOptions, TestableModule, ModuleItemSeal, DestructibleImpl, AnimationClipSpec, ItemSounds, GroundLayout, BlastShoveOptions } from '@adatechnology/game-contracts';
8
8
  export { AnimationClipSpec, DestructibleImpl, ItemAnimationContract, ModuleScenario, TestableItem, TestableModule } from '@adatechnology/game-contracts';
9
- import { DestructionRenderer, SpecFromObjectOptions, Quality, FragmentLifeRule } from '@adatechnology/game-destruction-three';
9
+ import { DestructionRenderer, SpecFromObjectOptions, Quality, SoundDetail, FragmentLifeRule } from '@adatechnology/game-destruction-three';
10
10
  import { StorageLike, GraphicsController } from '@adatechnology/game-graphics';
11
11
  import { GraphicsScreen } from '@adatechnology/game-graphics/screen';
12
12
  import { Arsenal, WeaponState, TriggerResult, WeaponDef } from '@adatechnology/game-weapons';
@@ -596,6 +596,8 @@ interface TestRoomItem {
596
596
  animations?: AnimationClipSpec[];
597
597
  /** Where the player can sit or lie on it (see `TestRoom.sit`). */
598
598
  seats?: readonly ItemSeat[];
599
+ /** What it sounds like in the hand and the sound set of its doors and lids (`TestableItem.sounds`). */
600
+ sounds?: ItemSounds;
599
601
  /** Picture for the catalogue, the search results and the aimed-item label: an image URL or inline `<svg…>` markup (see `TestableItem.thumbnail`). */
600
602
  thumbnail?: string;
601
603
  /** Author and licence of the thumbnail, shown as the tooltip of the picture in the inspector. */
@@ -738,12 +740,15 @@ interface TestRoomOptions {
738
740
  area?: string;
739
741
  /** Called for every destruction event (to log, play sounds, sync over LAN). Fluid events reach the log too. */
740
742
  onEvent?: (event: DestructionEvent) => void;
741
- onSound?: (key: string, point: Vec3$1, volume: number) => void;
743
+ /** Every sound key the room plays, with its detail: the more specific keys of an impact, the named explosion, a leak's seconds (`SoundDetail` of game-destruction-three). */
744
+ onSound?: (key: string, point: Vec3$1, volume: number, detail?: SoundDetail) => void;
742
745
  /**
743
746
  * The sound engine of the room (@adatechnology/game-audio): the destruction renderer's sound keys play on it, and modules get it as `host.audio`.
744
747
  * Default: a new engine of the room's own (it makes no AudioContext until the first sound); `false` for a silent room.
745
748
  */
746
749
  audio?: AudioEngine | false;
750
+ /** Where the kit's recorded sound files (game-audio `assets/sfx/`) are served, for the room's engine (default `./sfx/`); `null` plays the recipes only. */
751
+ samplesBaseUrl?: string | null;
747
752
  /** The environment store modules get as `host.environment` (the weather module writes it, the others read it). Default: a new one with a calm dry day. */
748
753
  environment?: EnvironmentBus;
749
754
  /** Show the built-in HUD and panels (default true). */
@@ -820,6 +825,8 @@ interface TestRoomOptions {
820
825
  * Default: the SDK's (`DEFAULT_BLAST_SHOVE` of game-contracts: 2 % of the energy becomes speed, 20 m/s at most, falloff `(1 - d / r)^2`).
821
826
  */
822
827
  blastShove?: BlastShoveOptions;
828
+ /** Mass of the player's body in kg: how far a blast throws it and whether it knocks it down (default 70, the `bodyMass` of 1.75 m). */
829
+ playerMass?: number;
823
830
  /**
824
831
  * Module bench state. `state` maps a module id to its encoded state, restored when that module is first loaded (a module reloaded
825
832
  * keeps its live state instead) before its first changes are sent; ids are per module, so two modules may share a control id.
@@ -908,6 +915,8 @@ interface TestRoom {
908
915
  use(hold?: number): UseStatus;
909
916
  /** Where the player's feet are. */
910
917
  readonly playerPosition: Vec3$1;
918
+ /** The knock of a blast on the player while it lasts (thrown, down, getting up), or null on its feet. */
919
+ readonly playerKnock: Readonly<Knock> | null;
911
920
  /** Grab what the camera looks at (or drop what is held). */
912
921
  grab(): boolean;
913
922
  /**
@@ -1205,10 +1214,6 @@ interface ScenarioReport {
1205
1214
  /** What the trigger answered to `TestRoom.use`: the status of the weapons package's trigger. */
1206
1215
  type UseStatus = TriggerResult['status'];
1207
1216
 
1208
- /**
1209
- * Create the test room. See `TestRoomOptions`. The room owns a renderer, scene and camera unless you pass them; with your own renderer you call
1210
- * `room.update(dt)` every frame and render yourself.
1211
- */
1212
1217
  declare function createTestRoom(options: TestRoomOptions): TestRoom;
1213
1218
 
1214
1219
  /** Spec of the brick target wall: `cols` x `rows` brick panels, the bottom row anchored, mortar joints between neighbours. */