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

Method willApply

src/actions/ShowCharacter.ts:90–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 }
89
90 override async willApply(): Promise<void> {
91 if (typeof this.character === 'undefined') {
92 FancyError.show('action:show_character:character_not_found', {
93 asset: this.asset,
94 availableCharacters: Object.keys(this.engine.characters()),
95 statement: `<code class='language=javascript'>"${this._statement}"</code>`,
96 label: this.engine.state('label'),
97 step: this.engine.state('step')
98 });
99 throw new Error(`Character "${this.asset}" not found.`);
100 }
101
102 if (typeof this.image === 'undefined') {
103 FancyError.show('action:show_character:sprite_not_found', {
104 asset: this.asset,
105 sprite: this.sprite,
106 availableSprites: this.character.sprites ? Object.keys(this.character.sprites) : [],
107 statement: `<code class='language=javascript'>"${this._statement}"</code>`,
108 label: this.engine.state('label'),
109 step: this.engine.state('step')
110 });
111 throw new Error(`Sprite "${this.sprite}" not found for character "${this.asset}".`);
112 }
113 }
114
115 override async apply(): Promise<void> {
116 // show [character] [expression] at [position] with [animation] [infinite]

Callers 1

onLoadMethod · 0.45

Calls 4

charactersMethod · 0.80
stateMethod · 0.80
keysMethod · 0.65
showMethod · 0.45

Tested by

no test coverage detected