From 136fa432e33f4bd03ccef5d89f8d0657648a5908 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 5 Sep 2020 19:19:08 -0600 Subject: [PATCH] Prevent pushing a block off a cloner --- js/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 234db27..f3d83ad 100644 --- a/js/main.js +++ b/js/main.js @@ -509,6 +509,9 @@ class Level { // Try to move the given actor one tile in the given direction and update // their cooldown. Return true if successful. attempt_step(actor, direction, speed = null) { + if (actor.stuck) + return false; + // If speed is given, we're being pushed by something so we're using // its speed. Otherwise, use our movement speed. If we're moving onto // a sliding tile, we'll halve it later @@ -554,7 +557,7 @@ class Level { if (! tile.blocks(actor, direction)) continue; - if (actor.type.pushes && actor.type.pushes[tile.type.name]) { + if (actor.type.pushes && actor.type.pushes[tile.type.name] && ! tile.stuck) { this.set_actor_direction(tile, direction); if (this.attempt_step(tile, direction, speed)) // It moved out of the way!