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

Function previous

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

Source from the content-addressed store, hash-verified

100 * @returns {void}
101 */
102export function previous (engine: VisualNovelEngine): Promise<void> {
103 return new Promise<void> ((resolve) => {
104 setTimeout (() => {
105 engine.revert ().then (() => {
106 engine.global ('_engine_block', false);
107 resolve ();
108 }).catch ((e) => {
109 engine.debug.log ('Revert was prevented.\n', e);
110 engine.global ('_engine_block', false);
111
112 // The game could not be reverted, either because an
113 // action prevented it or because there are no statements
114 // left to revert to.
115 const currentStep = engine.state ('step') as number;
116
117 if (currentStep > 0) {
118 engine.state ({
119 step: currentStep - 1
120 });
121 }
122
123 engine.proceed ({ userInitiated: false, skip: false, autoPlay: false }).then (() => {
124 resolve ();
125 });
126 });
127 }, 0);
128 });
129}
130
131// ============================================================================
132// Action Preparation

Callers

nothing calls this directly

Calls 4

globalMethod · 0.80
stateMethod · 0.80
proceedMethod · 0.80
revertMethod · 0.45

Tested by

no test coverage detected