Fix blocks sliding on ice and also squishing the player

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-05 17:57:48 -06:00
parent 4ccf17120b
commit 3d6dca2440

View File

@ -555,6 +555,7 @@ class Level {
continue; continue;
if (actor.type.pushes && actor.type.pushes[tile.type.name]) { if (actor.type.pushes && actor.type.pushes[tile.type.name]) {
this.set_actor_direction(tile, direction);
if (this.attempt_step(tile, direction, speed)) if (this.attempt_step(tile, direction, speed))
// It moved out of the way! // It moved out of the way!
continue; continue;
@ -578,7 +579,7 @@ class Level {
if (blocked) { if (blocked) {
if (actor.slide_mode === 'ice') { if (actor.slide_mode === 'ice') {
// Actors on ice turn around when they hit something // Actors on ice turn around when they hit something
actor.direction = DIRECTIONS[direction].opposite; this.set_actor_direction(actor, DIRECTIONS[direction].opposite);
// Somewhat clumsy hack: step on the ice tile again, so if it's // Somewhat clumsy hack: step on the ice tile again, so if it's
// a corner, it'll turn us in the correct direction // a corner, it'll turn us in the correct direction
for (let tile of original_cell) { for (let tile of original_cell) {
@ -641,6 +642,11 @@ class Level {
this.fail("Oops! Watch out for creatures!"); this.fail("Oops! Watch out for creatures!");
return; return;
} }
if (actor.type.is_block && tile.type.is_player) {
// TODO ooh, obituaries
this.fail("squish");
return;
}
} }
if (this.compat.tiles_react_instantly) { if (this.compat.tiles_react_instantly) {