fix lit dynamite crash

This commit is contained in:
Timothy Stiles 2021-02-14 19:27:06 +11:00
parent d6e43a70ca
commit 931f3c19c7
2 changed files with 16 additions and 12 deletions

View File

@ -2458,22 +2458,26 @@ export class Level extends LevelInterface {
//update static_on_tic_tiles //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 //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 if (old_type.on_tic && !new_type.on_tic)
for (let i = 0; i < this.static_on_tic_tiles.length; ++i)
{ {
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); if (this.static_on_tic_tiles[i] == tile)
break; {
this.static_on_tic_tiles.splice(i, 1);
break;
}
} }
} }
} else if (!old_type.on_tic && new_type.on_tic)
else if (!old_type.on_tic && new_type.on_tic) {
{ //add to end of array
//add to end of array this.static_on_tic_tiles.push(tile);
this.static_on_tic_tiles.push(tile); }
} }
//TODO: update circuit networks? //TODO: update circuit networks?

View File

@ -2767,7 +2767,7 @@ const TILE_TYPES = {
is_tool: true, is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
item_ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', ]), 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: { suction_boots: {
layer: LAYERS.item, layer: LAYERS.item,