From 6fd5759de3e62baef995b4d3d63d4bdc58f5ba4c Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 10 Sep 2020 12:55:15 -0600 Subject: [PATCH] Fix chip sockets --- js/game.js | 14 +++++++------- js/tiletypes.js | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/game.js b/js/game.js index 64dda86..5bf6656 100644 --- a/js/game.js +++ b/js/game.js @@ -41,7 +41,7 @@ export class Tile { } } - blocks(other, direction) { + blocks(other, direction, level) { if (this.type.blocks_all) return true; @@ -57,7 +57,7 @@ export class Tile { return true; if (this.type.blocks) - return this.type.blocks(this, other); + return this.type.blocks(this, level, other); return false; } @@ -145,9 +145,9 @@ export class Cell extends Array { return false; } - blocks_entering(actor, direction) { + blocks_entering(actor, direction, level) { for (let tile of this) { - if (tile.blocks(actor, direction) && ! actor.ignores(tile.type.name)) + if (tile.blocks(actor, direction, level) && ! actor.ignores(tile.type.name)) return true; } return false; @@ -510,7 +510,7 @@ export class Level { continue; if (! actor.cell.blocks_leaving(actor, direction) && - ! dest_cell.blocks_entering(actor, direction)) + ! dest_cell.blocks_entering(actor, direction, this)) { // We found a good direction! Stop here actor.decision = direction; @@ -622,7 +622,7 @@ export class Level { if (actor.ignores(tile.type.name)) continue; - if (! tile.blocks(actor, direction)) + if (! tile.blocks(actor, direction, this)) continue; if (actor.type.pushes && actor.type.pushes[tile.type.name] && ! tile.stuck) { @@ -633,7 +633,7 @@ export class Level { } if (tile.type.on_bump) { tile.type.on_bump(tile, this, actor); - if (! tile.blocks(actor, direction)) + if (! tile.blocks(actor, direction, this)) // It became something non-blocking! continue; } diff --git a/js/tiletypes.js b/js/tiletypes.js index a50247b..d86e617 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -169,7 +169,7 @@ const TILE_TYPES = { // Locked doors door_red: { draw_layer: LAYER_TERRAIN, - blocks(me, other) { + blocks(me, level, other) { // TODO not quite sure if this one is right; there are complex interactions with monsters, e.g. most monsters can eat blue keys but can't actually use them return ! (other.type.has_inventory && other.has_item('key_red')); }, @@ -181,7 +181,7 @@ const TILE_TYPES = { }, door_blue: { draw_layer: LAYER_TERRAIN, - blocks(me, other) { + blocks(me, level, other) { return ! (other.type.has_inventory && other.has_item('key_blue')); }, on_arrive(me, level, other) { @@ -192,7 +192,7 @@ const TILE_TYPES = { }, door_yellow: { draw_layer: LAYER_TERRAIN, - blocks(me, other) { + blocks(me, level, other) { return ! (other.type.has_inventory && other.has_item('key_yellow')); }, on_arrive(me, level, other) { @@ -203,7 +203,7 @@ const TILE_TYPES = { }, door_green: { draw_layer: LAYER_TERRAIN, - blocks(me, other) { + blocks(me, level, other) { return ! (other.type.has_inventory && other.has_item('key_green')); }, on_arrive(me, level, other) { @@ -806,7 +806,7 @@ const TILE_TYPES = { draw_layer: LAYER_TERRAIN, blocks_monsters: true, blocks_blocks: true, - blocks(me, other) { + blocks(me, level, other) { return (level.chips_remaining > 0); }, on_arrive(me, level, other) {