Revise terrain targetting

This commit is contained in:
Tangent Wantwight 2024-01-13 00:10:34 -05:00
parent 3ee5ae3d8f
commit 46827f3428

View file

@ -164,22 +164,20 @@ export function IslandApplet() {
} }
function tick() { function tick() {
const islandTiles = islands.floodSearch(basePos, (tile) => tile > 0); const lowlandTiles = islands.floodSearch(basePos + 12, (tile) => tile > 0);
dropWithin(islandTiles);
// focus shore // grow shore
dropWithin(islandTiles.filter((pos) => islands.data[pos] == 0)); const shoreTiles = lowlandTiles.filter((pos) => islands.data[pos] == 0);
dropWithin(shoreTiles);
dropWithin(shoreTiles);
// form forest // seed beach
const hill = islands const beachTiles = lowlandTiles.filter((pos) => islands.data[pos] == 1);
.floodSearch(basePos + 12, (tile) => tile >= 2) dropWithin(beachTiles);
.filter((pos) => islands.data[pos] == 2);
dropWithin(hill);
// grow forest // expand forest
const forestTiles = islandTiles.filter( const forestTiles = lowlandTiles.filter((pos) => islands.data[pos] == 2);
(pos) => islands.data[pos] >= 2 && islands.data[pos] <= 3 dropWithin(forestTiles);
);
dropWithin(forestTiles); dropWithin(forestTiles);
dropWithin(forestTiles); dropWithin(forestTiles);