Level lakes at the end of world generation, keeping their water (t96)

Volume-preserving levelling pass for water bodies of 50+ cells; the dock foundation is placed
first so it cannot erase levelled water. Seed hashes re-baselined (water and air only).
Started by Codex, finished and reviewed by Claude after Codex hit its usage limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 19:28:23 -04:00
co-authored by Claude Opus 5.5
parent 75d4e8ee4e
commit ae78756fa2
10 changed files with 227 additions and 50 deletions
+4 -2
View File
@@ -256,7 +256,10 @@ function* worldSteps(seedIn, w, h) {
if ((k & 31) === 0) yield [0.75 + 0.24 * k / 260, 'Settling loose ground'];
}
LSTEP = lstep; LFILM = lfilm; SORTP = sortp; CORNER_SEAL = cornerSeal; POWDER_FAN = powderFan;
// Establish the dock's ground before levelling, so its foundation cannot erase water.
placeDock(spawnX + 34);
yield [0.99, 'Finishing'];
levelWorldWater();
// re-ambient after settling, then start clean
for (let i = 0; i < N; i++) { const m = mat[i]; if (m !== MAGMA) temp[i] = AMB[(i / w) | 0]; life[i] = PH[m] === PH_LIQUID && FRZ[m] ? 255 : 0; }
tick = 0;
@@ -274,9 +277,8 @@ function* worldSteps(seedIn, w, h) {
if (!wet) for (let k = 0; k < tree.cells.length; k += 2) bgm[tree.cells[k]] = tree.cells[k + 1];
}
findTreeBases();
placeDock(spawnX + 34);
hot.fill(0); awake.fill(0); updateRoof();
// Keep the generated grains intact, but let unfinished lakes level from the first tick.
// Wake generated water so it responds from the first tick.
for (let i = 0; i < N; i++) if (mat[i] === WATER) wakeIdx(i);
resetEconomy(); resetWeather();
weather.base = worldWater();