Add a Amidst for Minetest export
This commit is contained in:
parent
b4d3a62e30
commit
42fda24809
@ -161,8 +161,9 @@ A Voronoi diagram is supposed to be here but for some reason it cannot be displa
|
|||||||
<div class="configFrame" id="exportContainer" style="display:none">
|
<div class="configFrame" id="exportContainer" style="display:none">
|
||||||
<form id="exportForm">
|
<form id="exportForm">
|
||||||
<div>
|
<div>
|
||||||
<button id="inputExportLua" type="button">Export Lua</button>
|
<button id="inputExportLua" type="button">Export as Lua</button>
|
||||||
<button id="inputExportJSON" type="button">Export JSON</button>
|
<button id="inputExportJSON" type="button">Export as JSON</button>
|
||||||
|
<button id="inputExportAmidstForMinetest" type="button">Export as Amidst for Minetest biome set</button>
|
||||||
<button id="inputExportClear" type="button">Clear</button>
|
<button id="inputExportClear" type="button">Clear</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="exportSectionOuter" hidden><br><span id="exportLabel"></span>
|
<div id="exportSectionOuter" hidden><br><span id="exportLabel"></span>
|
||||||
|
33
mibpov.js
33
mibpov.js
@ -1706,6 +1706,39 @@ inputExportJSON.onclick = function() {
|
|||||||
}
|
}
|
||||||
exportSectionOuter.hidden = false;
|
exportSectionOuter.hidden = false;
|
||||||
}
|
}
|
||||||
|
inputExportAmidstForMinetest.onclick = function() {
|
||||||
|
let jsonOut = {};
|
||||||
|
jsonOut.name = "MiBPoV Export";
|
||||||
|
let jsonPoints = [];
|
||||||
|
for (let b=0; b<biomePoints.length; b++) {
|
||||||
|
let biome = biomePoints[b];
|
||||||
|
let jsonPoint = {};
|
||||||
|
jsonPoint.name = biome.name;
|
||||||
|
jsonPoint.heat_point = biome.heat;
|
||||||
|
jsonPoint.humidity_point = biome.humidity;
|
||||||
|
jsonPoint.y_min = biome.min_y;
|
||||||
|
jsonPoint.y_max = biome.max_y;
|
||||||
|
// TODO: Export cell color
|
||||||
|
jsonPoint.color = {
|
||||||
|
r: 255,
|
||||||
|
g: 255,
|
||||||
|
b: 255,
|
||||||
|
},
|
||||||
|
jsonPoints.push(jsonPoint);
|
||||||
|
}
|
||||||
|
jsonOut.biomeList = jsonPoints;
|
||||||
|
|
||||||
|
let str = JSON.stringify(jsonOut);
|
||||||
|
exportSectionText.innerText = str;
|
||||||
|
if (str === "") {
|
||||||
|
exportSectionText.hidden = true;
|
||||||
|
exportLabel.innerText = "Export is empty.";
|
||||||
|
} else {
|
||||||
|
exportSectionText.hidden = false;
|
||||||
|
exportLabel.innerText = "Exported biomes (as Amidst for Minetest biome set):";
|
||||||
|
}
|
||||||
|
exportSectionOuter.hidden = false;
|
||||||
|
}
|
||||||
inputExportClear.onclick = function() {
|
inputExportClear.onclick = function() {
|
||||||
exportSectionOuter.hidden = true;
|
exportSectionOuter.hidden = true;
|
||||||
exportSectionText.innerText = "";
|
exportSectionText.innerText = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user