@novely/core 0.33.2 → 0.34.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.js CHANGED
@@ -333,18 +333,31 @@ var createQueueProcessor = (queue, options) => {
333
333
  }
334
334
  keep.add(action);
335
335
  if (action === "function" || action === "custom") {
336
- if (action === "custom" && params[0].callOnlyLatest) {
337
- const notLatest = next(i).some(([, func]) => {
338
- if (!isFunction(func))
339
- return false;
340
- const c0 = func;
341
- const c1 = params[0];
342
- const isIdenticalID = Boolean(c0.id && c1.id && c0.id === c1.id);
343
- const isIdenticalByReference = c0 === c1;
344
- return isIdenticalID || isIdenticalByReference || str(c0) === str(c1);
345
- });
346
- if (notLatest)
347
- continue;
336
+ if (action === "custom") {
337
+ const fn = params[0];
338
+ if ("callOnlyLatest" in fn && fn.callOnlyLatest) {
339
+ const notLatest = next(i).some(([, func]) => {
340
+ if (!isFunction(func))
341
+ return false;
342
+ const c0 = func;
343
+ const c1 = fn;
344
+ const isIdenticalID = Boolean(c0.id && c1.id && c0.id === c1.id);
345
+ const isIdenticalByReference = c0 === c1;
346
+ return isIdenticalID || isIdenticalByReference || str(c0) === str(c1);
347
+ });
348
+ if (notLatest)
349
+ continue;
350
+ } else if ("skipOnRestore" in fn && fn.skipOnRestore) {
351
+ let getNext = () => {
352
+ const nextActions = next(i);
353
+ getNext = () => {
354
+ return nextActions;
355
+ };
356
+ return nextActions;
357
+ };
358
+ if (fn.skipOnRestore(getNext))
359
+ continue;
360
+ }
348
361
  }
349
362
  processedQueue.push(item);
350
363
  } else if (action === "showCharacter" || action === "playSound" || action === "playMusic" || action === "voice") {
@@ -1495,9 +1508,11 @@ var novely = ({
1495
1508
  });
1496
1509
  }
1497
1510
  });
1498
- if (!exitImpossible) {
1499
- render(ctx);
1511
+ if (exitImpossible) {
1512
+ ctx.clearBlockingActions(void 0);
1513
+ return;
1500
1514
  }
1515
+ render(ctx);
1501
1516
  },
1502
1517
  preload({ ctx, push }, [source]) {
1503
1518
  if (!ctx.meta.goingBack && !ctx.meta.restoring && !PRELOADED_ASSETS.has(source)) {