mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
chore: modularize main.js
This commit is contained in:
parent
51df2f90b0
commit
e739698346
24 changed files with 1775 additions and 1706 deletions
29
src/scripts/statistics
Normal file
29
src/scripts/statistics
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import {INFO} from "config/logging";
|
||||
import {byId} from "utils/shorthands";
|
||||
import {heightmapTemplates} from "config/heightmap-templates";
|
||||
import {locked} from "scripts/options/lock";
|
||||
|
||||
// show map stats on generation complete
|
||||
export function showStatistics() {
|
||||
const heightmap = byId("templateInput").value;
|
||||
const isTemplate = heightmap in heightmapTemplates;
|
||||
const heightmapType = isTemplate ? "template" : "precreated";
|
||||
const isRandomTemplate = isTemplate && !locked("template") ? "random " : "";
|
||||
|
||||
const stats = ` Seed: ${seed}
|
||||
Canvas size: ${graphWidth}x${graphHeight} px
|
||||
Heightmap: ${heightmap} (${isRandomTemplate}${heightmapType})
|
||||
Points: ${grid.points.length}
|
||||
Cells: ${pack.cells.i.length}
|
||||
Map size: ${mapSizeOutput.value}%
|
||||
States: ${pack.states.length - 1}
|
||||
Provinces: ${pack.provinces.length - 1}
|
||||
Burgs: ${pack.burgs.length - 1}
|
||||
Religions: ${pack.religions.length - 1}
|
||||
Culture set: ${culturesSet.selectedOptions[0].innerText}
|
||||
Cultures: ${pack.cultures.length - 1}`;
|
||||
|
||||
mapId = Date.now(); // unique map id is it's creation date number
|
||||
mapHistory.push({seed, width: graphWidth, height: graphHeight, template: heightmap, created: mapId});
|
||||
INFO && console.log(stats);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue