From 7cf92f784131c9a736f22524f53adb2b3a78f2dc Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Wed, 16 Dec 2020 14:59:40 -0700 Subject: [PATCH] Set slide mode twice, to handle the obscure case of grabbing cleats on ice --- js/game.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/game.js b/js/game.js index eb873c0..0f060bb 100644 --- a/js/game.js +++ b/js/game.js @@ -1181,7 +1181,6 @@ export class Level { let original_cell = actor.cell; this.remove_tile(actor); - this.make_slide(actor, null); this.add_tile(actor, goal_cell); // Announce we're leaving, for the handful of tiles that care about it @@ -1211,10 +1210,6 @@ export class Level { this.fail('squished'); } - if (tile.type.slide_mode && ! actor.ignores(tile.type.name)) { - this.make_slide(actor, tile.type.slide_mode); - } - if (actor === this.player && tile.type.is_hint) { this.hint_shown = tile.hint_text ?? this.stored_level.hint; } @@ -1237,6 +1232,8 @@ export class Level { } // Announce we're approaching + // Clear the slide here since slide mode is important for knowing our speed + this.make_slide(actor, null); for (let tile of Array.from(actor.cell)) { if (tile === actor) continue; @@ -1246,6 +1243,9 @@ export class Level { if (tile.type.on_approach) { tile.type.on_approach(tile, this, actor); } + if (tile.type.slide_mode) { + this.make_slide(actor, tile.type.slide_mode); + } } if (this.compat.tiles_react_instantly) { @@ -1255,6 +1255,9 @@ export class Level { // Step on every tile in a cell we just arrived in step_on_cell(actor, cell) { + // Also reset slide here, since slide mode is differently important for forced moves + this.make_slide(actor, null); + // Step on topmost things first -- notably, it's safe to step on water with flippers on top for (let tile of Array.from(cell).reverse()) { if (tile === actor) @@ -1281,6 +1284,9 @@ export class Level { else if (tile.type.on_arrive) { tile.type.on_arrive(tile, this, actor); } + if (tile.type.slide_mode) { + this.make_slide(actor, tile.type.slide_mode); + } } }