From a87db67d841ac6d4a8e717ef0ebbf164e5f988ee Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 20:22:00 +1100 Subject: [PATCH] lexy w/ skates and cerise now crack but don't slide on cracked ice (fixes #82) --- js/game.js | 9 ++++----- js/tiletypes.js | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/game.js b/js/game.js index 0051977..bd29d9e 100644 --- a/js/game.js +++ b/js/game.js @@ -1881,7 +1881,7 @@ export class Level extends LevelInterface { // Whether we're sliding is determined entirely by whether we most recently moved onto a // sliding tile that we don't ignore. This could /almost/ be computed on the fly, except // that an actor that starts on e.g. ice or a teleporter is not considered sliding. - this._set_tile_prop(actor, 'is_sliding', terrain.type.slide_mode && ! actor.ignores(terrain.type.name)); + this._set_tile_prop(actor, 'is_sliding', terrain.type.slide_mode && !actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)); // Do Lexy-style hooking here: only attempt to pull things just after we've actually moved // successfully, which means the hook can never stop us from moving and hook slapping is not @@ -1969,9 +1969,7 @@ export class Level extends LevelInterface { continue; if (actor.ignores(tile.type.name)) continue; - if (actor.slide_ignores(tile.type.name)) - continue; - + if (tile.type.on_approach) { tile.type.on_approach(tile, this, actor); } @@ -2036,7 +2034,8 @@ export class Level extends LevelInterface { continue; } } - else if (tile.type.on_arrive) { + else if (tile.type.on_arrive && !actor.slide_ignores(tile.type.name)) { + // Kind of weird putting slide_ignores here, except that all sliding happens on on_arrive, and tiles that make you slide in on_arrive don't do anything else, so for now it works tile.type.on_arrive(tile, this, actor); } diff --git a/js/tiletypes.js b/js/tiletypes.js index 1e5b933..d38ab81 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -3006,7 +3006,8 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.real_player, can_reveal_walls: true, movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), + slide_ignores: new Set(['cracked_ice']), pushes: { dirt_block: true, ice_block: true, @@ -3060,7 +3061,8 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.player, can_reveal_walls: true, // XXX i think? movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), + slide_ignores: new Set(['cracked_ice']), pushes: { dirt_block: true, ice_block: true,