This commit is contained in:
Tangent Wantwight 2024-01-12 23:45:19 -05:00
parent a0650ee706
commit cc2ae41bb5

View file

@ -157,13 +157,19 @@ export function IslandApplet() {
} }
} }
function dropWithin(tiles: number[]) {
if (tiles.length > 0) {
drop(tiles[islands.rng() % tiles.length]);
}
}
function tick() { function tick() {
const islandTiles = islands.floodSearch(basePos, (tile) => tile > 0); const islandTiles = islands.floodSearch(basePos, (tile) => tile > 0);
drop(islandTiles[islands.rng() % islandTiles.length]); dropWithin(islandTiles);
drop(islandTiles[islands.rng() % islandTiles.length]); dropWithin(islandTiles);
const mountainTiles = islands.floodSearch(basePos - 8, (tile) => tile > 4); const mountainTiles = islands.floodSearch(basePos - 8, (tile) => tile > 4);
drop(mountainTiles[islands.rng() % mountainTiles.length]); dropWithin(mountainTiles);
// const erodePos = islandTiles[islands.rng() % islandTiles.length]; // const erodePos = islandTiles[islands.rng() % islandTiles.length];
// islands.data[erodePos] = Math.max(islands.data[erodePos] - 1, 0); // islands.data[erodePos] = Math.max(islands.data[erodePos] - 1, 0);