Populate movement_cooldown for lit dynamite; guard against NaNs; check for moving blocks in bump mode
This commit is contained in:
parent
c7815ba841
commit
6470575a7b
@ -269,8 +269,11 @@ export class Cell extends Array {
|
|||||||
if (push_mode === 'bump') {
|
if (push_mode === 'bump') {
|
||||||
// FIXME this doesn't take railroad curves into account, e.g. it thinks a
|
// FIXME this doesn't take railroad curves into account, e.g. it thinks a
|
||||||
// rover can't push a block through a curve
|
// 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;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (push_mode === 'push') {
|
else if (push_mode === 'push') {
|
||||||
if (actor === level.player) {
|
if (actor === level.player) {
|
||||||
@ -1920,6 +1923,7 @@ export class Level extends LevelInterface {
|
|||||||
// for undo/rewind purposes
|
// for undo/rewind purposes
|
||||||
|
|
||||||
_set_tile_prop(tile, key, val) {
|
_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) {
|
if (! this.undo_enabled) {
|
||||||
tile[key] = val;
|
tile[key] = val;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -2168,6 +2168,8 @@ const TILE_TYPES = {
|
|||||||
if (other.type.is_real_player && ! me.cell.get_item_mod()) {
|
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._set_tile_prop(me, 'timer', 85); // FIXME?? wiki just says about 4.3 seconds what
|
||||||
level.transmute_tile(me, 'dynamite_lit');
|
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);
|
level.add_actor(me);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user