@adatechnology/game-test-room 0.8.0 → 0.10.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 CHANGED
@@ -91,6 +91,8 @@ room.bench()?.set('size', 2) // clamped and snapped; false for an unknown id, a
91
91
  room.metrics() // { room: { fps, draw_calls, ... }, module: { particles: 120 } }
92
92
  ```
93
93
 
94
+ The room's explosions take the blast options of `game-destruction` (`createTestRoom({ blast: { shelter: true } })`, `room.blast()`, `room.setBlast({ fragmentHits: true })`); three HUD toggles (Shelter, Fragments, Confinement; Abrigo, Estilhaços, Confinamento) flip them, and the numbers of the last blast show as the room metrics `blast_shelter` (% that reached the most sheltered target), `blast_confinement` and `blast_fragments`, and as a `blast_report` line in the log.
95
+
94
96
  A module can put a **sheet** on the panel (`host.bench.sheet(sheet)`, `BenchSheet` of the contracts): a card with a kicker, a title, a text, facts, steps, colour swatches and a timeline of named segments whose playhead follows one of the module's numeric metrics.
95
97
  The room also runs the film of the liquids that have one (`createFilmManager` of `game-fluids-three`): a leak of fuel, oil or blood drips into grids on the floor near the camera.
96
98
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as THREE_NS from 'three';
2
2
  import { AudioEngine } from '@adatechnology/game-audio';
3
- import { DestructibleSpec, Vec3, DestructionWorld, DestructionOptions, DestructionEvent, MaterialDef } from '@adatechnology/game-destruction';
3
+ import { DestructibleSpec, Vec3, DestructionWorld, BlastOptions, DestructionOptions, DestructionEvent, MaterialDef } from '@adatechnology/game-destruction';
4
4
  export { DestructionEvent, Vec3 } from '@adatechnology/game-destruction';
5
5
  import { SpecFromObjectOptions, DestructionRenderer, Quality } from '@adatechnology/game-destruction-three';
6
6
  import { Arsenal, WeaponState, WeaponDef } from '@adatechnology/game-weapons';
@@ -98,6 +98,12 @@ interface HudState {
98
98
  timeScale: number;
99
99
  fast: boolean;
100
100
  tap: boolean;
101
+ /** The room's blast options that are on. */
102
+ blast: {
103
+ shelter: boolean;
104
+ fragmentHits: boolean;
105
+ confinement: boolean;
106
+ };
101
107
  quality: string;
102
108
  objects: number;
103
109
  }
@@ -206,6 +212,8 @@ interface TestRoomOptions {
206
212
  ui?: boolean;
207
213
  /** Room counters the bench panel shows and `TestRoom.metrics()` returns (default all); `false` for none. */
208
214
  metrics?: readonly RoomMetricId[] | false;
215
+ /** Blast options every explosion of the room starts with (`shelter`, `fragmentHits`, `confinement`; default all off). The HUD toggles them and `TestRoom.setBlast` changes them. */
216
+ blast?: BlastOptions;
209
217
  /**
210
218
  * Module bench state. `state` maps a module id to its encoded state, restored when that module is first loaded (a module reloaded
211
219
  * keeps its live state instead) before its first changes are sent; ids are per module, so two modules may share a control id.
@@ -217,7 +225,9 @@ interface TestRoomOptions {
217
225
  };
218
226
  }
219
227
  /** Counters the room measures itself. `fps` and `frame_ms` use the real frame time, so slow motion does not change them. */
220
- type RoomMetricId = 'fps' | 'frame_ms' | 'draw_calls' | 'triangles' | 'objects' | 'fragments' | 'particles' | 'decals';
228
+ type RoomMetricId = 'fps' | 'frame_ms' | 'draw_calls' | 'triangles' | 'objects' | 'fragments' | 'particles' | 'decals'
229
+ /** Of the last blast, once the room's blast options are on: the share that reached the most sheltered target (%), the pressure multiplier, the fragment hits. */
230
+ | 'blast_shelter' | 'blast_confinement' | 'blast_fragments';
221
231
  /** A module control as the room holds it: the declaration with the module's patches applied, and its value (none for an action). */
222
232
  type BenchControl = ModuleControl & {
223
233
  readonly disabled: boolean;
@@ -293,6 +303,9 @@ interface TestRoom {
293
303
  tilt(rad: number): void;
294
304
  /** Open or close the tap over the table (default: toggle). Returns whether it is open. */
295
305
  toggleTap(on?: boolean): boolean;
306
+ /** The blast options the room's explosions use now, and a way to change them (each key replaces the old one; `undefined` clears it). */
307
+ blast(): BlastOptions;
308
+ setBlast(options: BlastOptions): void;
296
309
  /** Stop the simulation (time, physics, animations, tools, walks): the UI, the camera and the log stay live. `step` and `update` do nothing until `resume`. Scenarios run unpaused. */
297
310
  pause(): void;
298
311
  resume(): void;