Populate movement_cooldown for lit dynamite; guard against NaNs; check for moving blocks in bump mode

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-27 05:41:03 -07:00
parent c7815ba841
commit 6470575a7b
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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);
}
},