From 13b4180ab8ec1aa669ddbc2f33cb7513f8325ef9 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 14 Sep 2020 18:09:13 -0600 Subject: [PATCH] Make teleporting undoable --- js/game.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/js/game.js b/js/game.js index f03ee51..fa6b130 100644 --- a/js/game.js +++ b/js/game.js @@ -791,18 +791,15 @@ export class Level { // Handle teleporting, now that the dust has cleared // FIXME something funny happening here, your input isn't ignore while walking out of it? - let current_cell = actor.cell; if (teleporter) { let goal = teleporter.connection; // TODO in pathological cases this might infinite loop while (true) { // Physically move the actor to the new teleporter // XXX is this right, compare with tile world? i overhear it's actually implemented as a slide? - // XXX will probably play badly with undo lol - let tele_cell = goal.cell; - current_cell._remove(actor); - tele_cell._add(actor); - current_cell = tele_cell; + // XXX not especially undo-efficient + this.remove_tile(actor); + this.add_tile(actor, goal.cell); if (this.attempt_step(actor, actor.direction)) // Success, teleportation complete break;