From 6470575a7b4d25ac8864b4bf4b07688a40c85a49 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 27 Dec 2020 05:41:03 -0700 Subject: [PATCH] Populate movement_cooldown for lit dynamite; guard against NaNs; check for moving blocks in bump mode --- js/game.js | 6 +++++- js/tiletypes.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/game.js b/js/game.js index 383af9f..c27141b 100644 --- a/js/game.js +++ b/js/game.js @@ -269,8 +269,11 @@ export class Cell extends Array { if (push_mode === 'bump') { // FIXME this doesn't take railroad curves into account, e.g. it thinks a // rover can't push a block through a curve - if (! level.check_movement(tile, tile.cell, direction, push_mode)) + if (tile.movement_cooldown > 0 || + ! level.check_movement(tile, tile.cell, direction, push_mode)) + { return false; + } } else if (push_mode === 'push') { if (actor === level.player) { @@ -1920,6 +1923,7 @@ export class Level extends LevelInterface { // for undo/rewind purposes _set_tile_prop(tile, key, val) { + if (Number.isNaN(val)) throw new Error(`got a NaN for ${key} on ${tile.type.name} at ${tile.cell.x}, ${tile.cell.y}`); if (! this.undo_enabled) { tile[key] = val; return; diff --git a/js/tiletypes.js b/js/tiletypes.js index 6bac1e6..197b8e9 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -2168,6 +2168,8 @@ const TILE_TYPES = { if (other.type.is_real_player && ! me.cell.get_item_mod()) { level._set_tile_prop(me, 'timer', 85); // FIXME?? wiki just says about 4.3 seconds what level.transmute_tile(me, 'dynamite_lit'); + // Actors are expected to have this, so populate it + level._set_tile_prop(me, 'movement_cooldown', 0); level.add_actor(me); } },