Remove blocks' knowledge of their pusher's speed
This commit is contained in:
parent
c214aeb0c6
commit
045bcb5789
11
js/game.js
11
js/game.js
@ -590,7 +590,7 @@ export class Level {
|
|||||||
|
|
||||||
// Try to move the given actor one tile in the given direction and update
|
// Try to move the given actor one tile in the given direction and update
|
||||||
// their cooldown. Return true if successful.
|
// their cooldown. Return true if successful.
|
||||||
attempt_step(actor, direction, pusher_speed = null) {
|
attempt_step(actor, direction) {
|
||||||
if (actor.stuck)
|
if (actor.stuck)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -635,9 +635,7 @@ export class Level {
|
|||||||
|
|
||||||
if (actor.type.pushes && actor.type.pushes[tile.type.name] && tile.movement_cooldown === 0 && ! tile.stuck) {
|
if (actor.type.pushes && actor.type.pushes[tile.type.name] && tile.movement_cooldown === 0 && ! tile.stuck) {
|
||||||
this.set_actor_direction(tile, direction);
|
this.set_actor_direction(tile, direction);
|
||||||
// FIXME the speed adjustment at the end of all this should go before this
|
if (this.attempt_step(tile, direction))
|
||||||
// call, but this all needs splitting up anyway
|
|
||||||
if (this.attempt_step(tile, direction, speed))
|
|
||||||
// It moved out of the way!
|
// It moved out of the way!
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -672,11 +670,6 @@ export class Level {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We cannot possibly move more slowly than something pushing us
|
|
||||||
if (pusher_speed !== null) {
|
|
||||||
speed = Math.min(speed, pusher_speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're clear!
|
// We're clear!
|
||||||
this.move_to(actor, goal_cell, speed);
|
this.move_to(actor, goal_cell, speed);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user