()
| 92 | } |
| 93 | |
| 94 | override async willApply(): Promise<void> { |
| 95 | if (typeof this.character === 'undefined') { |
| 96 | FancyError.show('action:show_character_layer:character_not_found', { |
| 97 | asset: this.asset, |
| 98 | layer: this.layer, |
| 99 | availableCharacters: Object.keys(this.engine.characters()), |
| 100 | statement: `<code class='language=javascript'>"${this._statement}"</code>`, |
| 101 | label: this.engine.state('label'), |
| 102 | step: this.engine.state('step') |
| 103 | }); |
| 104 | throw new Error(`Character "${this.asset}" not found.`); |
| 105 | } |
| 106 | |
| 107 | if (typeof this.image === 'undefined') { |
| 108 | const layerAssets = this.character.layer_assets?.[this.layer]; |
| 109 | FancyError.show('action:show_character_layer:sprite_not_found', { |
| 110 | asset: this.asset, |
| 111 | layer: this.layer, |
| 112 | sprite: this.sprite, |
| 113 | availableSprites: layerAssets ? Object.keys(layerAssets) : [], |
| 114 | statement: `<code class='language=javascript'>"${this._statement}"</code>`, |
| 115 | label: this.engine.state('label'), |
| 116 | step: this.engine.state('step') |
| 117 | }); |
| 118 | throw new Error(`Sprite "${this.sprite}" not found for layer "${this.layer}" of character "${this.asset}".`); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | override async apply(): Promise<void> { |
| 123 | // show [character:layer] with [...animation] [infinite] |
no test coverage detected