Add big beach
This commit is contained in:
parent
f1c9d9ef07
commit
aaa165013e
1 changed files with 26 additions and 3 deletions
|
@ -21,7 +21,7 @@ export const BIG_MOUNTAIN: LobeGeneratorConstructor =
|
||||||
};
|
};
|
||||||
|
|
||||||
/** form low-lying beach */
|
/** form low-lying beach */
|
||||||
export const BEACH_LOBE: LobeGeneratorConstructor =
|
export const SMALL_BEACH: LobeGeneratorConstructor =
|
||||||
(islands: IslandGrid, basePos: number) => () => {
|
(islands: IslandGrid, basePos: number) => () => {
|
||||||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||||
|
|
||||||
|
@ -31,6 +31,24 @@ export const BEACH_LOBE: LobeGeneratorConstructor =
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** form low-lying beach that meets another island */
|
||||||
|
export const BIG_BEACH: LobeGeneratorConstructor = (
|
||||||
|
islands: IslandGrid,
|
||||||
|
basePos: number
|
||||||
|
) => {
|
||||||
|
let dropped = 0;
|
||||||
|
return () => {
|
||||||
|
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||||
|
|
||||||
|
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||||
|
islands.dropWithin(shoreTiles);
|
||||||
|
dropped++;
|
||||||
|
|
||||||
|
const landTiles = islandTiles.filter((pos) => islands.data[pos] > WATER);
|
||||||
|
return landTiles.length > dropped;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/** form forested zone */
|
/** form forested zone */
|
||||||
export const FOREST_LOBE: LobeGeneratorConstructor =
|
export const FOREST_LOBE: LobeGeneratorConstructor =
|
||||||
(islands: IslandGrid, basePos: number) => () => {
|
(islands: IslandGrid, basePos: number) => () => {
|
||||||
|
@ -73,5 +91,10 @@ export const ERODED_LOBE: LobeGeneratorConstructor =
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BIG_ISLANDS = [BIG_MOUNTAIN];
|
export const BIG_ISLANDS = [BIG_BEACH, BIG_MOUNTAIN];
|
||||||
export const ALL_ISLANDS = [BIG_MOUNTAIN, BEACH_LOBE, FOREST_LOBE, ERODED_LOBE];
|
export const ALL_ISLANDS = [
|
||||||
|
BIG_MOUNTAIN,
|
||||||
|
SMALL_BEACH,
|
||||||
|
FOREST_LOBE,
|
||||||
|
ERODED_LOBE,
|
||||||
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue