Lake banks slope down to the water instead of ending in a cliff (t96)
Digging basins to the lower rim left a 9-18 grain vertical cliff on each lake's high side (owner screenshots, seed 766733). From each edge inward the ground now falls at most 0.7 grains a column and is never raised above the natural surface. New no-cliff check in t_lakes.js; world hashes re-baselined (shallow ore: 2 cells changed, on a lake bank). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -74,12 +74,23 @@ function* worldSteps(seedIn, w, h) {
|
||||
if (f.k !== 'lake') continue;
|
||||
const lw = Math.min(Math.round(90 + rng() * 40), Math.abs(f.x - spawnX) - 80), deep = 22 + rng() * 8;
|
||||
const lip = Math.max(surfY[Math.max(0, f.x - lw)], surfY[Math.min(w - 1, f.x + lw)]) - 1;
|
||||
for (let x = f.x - lw; x <= f.x + lw; x++) {
|
||||
if (x < 0 || x >= w) continue;
|
||||
const x0 = Math.max(0, f.x - lw), x1 = Math.min(w - 1, f.x + lw), nat = surfY.slice(x0, x1 + 1);
|
||||
for (let x = x0; x <= x1; x++) {
|
||||
const u = (x - f.x) / lw, depth = Math.max(0, 1 - u * u) * deep;
|
||||
if (depth > 0) { surfY[x] = Math.max(surfY[x], Math.round(lip + depth)); dirtY[x] = Math.max(dirtY[x], surfY[x] + 8); }
|
||||
if (depth > 0) surfY[x] = Math.max(surfY[x], Math.round(lip + depth));
|
||||
lakeTop[x] = lip + 2;
|
||||
}
|
||||
// Dug to the lower rim, the high side would end in a cliff as tall as the gap between the
|
||||
// rims: from each edge inward the ground may fall at most 0.7 grains a column, never above nature.
|
||||
for (const d of [1, -1]) {
|
||||
let prev = surfY[d > 0 ? Math.max(0, x0 - 1) : Math.min(w - 1, x1 + 1)];
|
||||
for (let x = d > 0 ? x0 : x1; x >= x0 && x <= x1; x += d) {
|
||||
prev = Math.min(prev + 0.7, surfY[x]);
|
||||
surfY[x] = Math.max(nat[x - x0], Math.round(prev));
|
||||
prev = Math.max(prev, surfY[x]);
|
||||
}
|
||||
}
|
||||
for (let x = x0; x <= x1; x++) dirtY[x] = Math.max(dirtY[x], surfY[x] + 8);
|
||||
for (let x = Math.max(0, f.x - lw - 6); x <= Math.min(w - 1, f.x + lw + 6); x++) noTree[x] = 1;
|
||||
}
|
||||
for (const f of feats) {
|
||||
|
||||
Reference in New Issue
Block a user