diff --git a/island/data.ts b/island/data.ts index 785fae2..68ca0b6 100644 --- a/island/data.ts +++ b/island/data.ts @@ -5,4 +5,4 @@ export const BEACH = 1; export const LIGHT_FOREST = 2; export const DENSE_FOREST = 3; export const MOUNTAIN = 4; -export const ICECAP = 9; +export const ICECAP = 6; diff --git a/island/generators.ts b/island/generators.ts index 9352278..6a2e6c1 100644 --- a/island/generators.ts +++ b/island/generators.ts @@ -8,6 +8,25 @@ export type LobeGeneratorConstructor = ( basePos: number ) => LobeGenerator; +/** form mountain */ +export const SMALL_MOUNTAIN: LobeGeneratorConstructor = + (islands: IslandGrid, basePos: number) => () => { + const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER); + + const edgeTiles = islandTiles.filter( + (pos) => islands.data[pos] == WATER || islands.data[pos] == BEACH + ); + islands.dropWithin(edgeTiles); + + const mountainTiles = islands.floodSearch( + basePos, + (tile) => tile > MOUNTAIN + ); + islands.dropWithin(mountainTiles); + + return true; + }; + /** form mountain with icecap */ export const BIG_MOUNTAIN: LobeGeneratorConstructor = (islands: IslandGrid, basePos: number) => () => { @@ -150,7 +169,7 @@ export const NO_ISLAND: LobeGeneratorConstructor = }; export const BIG_ISLANDS = [BIG_MOUNTAIN, BIG_BEACH, HILLY_FOREST]; -export const ROCKY_ISLANDS = [BIG_MOUNTAIN, HILLY_FOREST]; +export const ROCKY_ISLANDS = [SMALL_MOUNTAIN, BIG_MOUNTAIN, HILLY_FOREST]; export const GREEN_ISLANDS = [ SCATTERED_FOREST, CONTIGUOUS_FOREST, @@ -158,6 +177,7 @@ export const GREEN_ISLANDS = [ ]; export const SMALL_ISLANDS = [SMALL_BEACH, SCATTERED_FOREST, ERODED_BEACH]; export const ALL_ISLANDS = [ + SMALL_MOUNTAIN, BIG_MOUNTAIN, SMALL_BEACH, BIG_BEACH, diff --git a/island/render.ts b/island/render.ts index b5a92da..21ae6d6 100644 --- a/island/render.ts +++ b/island/render.ts @@ -22,10 +22,7 @@ export function renderIslands( cx.fillStyle = "#008800"; break; case MOUNTAIN: - case 5: - case 6: - case 7: - case 8: + case MOUNTAIN + 1: cx.fillStyle = "#666666"; break; default: