Make cloning undoable
This commit is contained in:
parent
b26820d99b
commit
f511e2ecb9
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user