Fix chip sockets

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-10 12:55:15 -06:00
parent 1453f68de5
commit 6fd5759de3
2 changed files with 12 additions and 12 deletions

View File

@ -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;
}

View File

@ -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) {