Fix generated map integrity and wall access

This commit is contained in:
chelsea
2026-05-02 23:48:35 -05:00
parent 127e706bcb
commit 95bd106a3b
3 changed files with 18 additions and 11 deletions

View File

@@ -1068,6 +1068,7 @@ static void place_leaf_circle(int cx, int cy, int cz, int radius, int leaf_block
int r2 = radius * radius;
for (int dx = -radius; dx <= radius; ++dx) {
for (int dz = -radius; dz <= radius; ++dz) {
if (dx == 0 && dz == 0) continue;
if (dx * dx + dz * dz > r2) continue;
if (hole_prob > 0.0 && rng_next_f64(rng) < hole_prob) continue;
block_list_push(out, cx + dx, cy, cz + dz, (uint16_t)leaf_block);
@@ -3779,7 +3780,10 @@ static void generate_chunk_border_wall(worldgen_ctx *ctx, int chunk_x, int chunk
uint16_t block = BLOCK_SMOOTH_STONE;
int in_center_corridor = side_dist >= wall_center - 1 && side_dist <= wall_center + 1 &&
rel_y >= 2 && rel_y <= 4;
if (in_center_corridor) {
int in_walltop_tower_passage = in_tower &&
side_dist >= wall_center - 1 && side_dist <= wall_center + 1 &&
rel_y >= wall_height + 1 && rel_y <= wall_height + 3;
if (in_center_corridor || in_walltop_tower_passage) {
continue;
}
if (rel_y < 0) {
@@ -3810,7 +3814,8 @@ static void generate_chunk_border_wall(worldgen_ctx *ctx, int chunk_x, int chunk
set_block_with_height(out, dx, dz, y, block);
}
if (top + 1 < CHUNK_HEIGHT) {
if (!in_tower && (side_dist == wall_start || side_dist == wall_end)) {
int rail_opening = ladder_module && side_dist == wall_end && ladder_offset <= 1;
if (!in_tower && !rail_opening && (side_dist == wall_start || side_dist == wall_end)) {
uint16_t rail_block = (side < 2) ? BLOCK_IRON_BARS_NS : BLOCK_IRON_BARS_EW;
set_block_with_height(out, dx, dz, top + 1, rail_block);
} else if (in_tower && phase % 4 < 2) {