mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 02:01:22 +01:00
refactor(es modules): use polylabel module and update aleaPRNG as local lib
This commit is contained in:
parent
f9f60176d9
commit
6a7ec6513a
21 changed files with 220 additions and 10 deletions
|
|
@ -8,6 +8,7 @@ import {getMiddlePoint} from "utils/lineUtils";
|
|||
import {minmax, rn} from "utils/numberUtils";
|
||||
import {each, gauss, generateSeed, P, ra, rand, rw} from "utils/probabilityUtils";
|
||||
import {round, splitInTwo} from "utils/stringUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
window.BurgsAndStates = (function () {
|
||||
const generate = function () {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {shouldRegenerateGrid, generateGrid} from "utils/graphUtils";
|
|||
import {byId} from "utils/shorthands";
|
||||
import {generateSeed} from "utils/probabilityUtils";
|
||||
import {getColorScheme} from "utils/colorUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
const initialSeed = generateSeed();
|
||||
let graph = getGraph(grid);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {getNumberInRange, P, rand} from "utils/probabilityUtils";
|
|||
import {byId} from "utils/shorthands";
|
||||
import {ERROR} from "../config/logging";
|
||||
import {lim, minmax} from "../utils/numberUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
window.HeightmapGenerator = (function () {
|
||||
let grid = null;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {rn} from "utils/numberUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
window.Lakes = (function () {
|
||||
const setClimateData = function (h) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import {findCell} from "utils/graphUtils";
|
||||
import polylabel from "polylabel";
|
||||
|
||||
import {last} from "utils/arrayUtils";
|
||||
import {findCell} from "utils/graphUtils";
|
||||
import {getSegmentId} from "utils/lineUtils";
|
||||
import {rn} from "utils/numberUtils";
|
||||
import {round, parseTransform} from "utils/stringUtils";
|
||||
import {parseTransform, round} from "utils/stringUtils";
|
||||
import {si} from "utils/unitUtils";
|
||||
|
||||
export class Rulers {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {tip} from "scripts/tooltips";
|
|||
import {rand, P, ra} from "utils/probabilityUtils";
|
||||
import {capitalize} from "utils/stringUtils";
|
||||
import {vowel} from "utils/languageUtils";
|
||||
import {ERROR} from "config/logging";
|
||||
|
||||
window.Names = (function () {
|
||||
let chains = [];
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {last} from "utils/arrayUtils";
|
|||
import {rn} from "utils/numberUtils";
|
||||
import {round} from "utils/stringUtils";
|
||||
import {rw, each} from "utils/probabilityUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
window.Rivers = (function () {
|
||||
const generate = function (allowErosion = true) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {findCell} from "utils/graphUtils";
|
||||
import {getMiddlePoint} from "utils/lineUtils";
|
||||
import {rn} from "utils/numberUtils";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
window.Submap = (function () {
|
||||
const isWater = (pack, id) => pack.cells.h[id] < 20;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {turnLayerButtonOff, turnLayerButtonOn, updatePresetInput} from "layers";
|
|||
import {restoreDefaultEvents} from "scripts/events";
|
||||
import {prompt} from "scripts/prompt";
|
||||
import {clearMainTip, showMainTip, tip} from "scripts/tooltips";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
export function editHeightmap(options) {
|
||||
const {mode, tool} = options || {};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {prompt} from "scripts/prompt";
|
|||
import {getNextId} from "utils/nodeUtils";
|
||||
import {P, generateSeed} from "utils/probabilityUtils";
|
||||
import {turnLayerButtonOn} from "layers";
|
||||
import {aleaPRNG} from "scripts/aleaPRNG";
|
||||
|
||||
toolsContent.addEventListener("click", function (event) {
|
||||
if (customization) return tip("Please exit the customization mode first", false, "warning");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue