From a413d1afc2a762135ea8197a6df339e54ba87839 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 19 Dec 2020 19:25:14 -0700 Subject: [PATCH] Fix bowling balls to start rolling immediately --- js/game.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/js/game.js b/js/game.js index 4c43204..0a7bc3c 100644 --- a/js/game.js +++ b/js/game.js @@ -812,10 +812,6 @@ export class Level extends LevelInterface { let old_cell = actor.cell; let success = this.attempt_step(actor, actor.decision); - if (! success && actor.type.on_blocked) { - actor.type.on_blocked(actor, this, actor.decision); - } - if (! success && actor.slide_mode === 'ice') { this._handle_slide_bonk(actor); success = this.attempt_step(actor, actor.decision); @@ -1220,18 +1216,15 @@ export class Level extends LevelInterface { let double_speed = false; let move = DIRECTIONS[direction].movement; - let goal_cell = this.get_neighboring_cell(actor.cell, direction); - if (! goal_cell) - return false; - - // Only bother touching the goal cell if we're not already trapped in this one - if (! actor.cell.try_leaving(actor, direction)) - return false; - - if (! goal_cell.try_entering(actor, direction, this, 'push')) + if (! this.check_movement(actor, actor.cell, direction, 'push')) { + if (actor.type.on_blocked) { + actor.type.on_blocked(actor, this, direction); + } return false; + } // FIXME this feels clunky + let goal_cell = this.get_neighboring_cell(actor.cell, direction); let terrain = goal_cell.get_terrain(); if (terrain && terrain.type.slide_mode && ! actor.ignores(terrain.type.name)) { double_speed = true; @@ -1543,11 +1536,11 @@ export class Level extends LevelInterface { } } let tile = new Tile(type); - if (type.is_actor) { - tile.direction = actor.direction; - this.add_actor(tile); - } this.add_tile(tile, actor.cell); + if (type.is_actor) { + this.add_actor(tile); + this.attempt_out_of_turn_step(tile, actor.direction); + } } actor.toolbelt.shift();