morlendor autoconfiguration level, inside the limits, almost 320 levels
* morlendor must be inside the limits, but not almost the limit of the world * morlendor are just 220 block but let enought for layers, so reserved 320 * check for nether level or just guess to -11000, error if overlaping * check if the world is enought to fit the morlendor layers * close https://notabug.org/TenPlus1/nssb/issues/7 * close https://codeberg.org/minenux/minetest-mod-nssb/issues/7main
parent
2bb4b8a5ce
commit
648f03722e
12
README.md
12
README.md
|
@ -48,10 +48,16 @@ No new features are developed yet! Any new contribution please mantains most bac
|
||||||
* tnt
|
* tnt
|
||||||
* mobs
|
* mobs
|
||||||
|
|
||||||
#### conflicts
|
#### configurations
|
||||||
|
|
||||||
This mod adds a dimension in the depths of the map, the [Morlendor](#mordenlor), **configurable**,
|
This mod adds a dimension in the depths of the map, the [Morlendor](#mordenlor), **configurable**
|
||||||
layer and in future autodetect the `nether` and `caverealms` layers to avoid conflicts.
|
using the `nssb.morlendor_level` parameter as negative integer:
|
||||||
|
|
||||||
|
* If `nssb.morlendor_level` is outside of `mapgen_limit`, the mod will try to autoset best setting.
|
||||||
|
* If `nssb.morlendor_level` it overlap `nether_depth_ymax`, of nether mod, an error will raise.
|
||||||
|
|
||||||
|
The morlendor level must be at least 320 layers of blocks over the limit,
|
||||||
|
and 1000 layers of blocks below the nether deep floor.
|
||||||
|
|
||||||
### New buildings
|
### New buildings
|
||||||
|
|
||||||
|
|
31
mapgen.lua
31
mapgen.lua
|
@ -1,4 +1,5 @@
|
||||||
local moreores = minetest.get_modpath("moreores")
|
local moreores = minetest.get_modpath("moreores")
|
||||||
|
local nethermod = minetest.get_modpath("nether")
|
||||||
local is_50 = nssb.is_50
|
local is_50 = nssb.is_50
|
||||||
|
|
||||||
nssb.mymapgenis = tonumber(minetest.settings:get("mymapgenis")) or 7
|
nssb.mymapgenis = tonumber(minetest.settings:get("mymapgenis")) or 7
|
||||||
|
@ -6,11 +7,13 @@ if nssb.mymapgenis ~= 6 and nssb.mymapgenis ~= 7 then
|
||||||
nssb.mymapgenis = 7
|
nssb.mymapgenis = 7
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get gneration level from settings
|
-- mapgen limits check from minetest
|
||||||
|
local mapgen_limit = tonumber(minetest.settings:get("mapgen_limit")) or 31000
|
||||||
|
|
||||||
|
-- get generation level from settings
|
||||||
local level = tonumber(minetest.settings:get("nssb.morlendor_level")) or -30000
|
local level = tonumber(minetest.settings:get("nssb.morlendor_level")) or -30000
|
||||||
|
|
||||||
-- schematics generation
|
-- schematics generation
|
||||||
|
|
||||||
local posplace = {x = 0, y = level - 93, z = 0}
|
local posplace = {x = 0, y = level - 93, z = 0}
|
||||||
local posmemory = {x = 0, y = level - 92, z = 0}
|
local posmemory = {x = 0, y = level - 92, z = 0}
|
||||||
local postest = {x = 5, y = level - 91, z = 6}
|
local postest = {x = 5, y = level - 91, z = 6}
|
||||||
|
@ -19,6 +22,30 @@ local postest = {x = 5, y = level - 91, z = 6}
|
||||||
local oretype_morlan_layer
|
local oretype_morlan_layer
|
||||||
if is_50 then oretype_morlan_layer = "stratum" else oretype_morlan_layer = "scatter" end
|
if is_50 then oretype_morlan_layer = "stratum" else oretype_morlan_layer = "scatter" end
|
||||||
|
|
||||||
|
-- mapgen limit must be at least enought before any check
|
||||||
|
if mapgen_limit < 400 then error("[nssb] the map limit is too low, there's no space for morlendor") end
|
||||||
|
|
||||||
|
-- morlendor must be inside the limits, but not almost the limit of the world, and must be almost 320 levels
|
||||||
|
level_amount_and_limit = math.abs(mapgen_limit) - math.abs(level)
|
||||||
|
|
||||||
|
while level_amount_and_limit <= 320 do
|
||||||
|
|
||||||
|
level = (math.abs(level) - math.abs(level_amount_and_limit) - 1) * -1
|
||||||
|
level_amount_and_limit = math.abs(mapgen_limit) - math.abs(level)
|
||||||
|
|
||||||
|
minetest.log("error", "[nssb] incompatible morlendor level, autosetting: ".. level)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- detection of nether deep floor, mordenlor must be below more than player things, cos has industructible layer
|
||||||
|
if nethermod then
|
||||||
|
|
||||||
|
local nether_df = math.abs(tonumber(minetest.settings:get("nether_depth_ymax")) or -11000)
|
||||||
|
|
||||||
|
if ( math.abs(nether_df) >= math.abs(level) + 1000 ) then
|
||||||
|
error("[nssb] morlendor level conflicts with nether, unable to fix, check your settings")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function nssb_register_buildings(
|
function nssb_register_buildings(
|
||||||
build, -- name of the schematic
|
build, -- name of the schematic
|
||||||
rand, -- 1/rand is the probability of the spawning of the schematic if the place found is acceptable
|
rand, -- 1/rand is the probability of the spawning of the schematic if the place found is acceptable
|
||||||
|
|
Loading…
Reference in New Issue