feat(#901): ability to lock seed in templates editor

This commit is contained in:
Azgaar 2022-12-10 19:55:23 +03:00
parent 425325888e
commit f20029eac5
5 changed files with 14 additions and 12 deletions

View file

@ -1041,8 +1041,10 @@ function editHeightmap(options) {
const steps = byId("templateBody").querySelectorAll("#templateBody > div");
if (!steps.length) return;
const seed = byId("templateSeed").value;
if (seed) Math.random = aleaPRNG(seed);
const currentSeed = byId("templateSeed").value;
const seed = (locked("templateSeed") && currentSeed) || generateSeed();
Math.random = aleaPRNG(seed);
byId("templateSeed").value = seed;
grid.cells.h = createTypedArray({maxValue: 100, length: grid.points.length});
HeightmapGenerator.setGraph(grid);