mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
central store for heightmap configs
This commit is contained in:
parent
c2640bcada
commit
5a6b5b4c95
9 changed files with 145 additions and 190 deletions
|
|
@ -8,7 +8,7 @@ window.HeightmapGenerator = (function () {
|
|||
const cleanup = () => (heights = null);
|
||||
|
||||
const fromTemplate = template => {
|
||||
const templateString = HeightmapTemplates[template];
|
||||
const templateString = heightmapTemplates[template]?.template || "";
|
||||
const steps = templateString.split("\n");
|
||||
|
||||
if (!steps.length) throw new Error(`Heightmap template: no steps. Template: ${template}. Steps: ${steps}`);
|
||||
|
|
@ -52,7 +52,7 @@ window.HeightmapGenerator = (function () {
|
|||
const id = byId("templateInput").value;
|
||||
resetHeights();
|
||||
|
||||
const isTemplate = id in HeightmapTemplates;
|
||||
const isTemplate = id in heightmapTemplates;
|
||||
grid.cells.h = isTemplate ? fromTemplate(id) : await fromPrecreated(id);
|
||||
|
||||
cleanup();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue