diff --git a/content/utilities/map-filter-export/plugin.js b/content/utilities/map-filter-export/plugin.js index 8ba11c4..5dedee2 100755 --- a/content/utilities/map-filter-export/plugin.js +++ b/content/utilities/map-filter-export/plugin.js @@ -294,31 +294,47 @@ function mapFilterExport() { let chunksAsArray = Array.from(chunks); let planetsCount = 0; + + + let res = []; + for (let i = 0; i < chunksAsArray.length; i++) { const chunk = chunksAsArray[i]; - let planetLocations = chunk.planetLocations; - - planetLocations = planetLocations.filter(item=>{ + const planetLocations = chunk.planetLocations; + let planetLocationsWithMark = []; + let newChunk = {}; + newChunk.chunkFootprint = {}; + newChunk.chunkFootprint.bottomLeft = chunk.chunkFootprint.bottomLeft; + newChunk.chunkFootprint.sideLength = chunk.chunkFootprint.sideLength; + newChunk.perlin = chunk.perlin; + + + planetLocations.forEach(item=>{ const coords = item.coords; let plt = df.getPlanetWithCoords(coords); - if(judgeLevel(plt)===false) return false; - if(judgePlanetType(plt)===false) return false; - if(judgeSpaceType(plt)===false) return false; - if(judgeOwner(plt)===false) return false; - if(destroyedFilter(plt)===false) return false; - return true; + let flag = true; + if(judgeLevel(plt)===false) flag = false; + if(judgePlanetType(plt)===false) flag = false; + if(judgeSpaceType(plt)===false) flag = false; + if(judgeOwner(plt)===false) flag = false; + if(destroyedFilter(plt)===false) flag = false; + if(flag){ + planetLocationsWithMark.push(item); + + } }); - chunksAsArray[i].planetLocations = planetLocations; - planetsCount+=planetLocations.length; + newChunk.planetLocations = planetLocationsWithMark; + res.push(newChunk); + planetsCount+=planetLocationsWithMark.length; } let newInfo = html`