MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / willProceed

Function willProceed

src/engine/lifecycle.ts:612–657  ·  view source on GitHub ↗
(engine: VisualNovelEngine)

Source from the content-addressed store, hash-verified

610}
611
612export function willProceed (engine: VisualNovelEngine): Promise<unknown[]> {
613 engine.debug.groupCollapsed ('Can proceed check passed, game will proceed.');
614
615 const actions = engine.actions ();
616 const components = engine.components ();
617
618 const promises = [];
619
620 try {
621 // Check action by action if they will allow the game to proceed
622 for (const action of actions) {
623 promises.push (action.willProceed ().then (() => {
624 engine.debug.debug (`OK ${action.id}`);
625 }).catch ((e) => {
626 engine.debug.debug (`FAIL ${action.id}\nReason: ${e}`);
627 return Promise.reject (e);
628 }));
629 }
630
631 // Check component by component if they will allow the game to proceed
632 for (const component of components) {
633 promises.push (component.willProceed ().then (() => {
634 engine.debug.debug (`OK ${component.tag}`);
635 }).catch ((e) => {
636 engine.debug.debug (`FAIL ${component.tag}\nReason: ${e}`);
637 return Promise.reject (e);
638 }));
639 }
640 } catch (e) {
641 console.error (e);
642
643 const errorMessage = e instanceof Error ? e.message : String(e);
644
645 FancyError.show ('engine:lifecycle:will_proceed_error', {
646 errorMessage: errorMessage
647 });
648 }
649
650 return Promise.all (promises).then ((...args) => {
651 engine.debug.groupEnd ();
652 return Promise.resolve (...args);
653 }).catch ((e) => {
654 engine.debug.groupEnd ();
655 return Promise.reject (e);
656 });
657}
658
659// ============================================================================
660// Typing Control

Callers 1

proceedFunction · 0.85

Calls 6

componentsMethod · 0.80
debugMethod · 0.80
actionsMethod · 0.45
willProceedMethod · 0.45
showMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected