@dice-o-rolla/dice-engine 0.3.0 → 0.3.1

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.
@@ -320,6 +320,7 @@ export class DiceEngine extends TypedEventEmitter {
320
320
  const throwGenerator = new ThrowGenerator(random, this.#throwOptions);
321
321
  const simulationId = `simulation-${this.#nextSimulationId++}`;
322
322
  this.#removeDisplayedDice();
323
+ this.#physics.clear();
323
324
  const dice = [];
324
325
  let trace;
325
326
  let failure;
@@ -504,7 +505,7 @@ export class DiceEngine extends TypedEventEmitter {
504
505
  if (abortListener !== undefined) {
505
506
  options.signal?.addEventListener('abort', abortListener, { once: true });
506
507
  }
507
- this.#replay = {
508
+ const replay = {
508
509
  trace,
509
510
  resolve,
510
511
  reject,
@@ -513,7 +514,13 @@ export class DiceEngine extends TypedEventEmitter {
513
514
  ...(options.signal === undefined ? {} : { signal: options.signal }),
514
515
  ...(abortListener === undefined ? {} : { abortListener }),
515
516
  };
516
- this.#scheduleReplayFrame();
517
+ this.#replay = replay;
518
+ try {
519
+ this.#scheduleReplayFrame();
520
+ }
521
+ catch (error) {
522
+ this.#finishReplay(replay, error);
523
+ }
517
524
  return promise;
518
525
  }
519
526
  catch (error) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Runtime package version used in portable trace provenance. */
2
- export declare const DICE_ENGINE_VERSION = "0.3.0";
2
+ export declare const DICE_ENGINE_VERSION = "0.3.1";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Runtime package version used in portable trace provenance. */
2
- export const DICE_ENGINE_VERSION = '0.3.0';
2
+ export const DICE_ENGINE_VERSION = '0.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dice-o-rolla/dice-engine",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Framework-neutral physical dice engine with Rapier and Three.js browser adapters.",
5
5
  "keywords": [
6
6
  "dice",
@@ -47,12 +47,12 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "dependencies": {
50
- "@dice-o-rolla/dice-core": "0.3.0",
51
- "@dice-o-rolla/dice-geometry": "0.3.0",
52
- "@dice-o-rolla/dice-physics": "0.3.0",
53
- "@dice-o-rolla/dice-physics-rapier": "0.3.0",
54
- "@dice-o-rolla/dice-renderer": "0.3.0",
55
- "@dice-o-rolla/dice-renderer-three": "0.3.0"
50
+ "@dice-o-rolla/dice-core": "0.3.1",
51
+ "@dice-o-rolla/dice-geometry": "0.3.1",
52
+ "@dice-o-rolla/dice-physics": "0.3.1",
53
+ "@dice-o-rolla/dice-physics-rapier": "0.3.1",
54
+ "@dice-o-rolla/dice-renderer": "0.3.1",
55
+ "@dice-o-rolla/dice-renderer-three": "0.3.1"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=20.0.0"