Init to deep water - cool results, but slow
This commit is contained in:
parent
dc8fc5ef87
commit
2b37385439
2 changed files with 8 additions and 10 deletions
|
@ -13,9 +13,7 @@ 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
|
||||
);
|
||||
const edgeTiles = islandTiles.filter((pos) => islands.data[pos] <= BEACH);
|
||||
islands.dropWithin(edgeTiles);
|
||||
|
||||
const mountainTiles = islands.floodSearch(
|
||||
|
@ -44,7 +42,7 @@ export const SMALL_BEACH: LobeGeneratorConstructor =
|
|||
(islands: IslandGrid, basePos: number) => () => {
|
||||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
|
||||
return true;
|
||||
|
@ -59,7 +57,7 @@ export const BIG_BEACH: LobeGeneratorConstructor = (
|
|||
return () => {
|
||||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
dropped++;
|
||||
|
||||
|
@ -74,7 +72,7 @@ export const SCATTERED_FOREST: LobeGeneratorConstructor =
|
|||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
// grow shore
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
|
||||
// seed beach
|
||||
|
@ -98,7 +96,7 @@ export const CONTIGUOUS_FOREST: LobeGeneratorConstructor =
|
|||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
// grow shore
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
|
||||
// seed beach
|
||||
|
@ -122,7 +120,7 @@ export const HILLY_FOREST: LobeGeneratorConstructor =
|
|||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
// grow shore
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
|
||||
// seed beach
|
||||
|
@ -150,7 +148,7 @@ export const ERODED_BEACH: LobeGeneratorConstructor =
|
|||
(islands: IslandGrid, basePos: number) => () => {
|
||||
const islandTiles = islands.floodSearch(basePos, (tile) => tile > WATER);
|
||||
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] == WATER);
|
||||
const shoreTiles = islandTiles.filter((pos) => islands.data[pos] <= WATER);
|
||||
islands.dropWithin(shoreTiles);
|
||||
|
||||
// erode
|
||||
|
|
|
@ -21,7 +21,7 @@ export class IslandGrid {
|
|||
done = false;
|
||||
|
||||
constructor(public width: number, public height: number, seed: number) {
|
||||
this.data = Array(width * height).fill(0);
|
||||
this.data = Array(width * height).fill(-1);
|
||||
this.rng = mulberry32(seed);
|
||||
|
||||
const islandBag = this.shuffle([
|
||||
|
|
Loading…
Add table
Reference in a new issue