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

Method revert

src/actions/Function.ts:67–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 }
66
67 override async revert(): Promise<void> {
68 // The function will be run asynchronously (No matter if its code isn't)
69 // if the function returns false, the previous statement will not be run
70 // automatically and the game will wait for user interaction or some other
71 // code inside the function to keep going. Any other returnValue will
72 // allow the game to keep going right away.
73 try {
74 const returnValue = await Util.callAsync(this.statement.Revert, this.engine);
75
76 if (returnValue === false) {
77 this.shouldContinue = false;
78 }
79 } catch (e: any) {
80 const context: Record<string, unknown> = {
81 label: this.engine.state('label'),
82 step: this.engine.state('step')
83 };
84
85 if (typeof e === 'object') {
86 context['Error Message'] = e.message;
87 context['File Name'] = e.fileName;
88 context['Line Number'] = e.lineNumber;
89 } else if (typeof e === 'string') {
90 context['Error Message'] = e;
91 }
92
93 FancyError.show('action:function:revert_error', context);
94 }
95 }
96
97 override async didRevert(): Promise<ActionRevertResult> {
98 return { advance: this.shouldContinue, step: true };

Callers

nothing calls this directly

Calls 2

stateMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected