feat: add compactPackData function to filter out undefined glaciers and icebergs

This commit is contained in:
StempunkDev 2026-01-15 00:02:05 +01:00
parent d1250b4c00
commit eb78b332a6

View file

@ -38,6 +38,12 @@ async function saveMap(method) {
}
function prepareMapData() {
function compactPackData() {
// Place all the compaction functions here
pack.ice.glaciers = pack.ice.glaciers.filter(g => g !== undefined);
pack.ice.icebergs = pack.ice.icebergs.filter(i => i !== undefined);
}
const date = new Date();
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
const license = "File can be loaded in azgaar.github.io/Fantasy-Map-Generator";
@ -89,6 +95,8 @@ function prepareMapData() {
const serializedSVG = new XMLSerializer().serializeToString(cloneEl);
compactPackData();
const {spacing, cellsX, cellsY, boundary, points, features, cellsDesired} = grid;
const gridGeneral = JSON.stringify({spacing, cellsX, cellsY, boundary, points, features, cellsDesired});
const packFeatures = JSON.stringify(pack.features);