Fix undoing dropping a bowling ball; make bowling balls explode at level edge
This commit is contained in:
parent
a4c1aa869b
commit
a72ec8c476
17
js/game.js
17
js/game.js
@ -1372,7 +1372,16 @@ export class Level extends LevelInterface {
|
|||||||
|
|
||||||
check_movement(actor, orig_cell, direction, push_mode) {
|
check_movement(actor, orig_cell, direction, push_mode) {
|
||||||
let dest_cell = this.get_neighboring_cell(orig_cell, direction);
|
let dest_cell = this.get_neighboring_cell(orig_cell, direction);
|
||||||
let success = (dest_cell &&
|
if (! dest_cell) {
|
||||||
|
if (push_mode === 'push') {
|
||||||
|
if (actor.type.on_blocked) {
|
||||||
|
actor.type.on_blocked(actor, this, direction, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let success = (
|
||||||
orig_cell.try_leaving(actor, direction, this, push_mode) &&
|
orig_cell.try_leaving(actor, direction, this, push_mode) &&
|
||||||
dest_cell.try_entering(actor, direction, this, push_mode));
|
dest_cell.try_entering(actor, direction, this, push_mode));
|
||||||
|
|
||||||
@ -1802,7 +1811,7 @@ export class Level extends LevelInterface {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Note that we can't drop a bowling ball if there's already an item, even though a
|
// Note that we can't drop a bowling ball if there's already an item, even though a
|
||||||
// dropped bowling ball is really an actor (TODO arguably a bug)
|
// dropped bowling ball is really an actor
|
||||||
if (cell.get_item())
|
if (cell.get_item())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1821,7 +1830,7 @@ export class Level extends LevelInterface {
|
|||||||
// already in this cell's actor layer. But we also know for sure that there's no
|
// already in this cell's actor layer. But we also know for sure that there's no
|
||||||
// item in this cell, so we'll cheat a little: remove the dropping actor, set the
|
// item in this cell, so we'll cheat a little: remove the dropping actor, set the
|
||||||
// item moving, then put the dropping actor back before anyone notices.
|
// item moving, then put the dropping actor back before anyone notices.
|
||||||
cell._remove(dropping_actor);
|
this.remove_tile(dropping_actor);
|
||||||
this.add_tile(tile, cell);
|
this.add_tile(tile, cell);
|
||||||
if (! this.attempt_out_of_turn_step(tile, dropping_actor.direction)) {
|
if (! this.attempt_out_of_turn_step(tile, dropping_actor.direction)) {
|
||||||
// It was unable to move, so there's nothing we can do but destroy it
|
// It was unable to move, so there's nothing we can do but destroy it
|
||||||
@ -1831,7 +1840,7 @@ export class Level extends LevelInterface {
|
|||||||
else {
|
else {
|
||||||
this.add_actor(tile);
|
this.add_actor(tile);
|
||||||
}
|
}
|
||||||
cell._add(dropping_actor);
|
this.add_tile(dropping_actor, cell);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.add_tile(tile, cell);
|
this.add_tile(tile, cell);
|
||||||
|
|||||||
@ -2343,7 +2343,7 @@ const TILE_TYPES = {
|
|||||||
},
|
},
|
||||||
on_blocked(me, level, direction, obstacle) {
|
on_blocked(me, level, direction, obstacle) {
|
||||||
// Blow up anything we run into
|
// Blow up anything we run into
|
||||||
if (obstacle.type.is_actor) {
|
if (obstacle && obstacle.type.is_actor) {
|
||||||
if (obstacle.type.is_real_player) {
|
if (obstacle.type.is_real_player) {
|
||||||
level.fail(me.type.name);
|
level.fail(me.type.name);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user