From 1fc8e358435ba7eec6eb8eaf99e8529966ca236d Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 27 Dec 2020 08:33:03 -0700 Subject: [PATCH] Run on_ready in reverse order, mostly so initial RFF directions are correct --- js/game.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index fd74972..9319006 100644 --- a/js/game.js +++ b/js/game.js @@ -615,8 +615,12 @@ export class Level extends LevelInterface { this.wired_outputs = Array.from(wired_outputs); this.wired_outputs.sort((a, b) => this.coords_to_scalar(a.cell.x, a.cell.y) - this.coords_to_scalar(b.cell.x, b.cell.y)); - // Finally, let all tiles do any custom init behavior - for (let cell of this.linear_cells) { + // Finally, let all tiles do any custom init behavior... but backwards, to match actor + // order + // FIXME very much need an on_begin that's run at the start of the first tic for stuff like + // force floors and bombs + for (let i = this.linear_cells.length - 1; i >= 0; i--) { + let cell = this.linear_cells[i]; for (let tile of cell) { if (tile.type.on_ready) { tile.type.on_ready(tile, this);