From 931f3c19c758dc2cfb2a158bc4241e639939d50d Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Sun, 14 Feb 2021 19:27:06 +1100 Subject: [PATCH] fix lit dynamite crash --- js/game.js | 26 +++++++++++++++----------- js/tiletypes.js | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/js/game.js b/js/game.js index 6041e22..5e24e15 100644 --- a/js/game.js +++ b/js/game.js @@ -2458,22 +2458,26 @@ export class Level extends LevelInterface { //update static_on_tic_tiles //TODO: if which on_tic happens first ever matters, this will introduce a time travel bug where the order is changed by changing tiles then undoing that. hmm - if (old_type.on_tic && !new_type.on_tic) + //ignore actors (because e.g. lit_dynamite gets called every tic because it's an actor) + if (!new_type.is_actor) { - //search array and remove - for (let i = 0; i < this.static_on_tic_tiles.length; ++i) + if (old_type.on_tic && !new_type.on_tic) { - if (this.static_on_tic_tiles[i] == tile) + //search array and remove + for (let i = 0; i < this.static_on_tic_tiles.length; ++i) { - this.static_on_tic_tiles.splice(i, 1); - break; + if (this.static_on_tic_tiles[i] == tile) + { + this.static_on_tic_tiles.splice(i, 1); + break; + } } } - } - else if (!old_type.on_tic && new_type.on_tic) - { - //add to end of array - this.static_on_tic_tiles.push(tile); + else if (!old_type.on_tic && new_type.on_tic) + { + //add to end of array + this.static_on_tic_tiles.push(tile); + } } //TODO: update circuit networks? diff --git a/js/tiletypes.js b/js/tiletypes.js index 1032be4..8b3059f 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -2767,7 +2767,7 @@ const TILE_TYPES = { is_tool: true, blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), item_ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', ]), - item_slide_ignores: new Set(['cracked_ice']), + item_slide_ignores: new Set(['cracked_ice']), }, suction_boots: { layer: LAYERS.item,