From 68de70743f12c0d14748a7be334c1d9032bc793e Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Fri, 25 Sep 2020 20:45:01 -0600 Subject: [PATCH] Fix, partially, stopping yourself on force floors --- js/game.js | 15 ++++++++++++--- js/tiletypes.js | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/js/game.js b/js/game.js index da4c046..df2f551 100644 --- a/js/game.js +++ b/js/game.js @@ -760,10 +760,19 @@ export class Level { if (actor.slide_mode === 'ice') { // Actors on ice turn around when they hit something this.set_actor_direction(actor, DIRECTIONS[direction].opposite); - // Somewhat clumsy hack: step on the ice tile again, so if it's - // a corner, it'll turn us in the correct direction + } + if (actor.slide_mode !== null) { + // Somewhat clumsy hack: if an actor is sliding and hits something, step on the + // relevant tile again. This fixes two problems: if it was on an ice corner then it + // needs to turn a second time even though it didn't move; and if it was a player + // overriding a force floor into a wall, then their direction needs to be set back + // to the force floor direction. + // (For random force floors, this does still match CC2 behavior: after an override, + // CC2 will try to force you in the /next/ RFF direction.) + // FIXME now overriding into a wall doesn't show you facing that way at all! lynx + // only changes your direction at decision time by examining the floor tile... for (let tile of actor.cell) { - if (tile.type.slide_mode === 'ice' && tile.type.on_arrive) { + if (tile.type.slide_mode === actor.slide_mode && tile.type.on_arrive) { tile.type.on_arrive(tile, this, actor); } } diff --git a/js/tiletypes.js b/js/tiletypes.js index c9cc6b4..8082d4d 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -461,6 +461,7 @@ const TILE_TYPES = { draw_layer: LAYER_TERRAIN, slide_mode: 'force', // TODO ms: this is random, and an acting wall to monsters (!) + // TODO lynx/cc2 check this at decision time, which may affect ordering on_arrive(me, level, other) { level.set_actor_direction(other, level.get_force_floor_direction()); },