From 17c7df54da5c8fdcb186ec4f0777a543fb94d26e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 30 Nov 2024 15:20:30 +0100 Subject: [PATCH] Lua export omits position limts if not needed --- libpov.js | 9 +++++++-- manual.html | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libpov.js b/libpov.js index c7c522f..b3992eb 100644 --- a/libpov.js +++ b/libpov.js @@ -2288,8 +2288,13 @@ inputExportLua.onclick = function() { str += ` name = \"${escapedName}\",\n`; str += ` heat_point = ${biome.heat},\n`; str += ` humidity_point = ${biome.humidity},\n`; - str += ` min_pos { x = ${biome.min_x}, y = ${biome.min_y}, z = ${biome.min_z} },\n`; - str += ` max_pos { x = ${biome.max_x}, y = ${biome.max_y}, z = ${biome.max_z} },\n`; + if (biome.min_x !== MIN_X || biome.max_x !== MAX_X || biome.min_z !== MIN_Z || biome.max_z !== MAX_Z) { + str += ` max_pos { x = ${biome.max_x}, y = ${biome.max_y}, z = ${biome.max_z} },\n`; + str += ` min_pos { x = ${biome.min_x}, y = ${biome.min_y}, z = ${biome.min_z} },\n`; + } else if (biome.min_y !== MIN_Y || biome.max_y !== MAX_Y) { + str += ` max_y = ${biome.max_y},\n`; + str += ` min_y = ${biome.min_y},\n`; + } str += "})\n"; } exportSectionText.innerText = str; diff --git a/manual.html b/manual.html index 631da0a..961d166 100644 --- a/manual.html +++ b/manual.html @@ -124,7 +124,7 @@

This allows you to export the current biomes into a text. You can choose to export them in one of various formats. Only biome information is included, not the display settings or noise parameters.

-

The Lua export gives you a very basic Lua code that can be pasted into an actual Lua mod. The code is very basic and does not include the “landscape materials”, like what the surface is made of (dirt, stone, sand, etc.).

+

The Lua export gives you a very basic Lua code that can be pasted into an actual Lua mod. The code is very basic and does not include the “landscape materials”, like what the surface is made of (dirt, stone, sand, etc.). Biome coordinate limits (`y_min`/`y_max` or `min_pos`/`max_pos`) are added to the export only if they differ from the default values -31000 and 31000.

The JSON export is a text you can use to import the biomes in LiBPoV later. You may want to copy this into a text file.