mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 02:21:24 +01:00
refactor: dynamically load modules
This commit is contained in:
parent
a107c58643
commit
347083291f
46 changed files with 161 additions and 164 deletions
|
|
@ -6,6 +6,7 @@ import {byId} from "utils/shorthands";
|
|||
import {tip} from "scripts/tooltips";
|
||||
import {rn, minmax, normalize} from "utils/numberUtils";
|
||||
import {parseTransform} from "utils/stringUtils";
|
||||
import {each} from "utils/probabilityUtils";
|
||||
|
||||
// clear elSelected variable
|
||||
export function unselect() {
|
||||
|
|
@ -17,17 +18,6 @@ export function unselect() {
|
|||
elSelected = null;
|
||||
}
|
||||
|
||||
// close all dialogs except stated
|
||||
export function closeDialogs(except = "#except") {
|
||||
try {
|
||||
$(".dialog:visible")
|
||||
.not(except)
|
||||
.each(function () {
|
||||
$(this).dialog("close");
|
||||
});
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
// move brush radius circle
|
||||
export function moveCircle(x, y, r = 20) {
|
||||
let circle = byId("brushCircle");
|
||||
|
|
@ -256,11 +246,11 @@ function togglePort(burg) {
|
|||
.attr("height", size);
|
||||
}
|
||||
|
||||
function getBurgSeed(burg) {
|
||||
export function getBurgSeed(burg) {
|
||||
return burg.MFCG || Number(`${seed}${String(burg.i).padStart(4, 0)}`);
|
||||
}
|
||||
|
||||
function getMFCGlink(burg) {
|
||||
export function getMFCGlink(burg) {
|
||||
if (burg.link) return burg.link;
|
||||
|
||||
const {cells} = pack;
|
||||
|
|
@ -1025,27 +1015,3 @@ function refreshAllEditors() {
|
|||
if (byId("zonesEditorRefresh")?.offsetParent) zonesEditorRefresh.click();
|
||||
TIME && console.timeEnd("refreshAllEditors");
|
||||
}
|
||||
|
||||
// dynamically loaded editors
|
||||
export async function editStates() {
|
||||
if (customization) return;
|
||||
const Editor = await import("../dynamic/editors/states-editor.js");
|
||||
Editor.open();
|
||||
}
|
||||
|
||||
export async function editCultures() {
|
||||
if (customization) return;
|
||||
const Editor = await import("../dynamic/editors/cultures-editor.js");
|
||||
Editor.open();
|
||||
}
|
||||
|
||||
export async function editReligions() {
|
||||
if (customization) return;
|
||||
const Editor = await import("../dynamic/editors/religions-editor.js");
|
||||
Editor.open();
|
||||
}
|
||||
|
||||
export async function editUnits() {
|
||||
const {open} = await import("./units-editor.js");
|
||||
open();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue