From e4ce9d0bccb84e061cfe64fd3914733f0b7ba04a Mon Sep 17 00:00:00 2001 From: "Timothy.Stiles" Date: Wed, 3 Mar 2021 14:15:17 +1100 Subject: [PATCH] glass block-with-item can't move onto a tile with an item in it --- js/game.js | 7 +++++-- js/tiletypes.js | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index b73af09..e2a4716 100644 --- a/js/game.js +++ b/js/game.js @@ -92,8 +92,11 @@ export class Tile { other.type.name !== 'ghost') return true; - if (this.type.blocks) - return this.type.blocks(this, level, other, direction); + if (this.type.blocks && this.type.blocks(this, level, other, direction)) + return true; + + if (other.type.blocked_by && other.type.blocked_by(other, level, this)) + return true; return false; } diff --git a/js/tiletypes.js b/js/tiletypes.js index bcdc279..d2c6d61 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1350,6 +1350,9 @@ const TILE_TYPES = { on_finishing_move(me, level) { this.try_pickup_item(me, level); }, + blocked_by(me, level, other) { + return other.cell.get_item() !== null && me.encased_item !== null; + }, on_death(me, level) { //needs to be called by transmute_tile to ttl and by lit_dynamite before remove_tile if (me.encased_item !== null) {