From a50de91195fddfe92be0b82c9dee062774318c84 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 29 Aug 2020 00:30:01 -0600 Subject: [PATCH] Implement appearing walls and popwalls --- js/main.js | 12 ++++++++++++ js/tiletypes.js | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/js/main.js b/js/main.js index 2615881..1fcbc8c 100644 --- a/js/main.js +++ b/js/main.js @@ -414,6 +414,18 @@ class Level { original_cell.is_dirty = true; goal_cell.is_dirty = true; + // Announce we're leaving, for the handful of tiles that care about it + original_cell.each(tile => { + if (tile === actor) + return; + if (actor.ignores(tile.type.name)) + return; + + if (tile.type.on_depart) { + tile.type.on_depart(tile, this, actor); + } + }); + // Step on all the tiles in the new cell if (actor === this.player) { this.hint_shown = null; diff --git a/js/tiletypes.js b/js/tiletypes.js index 1abe4af..a9105e1 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -12,8 +12,14 @@ const TILE_TYPES = { }, wall_appearing: { blocks: true, + on_bump(me, level, other) { + me.become('wall'); + } }, popwall: { + on_depart(me, level, other) { + me.become('wall'); + } }, thinwall_n: { thin_walls: new Set(['north']),