Step in reverse order; allow pushing blocks on railroads; gliders ignore turtles
This commit is contained in:
parent
4838bb189b
commit
8428572def
16
js/game.js
16
js/game.js
@ -83,12 +83,17 @@ export class Tile {
|
||||
}
|
||||
|
||||
can_push(tile, direction) {
|
||||
return (
|
||||
this.type.pushes && this.type.pushes[tile.type.name] &&
|
||||
(! tile.type.allows_push || tile.type.allows_push(tile, direction)) &&
|
||||
if (! (this.type.pushes && this.type.pushes[tile.type.name] &&
|
||||
(! tile.type.allows_push || tile.type.allows_push(tile, direction))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Obey railroad curvature
|
||||
direction = tile.cell.redirect_exit(tile, direction);
|
||||
// Need to explicitly check this here, otherwise you could /attempt/ to push a block,
|
||||
// which would fail, but it would still change the block's direction
|
||||
! tile.cell.blocks_leaving(tile, direction));
|
||||
return ! tile.cell.blocks_leaving(tile, direction);
|
||||
}
|
||||
|
||||
// Inventory stuff
|
||||
@ -1012,7 +1017,8 @@ export class Level {
|
||||
// Step on every tile in a cell we just arrived in
|
||||
step_on_cell(actor, cell) {
|
||||
let teleporter;
|
||||
for (let tile of Array.from(cell)) {
|
||||
// Step on topmost things first -- notably, it's safe to step on water with flippers on top
|
||||
for (let tile of Array.from(cell).reverse()) {
|
||||
if (tile === actor)
|
||||
continue;
|
||||
if (actor.ignores(tile.type.name))
|
||||
|
||||
@ -1688,7 +1688,7 @@ const TILE_TYPES = {
|
||||
collision_mask: COLLISION.monster_generic,
|
||||
blocks_collision: COLLISION.all_but_player,
|
||||
movement_speed: 4,
|
||||
ignores: new Set(['water']),
|
||||
ignores: new Set(['water', 'turtle']), // doesn't cause turtles to disappear
|
||||
decide_movement(me, level) {
|
||||
// turn left: preserve current direction; if that doesn't work, turn left, then right,
|
||||
// then back the way we came
|
||||
|
||||
Loading…
Reference in New Issue
Block a user