From 46827f342814365b763985ec28497f3c3fda7848 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 13 Jan 2024 00:10:34 -0500 Subject: [PATCH] Revise terrain targetting --- island.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/island.ts b/island.ts index 8b92343..9578358 100644 --- a/island.ts +++ b/island.ts @@ -164,22 +164,20 @@ export function IslandApplet() { } function tick() { - const islandTiles = islands.floodSearch(basePos, (tile) => tile > 0); - dropWithin(islandTiles); + const lowlandTiles = islands.floodSearch(basePos + 12, (tile) => tile > 0); - // focus shore - dropWithin(islandTiles.filter((pos) => islands.data[pos] == 0)); + // grow shore + const shoreTiles = lowlandTiles.filter((pos) => islands.data[pos] == 0); + dropWithin(shoreTiles); + dropWithin(shoreTiles); - // form forest - const hill = islands - .floodSearch(basePos + 12, (tile) => tile >= 2) - .filter((pos) => islands.data[pos] == 2); - dropWithin(hill); + // seed beach + const beachTiles = lowlandTiles.filter((pos) => islands.data[pos] == 1); + dropWithin(beachTiles); - // grow forest - const forestTiles = islandTiles.filter( - (pos) => islands.data[pos] >= 2 && islands.data[pos] <= 3 - ); + // expand forest + const forestTiles = lowlandTiles.filter((pos) => islands.data[pos] == 2); + dropWithin(forestTiles); dropWithin(forestTiles); dropWithin(forestTiles);