From 6b0bb9cb3d366ef36f480cbcbc4af0aab7e31fda Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Tue, 29 Dec 2020 12:30:08 -0700 Subject: [PATCH] Prevent pushing a block that's already moving due to a slide push --- js/game.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/game.js b/js/game.js index aba042a..a00e7b6 100644 --- a/js/game.js +++ b/js/game.js @@ -94,6 +94,10 @@ export class Tile { } can_push(tile, direction) { + // This tile already has a push queued, sorry + if (tile.pending_push) + return false; + if (! (this.type.pushes && this.type.pushes[tile.type.name] && (! tile.type.allows_push || tile.type.allows_push(tile, direction)))) { @@ -906,10 +910,10 @@ export class Level extends LevelInterface { if (! direction) return true; - // Clear this again here due to a perverse CC2 ordering issue: a player with a hook sets - // this on a block at decision time, and then the block makes its decision (based on this), - // but then the player acts and sets this /again/ so it carries over and the block tries to - // move an extra time next turn. + // Clear this here since we use it to prevent pushing a block that's already been pushed. + // Also avoids a perverse CC2 ordering issue: a player with a hook sets this on a block at + // decision time; the block makes its decision (based on this); but then the player acts and + // sets this /again/ so it carries over and the block tries to move an extra time next turn. if (actor.pending_push) { this._set_tile_prop(actor, 'pending_push', null); } @@ -1261,8 +1265,8 @@ export class Level extends LevelInterface { if (actor.pending_push) { // Blocks that were pushed while sliding will move in the push direction as soon as // they stop sliding, regardless of what they landed on. Also used for hooking. + // This isn't cleared until the block makes another move; see _do_actor_movement. actor.decision = actor.pending_push; - this._set_tile_prop(actor, 'pending_push', null); return; }