diff --git a/js/game.js b/js/game.js index 831da5f..e961f5a 100644 --- a/js/game.js +++ b/js/game.js @@ -929,6 +929,11 @@ export class Level { this.pending_undo.push(() => cell._remove(tile)); } + add_actor(actor) { + this.actors.push(actor); + this.pending_undo.push(() => this.actors.pop()); + } + spawn_animation(cell, name) { let type = TILE_TYPES[name]; let tile = new Tile(type); diff --git a/js/tiletypes.js b/js/tiletypes.js index 8d29dc5..24a9cf3 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -532,7 +532,7 @@ const TILE_TYPES = { // abort the clone level.set_actor_stuck(tile, false); if (level.attempt_step(tile, direction)) { - level.actors.push(tile); + level.add_actor(tile); // FIXME add this underneath, just above the cloner let new_tile = new tile.constructor(type, direction); level.add_tile(new_tile, cell);