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

Function next

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

Source from the content-addressed store, hash-verified

72 * @returns {void}
73 */
74export function next (engine: VisualNovelEngine): Promise<void> {
75 // Advance 1 step
76 const currentStep = engine.state ('step');
77
78 engine.state ({ step: currentStep + 1 });
79
80 const label = engine.label ();
81 const step = engine.state ('step');
82
83 return new Promise<void> ((resolve) => {
84 // Clear the Stack using a Time Out instead of calling the function
85 // directly, preventing an Overflow
86 setTimeout (() => {
87 engine.run (label[step]).then (() => {
88 engine.global ('_engine_block', false);
89 resolve ();
90 }).catch (() => {
91 resolve ();
92 });
93 }, 0);
94 });
95}
96
97/**
98 * @static revert - Revert to the previous statement on the script

Callers

nothing calls this directly

Calls 4

stateMethod · 0.80
labelMethod · 0.80
globalMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected