mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
chore: modularize main.js
This commit is contained in:
parent
51df2f90b0
commit
e739698346
24 changed files with 1775 additions and 1706 deletions
|
|
@ -472,7 +472,7 @@ export function editBiomes() {
|
|||
|
||||
function restoreInitialBiomes() {
|
||||
biomesData = applyDefaultBiomesSystem();
|
||||
defineBiomes();
|
||||
Biomes.define();
|
||||
drawBiomes();
|
||||
recalculatePopulation();
|
||||
refreshBiomesEditor();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import {restoreDefaultEvents} from "scripts/events";
|
|||
import {prompt} from "scripts/prompt";
|
||||
import {clearMainTip, showMainTip, tip} from "scripts/tooltips";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
import {undraw} from "scripts/generation";
|
||||
|
||||
export function editHeightmap(options) {
|
||||
const {mode, tool} = options || {};
|
||||
|
|
@ -203,8 +204,8 @@ export function editHeightmap(options) {
|
|||
markFeatures();
|
||||
markupGridOcean();
|
||||
if (erosionAllowed) {
|
||||
addLakesInDeepDepressions();
|
||||
openNearSeaLakes();
|
||||
Lakes.addLakesInDeepDepressions();
|
||||
Lakes.openNearSeaLakes();
|
||||
}
|
||||
OceanLayers();
|
||||
calculateTemperatures();
|
||||
|
|
@ -224,7 +225,7 @@ export function editHeightmap(options) {
|
|||
|
||||
drawRivers();
|
||||
Lakes.defineGroup();
|
||||
defineBiomes();
|
||||
Biomes.define();
|
||||
rankCells();
|
||||
Cultures.generate();
|
||||
Cultures.expand();
|
||||
|
|
@ -358,7 +359,7 @@ export function editHeightmap(options) {
|
|||
|
||||
// check biome
|
||||
pack.cells.biome[i] =
|
||||
isLand && biome[g] ? biome[g] : getBiomeId(grid.cells.prec[g], grid.cells.temp[g], pack.cells.h[i]);
|
||||
isLand && biome[g] ? biome[g] : Biomes.getId(grid.cells.prec[g], grid.cells.temp[g], pack.cells.h[i]);
|
||||
|
||||
// rivers data
|
||||
if (!erosionAllowed) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {applyDropdownOption} from "utils/nodeUtils";
|
|||
import {minmax, rn} from "utils/numberUtils";
|
||||
import {gauss, P, rand, rw} from "utils/probabilityUtils";
|
||||
import {byId, stored} from "utils/shorthands";
|
||||
import {regenerateMap} from "scripts/generation";
|
||||
|
||||
$("#optionsContainer").draggable({handle: ".drag-trigger", snap: "svg", snapMode: "both"});
|
||||
$("#exitCustomization").draggable({handle: "div"});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {parseError} from "utils/errorUtils";
|
|||
import {rn, minmax} from "utils/numberUtils";
|
||||
import {debounce} from "utils/functionUtils";
|
||||
import {restoreLayers} from "layers";
|
||||
import {undraw} from "scripts/generation";
|
||||
|
||||
window.UISubmap = (function () {
|
||||
byId("submapPointsInput").addEventListener("input", function () {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export function editWorld() {
|
|||
Lakes.defineGroup();
|
||||
Rivers.specify();
|
||||
pack.cells.h = new Float32Array(heights);
|
||||
defineBiomes();
|
||||
Biomes.define();
|
||||
|
||||
if (layerIsOn("toggleTemp")) drawTemp();
|
||||
if (layerIsOn("togglePrec")) drawPrec();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue