4 3D noises: 2 tunnel systems + 1 magma system. Biomes rotate noises create dead ends. Bugfixes
This commit is contained in:
parent
39380d29d2
commit
59d4119e35
@ -1,4 +1,4 @@
|
|||||||
intersecting 0.3.0 by paramat
|
intersecting 0.3.1 by paramat
|
||||||
For latest stable Minetest back to 0.4.8
|
For latest stable Minetest back to 0.4.8
|
||||||
Depends default
|
Depends default
|
||||||
Licenses: code WTFPL
|
Licenses: code WTFPL
|
||||||
|
47
init.lua
47
init.lua
@ -1,8 +1,12 @@
|
|||||||
-- intersecting 0.3.0 by paramat
|
-- intersecting 0.3.1 by paramat
|
||||||
-- For latest stable Minetest and back to 0.4.8
|
-- For latest stable Minetest and back to 0.4.8
|
||||||
-- Depends default
|
-- Depends default
|
||||||
-- License: code WTFPL
|
-- License: code WTFPL
|
||||||
|
|
||||||
|
-- 4 3D noises: 2 tunnel systems + 1 magma system
|
||||||
|
-- biomes rotate noises, create dead ends
|
||||||
|
-- bugfixes
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local TFIS = 0.02 -- Fissure and tunnel width
|
local TFIS = 0.02 -- Fissure and tunnel width
|
||||||
@ -53,6 +57,17 @@ local np_webd = {
|
|||||||
persist = 0.5
|
persist = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- 3D noise for biomes
|
||||||
|
|
||||||
|
local np_biome = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=384, y=384, z=384},
|
||||||
|
seed = 89114,
|
||||||
|
octaves = 1,
|
||||||
|
persist = 0
|
||||||
|
}
|
||||||
|
|
||||||
-- Stuff
|
-- Stuff
|
||||||
|
|
||||||
intersecting = {}
|
intersecting = {}
|
||||||
@ -158,6 +173,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local nvals_webb = minetest.get_perlin_map(np_webb, chulens):get3dMap_flat(minposxyz)
|
local nvals_webb = minetest.get_perlin_map(np_webb, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_webc = minetest.get_perlin_map(np_webc, chulens):get3dMap_flat(minposxyz)
|
local nvals_webc = minetest.get_perlin_map(np_webc, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_webd = minetest.get_perlin_map(np_webd, chulens):get3dMap_flat(minposxyz)
|
local nvals_webd = minetest.get_perlin_map(np_webd, chulens):get3dMap_flat(minposxyz)
|
||||||
|
local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get3dMap_flat(minposxyz)
|
||||||
|
|
||||||
local cavbel = {}
|
local cavbel = {}
|
||||||
local stobel = {}
|
local stobel = {}
|
||||||
@ -182,21 +198,32 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
or nodidw == c_water or nodide == c_water or nodidn == c_water or nodids == c_water
|
or nodidw == c_water or nodide == c_water or nodidn == c_water or nodids == c_water
|
||||||
local surfmat = (nodid == c_sand or nodid == c_dirt or nodid == c_grass) and y <= 2
|
local surfmat = (nodid == c_sand or nodid == c_dirt or nodid == c_grass) and y <= 2
|
||||||
if nodid ~= c_air then
|
if nodid ~= c_air then
|
||||||
local weba = math.abs(nvals_weba[nixyz]) < TFIS -- solid or liquid
|
local weba = math.abs(nvals_weba[nixyz]) < TFIS
|
||||||
local webb = math.abs(nvals_webb[nixyz]) < TFIS
|
local webb = math.abs(nvals_webb[nixyz]) < TFIS
|
||||||
local webc = math.abs(nvals_webc[nixyz]) < TFIS
|
local webc = math.abs(nvals_webc[nixyz]) < TFIS
|
||||||
local webd = math.abs(nvals_webd[nixyz]) < TFIS
|
local webd = math.abs(nvals_webd[nixyz]) < TFIS
|
||||||
local tunnel = (weba and webb) or (webb and webc) or (webc and webd)
|
local n_biome = nvals_biome[nixyz]
|
||||||
local magma = webc and webd
|
local tunnel
|
||||||
if tunnel then
|
local magma
|
||||||
cavbel[ti] = 1
|
if n_biome < -0.3 then
|
||||||
stobel[ti] = 0
|
tunnel = (weba and webb) or (webb and webc)
|
||||||
|
magma = (webc and webd)
|
||||||
|
elseif n_biome < 0.3 then
|
||||||
|
tunnel = (webb and webc) or (weba and webc)
|
||||||
|
magma = (webc and webd)
|
||||||
|
else
|
||||||
|
tunnel = (weba and webc) or (weba and webb)
|
||||||
|
magma = (webc and webd)
|
||||||
|
end
|
||||||
|
if tunnel or magma then
|
||||||
if magma then -- magma tunnel
|
if magma then -- magma tunnel
|
||||||
if y <= 1 then
|
if y <= 1 then
|
||||||
data[vi] = c_lava
|
data[vi] = c_lava
|
||||||
else
|
else
|
||||||
data[vi] = c_air
|
data[vi] = c_air
|
||||||
end
|
end
|
||||||
|
cavbel[ti] = 1
|
||||||
|
stobel[ti] = 0
|
||||||
elseif (nodid == c_water or watadj) and cavbel[ti] == 1 then
|
elseif (nodid == c_water or watadj) and cavbel[ti] == 1 then
|
||||||
for j = -1, -16, -1 do -- water plug
|
for j = -1, -16, -1 do -- water plug
|
||||||
local vip = area:index(x, y+j, z)
|
local vip = area:index(x, y+j, z)
|
||||||
@ -204,8 +231,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[vip] = c_stone
|
data[vip] = c_stone
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
cavbel[ti] = 0
|
||||||
|
stobel[ti] = 0
|
||||||
elseif nodid ~= c_water and not surfmat and not watadj then
|
elseif nodid ~= c_water and not surfmat and not watadj then
|
||||||
data[vi] = c_air -- tunnel
|
data[vi] = c_air -- tunnel
|
||||||
|
cavbel[ti] = 1
|
||||||
|
stobel[ti] = 0
|
||||||
end
|
end
|
||||||
if nodid == c_tree or nodid == c_jtree then -- if trunk cut remove whole trunk
|
if nodid == c_tree or nodid == c_jtree then -- if trunk cut remove whole trunk
|
||||||
for j = -12, 12 do
|
for j = -12, 12 do
|
||||||
@ -218,12 +249,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
else -- solid or liquid
|
else -- solid or liquid
|
||||||
cavbel[ti] = 0
|
cavbel[ti] = 0
|
||||||
if nodid == c_stone or nodid == c_desertstone then
|
if nodid == c_stone or nodid == c_desertstone then
|
||||||
stobel[ti] = 1
|
|
||||||
if LUX then
|
if LUX then
|
||||||
if math.random() < LUXCHA and stobel[ti] == 1 and y > y0 then
|
if math.random() < LUXCHA and stobel[ti] == 1 and y > y0 then
|
||||||
data[vi] = c_luxore
|
data[vi] = c_luxore
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
stobel[ti] = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else -- nodid == c_air
|
else -- nodid == c_air
|
||||||
|
Loading…
x
Reference in New Issue
Block a user