Caves
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// fills a chunk from a generator's noise settings: the terrain's density sampled on a coarse grid and interpolated (minecraft's
|
||||
// noise cells), caves cut out of it, then each column's biome, its surface blocks and fluids. what all of it is comes
|
||||
// noise cells), caves and carvers cut out of it, then each column's biome, its surface blocks and fluids. what all of it is comes
|
||||
// from the generator's noise settings, see NoiseTerrain and docs/modding/worldgen/terrain.md. trees and the rest
|
||||
// are features, after it
|
||||
import { CHUNK_AREA, CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import type { WorldShape } from "@/common/world_shape.ts";
|
||||
import { BIOME_CELL_HEIGHT } from "@/common/section.ts";
|
||||
import { get_biome } from "./biomes.ts";
|
||||
import { carve_chunk } from "./carvers.ts";
|
||||
import type { NoiseTerrain, TerrainColumn } from "./terrain.ts";
|
||||
import {
|
||||
compile_fluids,
|
||||
@@ -66,6 +67,8 @@ export function generate_noise_chunk(
|
||||
}
|
||||
}
|
||||
|
||||
const carved = carve_chunk(terrain.seed, settings.carvers ?? [], chunk_x, chunk_z, shape);
|
||||
|
||||
// every column of the chunk plus a ring around it, for how steep the ground is. the chunk's own with their
|
||||
// climate, for their biome
|
||||
const columns: TerrainColumn[] = [];
|
||||
@@ -155,7 +158,7 @@ export function generate_noise_chunk(
|
||||
blend(caves, cave_levels, cave_level + 1) * ct;
|
||||
density = Math.min(density, cave);
|
||||
}
|
||||
is_solid[y] = density > 0 ? 1 : 0;
|
||||
is_solid[y] = density > 0 && !carved?.[y * CHUNK_AREA + z * CHUNK_SIZE + x] ? 1 : 0;
|
||||
}
|
||||
|
||||
const column = column_at(x, z);
|
||||
|
||||
Reference in New Issue
Block a user