Prevent bumping tiles in a cell that's blocked by thin walls
This commit is contained in:
parent
bf952433f1
commit
f30b9b34dd
17
js/game.js
17
js/game.js
@ -224,13 +224,18 @@ export class Cell extends Array {
|
|||||||
// (Note that here, and anywhere else that has any chance of altering the cell's contents,
|
// (Note that here, and anywhere else that has any chance of altering the cell's contents,
|
||||||
// we iterate over a copy of the cell to insulate ourselves from tiles appearing or
|
// we iterate over a copy of the cell to insulate ourselves from tiles appearing or
|
||||||
// disappearing mid-iteration.)
|
// disappearing mid-iteration.)
|
||||||
for (let tile of Array.from(this)) {
|
for (let tile of Array.from(this).reverse()) {
|
||||||
// TODO check ignores here?
|
// TODO check ignores here?
|
||||||
if (actor.type.on_bump) {
|
// Note that if they can't enter this cell because of a thin wall, then they can't bump
|
||||||
actor.type.on_bump(actor, level, tile, direction);
|
// any of our other tiles either. (This is my best guess at the actual behavior, seeing
|
||||||
}
|
// as walls also block everything but players can obviously bump /those/.)
|
||||||
if (tile.type.on_bumped) {
|
if (! blocked) {
|
||||||
tile.type.on_bumped(tile, level, actor);
|
if (actor.type.on_bump) {
|
||||||
|
actor.type.on_bump(actor, level, tile, direction);
|
||||||
|
}
|
||||||
|
if (tile.type.on_bumped) {
|
||||||
|
tile.type.on_bumped(tile, level, actor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! tile.blocks(actor, direction, level))
|
if (! tile.blocks(actor, direction, level))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user