Remove humidity noise. 4 biomes. Shallower oceans. Lava cores for planet and cube. More terrain roughness variation
This commit is contained in:
parent
859ca47ab4
commit
7552d52382
18
README.txt
18
README.txt
@ -1,18 +1,4 @@
|
|||||||
flexrealm 0.5.0 by paramat
|
flexrealm 0.5.1 by paramat
|
||||||
For Minetest 0.4.14 and later
|
For Minetest 0.4.13 and later
|
||||||
Depends default
|
Depends default
|
||||||
Licenses: code WTFPL, textures CC BY-SA
|
Licenses: code WTFPL, textures CC BY-SA
|
||||||
|
|
||||||
Version changes:
|
|
||||||
|
|
||||||
Make nodes not attached to avoid falling grasses.
|
|
||||||
Fewer octaves for heat/humidity.
|
|
||||||
Remove rivers.
|
|
||||||
Noise buffer optimisation.
|
|
||||||
Improve code style.
|
|
||||||
Reduce number of upvalues.
|
|
||||||
Remove generation limits.
|
|
||||||
Add flowers to grassland.
|
|
||||||
Remove non-rotatable plantlike nodes, use defualt nodes.
|
|
||||||
Remove swampwater/papyrus.
|
|
||||||
|
|
||||||
|
173
functions.lua
173
functions.lua
@ -120,122 +120,6 @@ function flexrealm_appletree(x, y, z, nodrot, area, data, p2data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_pinetree(x, y, z, nodrot, area, data, p2data)
|
|
||||||
local c_tree = minetest.get_content_id("default:pinetree")
|
|
||||||
local c_needles = minetest.get_content_id("flexrealm:pine_needles")
|
|
||||||
local c_snowblock = minetest.get_content_id("default:snowblock")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_jungletree(x, y, z, nodrot, area, data, p2data)
|
|
||||||
local c_juntree = minetest.get_content_id("default:jungletree")
|
|
||||||
local c_junleaf = minetest.get_content_id("flexrealm:jungleleaves")
|
|
||||||
if nodrot == 12 then
|
|
||||||
for i = -4, 17 do
|
|
||||||
if i == 11 or i == 12 or i == 16 or i == 17 then
|
|
||||||
for j = -2, 2 do
|
|
||||||
for k = -2, 2 do
|
|
||||||
local vil = area:index(x + i, y + j, z + k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x + i, y, z)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
elseif nodrot == 16 then
|
|
||||||
for i = -4, 17 do
|
|
||||||
if i == 11 or i == 12 or i == 16 or i == 17 then
|
|
||||||
for j = -2, 2 do
|
|
||||||
for k = -2, 2 do
|
|
||||||
local vil = area:index(x - i, y + j, z + k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x - i, y, z)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
elseif nodrot == 0 then
|
|
||||||
for j = -4, 17 do
|
|
||||||
if j == 11 or j == 12 or j == 16 or j == 17 then
|
|
||||||
for i = -2, 2 do
|
|
||||||
for k = -2, 2 do
|
|
||||||
local vil = area:index(x + i, y + j, z + k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x, y + j, z)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
elseif nodrot == 20 then
|
|
||||||
for j = -4, 17 do
|
|
||||||
if j == 11 or j == 12 or j == 16 or j == 17 then
|
|
||||||
for i = -2, 2 do
|
|
||||||
for k = -2, 2 do
|
|
||||||
local vil = area:index(x + i, y - j, z + k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x, y - j, z)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
elseif nodrot == 4 then
|
|
||||||
for k = -4, 17 do
|
|
||||||
if k == 11 or k == 12 or k == 16 or k == 17 then
|
|
||||||
for i = -2, 2 do
|
|
||||||
for j = -2, 2 do
|
|
||||||
local vil = area:index(x + i, y + j, z + k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x, y, z + k)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
elseif nodrot == 8 then
|
|
||||||
for k = -4, 17 do
|
|
||||||
if k == 11 or k == 12 or k == 16 or k == 17 then
|
|
||||||
for i = -2, 2 do
|
|
||||||
for j = -2, 2 do
|
|
||||||
local vil = area:index(x + i, y + j, z - k)
|
|
||||||
if math.random(4) ~= 2 then
|
|
||||||
data[vil] = c_junleaf
|
|
||||||
p2data[vil] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local vit = area:index(x, y, z - k)
|
|
||||||
data[vit] = c_juntree
|
|
||||||
p2data[vit] = nodrot
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_grass(x, y, z, nodrot, area, data, p2data)
|
function flexrealm_grass(x, y, z, nodrot, area, data, p2data)
|
||||||
local c_grass1 = minetest.get_content_id("default:grass_1")
|
local c_grass1 = minetest.get_content_id("default:grass_1")
|
||||||
local c_grass2 = minetest.get_content_id("default:grass_2")
|
local c_grass2 = minetest.get_content_id("default:grass_2")
|
||||||
@ -291,63 +175,6 @@ function flexrealm_dryshrub(x, y, z, nodrot, area, data, p2data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_jungrass(x, y, z, nodrot, area, data, p2data)
|
|
||||||
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
|
||||||
local via
|
|
||||||
if nodrot == 12 then
|
|
||||||
via = area:index(x + 1, y, z)
|
|
||||||
elseif nodrot == 16 then
|
|
||||||
via = area:index(x - 1, y, z)
|
|
||||||
elseif nodrot == 0 then
|
|
||||||
via = area:index(x , y + 1, z)
|
|
||||||
elseif nodrot == 20 then
|
|
||||||
via = area:index(x , y - 1, z)
|
|
||||||
elseif nodrot == 4 then
|
|
||||||
via = area:index(x , y , z + 1)
|
|
||||||
elseif nodrot == 8 then
|
|
||||||
via = area:index(x , y , z - 1)
|
|
||||||
end
|
|
||||||
data[via] = c_jungrass
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_papyrus(x, y, z, nodrot, area, data, p2data)
|
|
||||||
local c_papyrus = minetest.get_content_id("default:papyrus")
|
|
||||||
local ph = math.random(2, 5)
|
|
||||||
if nodrot == 12 then
|
|
||||||
for i = 1, ph do
|
|
||||||
local vip = area:index(x + i, y, z)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
elseif nodrot == 16 then
|
|
||||||
for i = 1, ph do
|
|
||||||
local vip = area:index(x - i, y, z)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
elseif nodrot == 0 then
|
|
||||||
for j = 1, ph do
|
|
||||||
local vip = area:index(x, y + j, z)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
elseif nodrot == 20 then
|
|
||||||
for j = 1, ph do
|
|
||||||
local vip = area:index(x, y - j, z)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
elseif nodrot == 4 then
|
|
||||||
for k = 1, ph do
|
|
||||||
local vip = area:index(x, y, z + k)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
elseif nodrot == 8 then
|
|
||||||
for k = 1, ph do
|
|
||||||
local vip = area:index(x, y, z - k)
|
|
||||||
data[vip] = c_papyrus
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function flexrealm_flower(x, y, z, nodrot, area, data, p2data)
|
function flexrealm_flower(x, y, z, nodrot, area, data, p2data)
|
||||||
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
||||||
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
||||||
|
117
init.lua
117
init.lua
@ -20,21 +20,21 @@ local VERTZ = 0 -- Surface z
|
|||||||
local SPHEX = 0 -- Centre x
|
local SPHEX = 0 -- Centre x
|
||||||
local SPHEZ = 0 -- ..z
|
local SPHEZ = 0 -- ..z
|
||||||
local SPHEY = 0 -- ..y
|
local SPHEY = 0 -- ..y
|
||||||
local SPHER = 2048 -- Surface radius
|
local SPHER = 512 -- Surface radius
|
||||||
-- Tube world
|
-- Tube world
|
||||||
local TUBEZ = 0 -- Axis z
|
local TUBEZ = 0 -- Axis z
|
||||||
local TUBEY = 0 -- ..y
|
local TUBEY = 0 -- ..y
|
||||||
local TUBER = 128 -- Surface radius
|
local TUBER = 256 -- Surface radius
|
||||||
local TUBEX = 4000 -- Endcap base +-x
|
local TUBEX = 4000 -- Endcap base +-x
|
||||||
local TUBED = 128 -- Endcap dish depth
|
local TUBED = 256 -- Endcap dish depth
|
||||||
-- Planet cube and dyson cube
|
-- Planet cube and dyson cube
|
||||||
local CUBEX = 0 -- Centre x
|
local CUBEX = 0 -- Centre x
|
||||||
local CUBEZ = 0 -- ..z
|
local CUBEZ = 0 -- ..z
|
||||||
local CUBEY = 0 -- ..y
|
local CUBEY = 0 -- ..y
|
||||||
local CUBER = 128 -- Surface radius
|
local CUBER = 256 -- Surface radius
|
||||||
|
|
||||||
-- Noise thresholds for density gradient 'grad'
|
-- Noise thresholds for density gradient 'grad'
|
||||||
local DEPT = 2 -- Realm +-depth density threshold
|
local TLAVA = 4 -- Lava core density threshold
|
||||||
local ROCK = -1 -- Rocky terrain density threshold
|
local ROCK = -1 -- Rocky terrain density threshold
|
||||||
local CLOLOT = -0.9 -- Cloud low density threshold
|
local CLOLOT = -0.9 -- Cloud low density threshold
|
||||||
local CLOHIT = -0.89 -- Cloud high density threshold
|
local CLOHIT = -0.89 -- Cloud high density threshold
|
||||||
@ -42,7 +42,7 @@ local CLOHIT = -0.89 -- Cloud high density threshold
|
|||||||
local TSAND = -0.04 -- Sand density threshold
|
local TSAND = -0.04 -- Sand density threshold
|
||||||
local TSTONE = 0.1 -- Stone density threshold at sea level
|
local TSTONE = 0.1 -- Stone density threshold at sea level
|
||||||
local TDIRT = 0.05 -- Dirt density threshold
|
local TDIRT = 0.05 -- Dirt density threshold
|
||||||
local TSURF = 0.1 -- Surface density threshold for flora generation
|
local TSURF = 0.03 -- Surface density threshold for flora generation
|
||||||
|
|
||||||
-- Other parameters
|
-- Other parameters
|
||||||
local TFIS = 0.01 -- Fissure width noise threshold
|
local TFIS = 0.01 -- Fissure width noise threshold
|
||||||
@ -53,16 +53,13 @@ local flora = {
|
|||||||
APPCHA = 128, -- Apple tree maximum 1/x chance per surface node
|
APPCHA = 128, -- Apple tree maximum 1/x chance per surface node
|
||||||
FLOCHA = 64, -- Flower 1/x chance per surface node
|
FLOCHA = 64, -- Flower 1/x chance per surface node
|
||||||
GRACHA = 8, -- Grass 1/x chance per surface node
|
GRACHA = 8, -- Grass 1/x chance per surface node
|
||||||
PINCHA = 128, -- Pine tree maximum 1/x chance per surface node
|
|
||||||
JUTCHA = 32, -- Jungle tree maximum 1/x chance per surface node
|
|
||||||
JUGCHA = 8, -- Jungle grass maximum 1/x chance per surface node
|
|
||||||
PAPCHA = 8, -- Papyrus 1/x chance per surface swamp water node
|
|
||||||
CACCHA = 256, -- Cactus 1/x chance per surface node
|
CACCHA = 256, -- Cactus 1/x chance per surface node
|
||||||
|
DSHCHA = 128, -- Dry shrub 1/x chance per surface node
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Noise parameters
|
-- Noise parameters
|
||||||
|
|
||||||
-- 3D noise for terrain
|
-- 3D noise for rough terrain
|
||||||
|
|
||||||
local np_terrain = {
|
local np_terrain = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
@ -70,14 +67,14 @@ local np_terrain = {
|
|||||||
spread = {x = 96, y = 96, z = 96},
|
spread = {x = 96, y = 96, z = 96},
|
||||||
seed = 92,
|
seed = 92,
|
||||||
octaves = 3,
|
octaves = 3,
|
||||||
persist = 0.6
|
persist = 0.67
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 3D noise for smooth terrain
|
-- 3D noise for smooth terrain
|
||||||
|
|
||||||
local np_smooth = {
|
local np_smooth = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 0.5,
|
||||||
spread = {x = 192, y = 192, z = 192},
|
spread = {x = 192, y = 192, z = 192},
|
||||||
seed = 800911,
|
seed = 800911,
|
||||||
octaves = 3,
|
octaves = 3,
|
||||||
@ -106,17 +103,6 @@ local np_temp = {
|
|||||||
persist = 0.4
|
persist = 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 3D noise for humidity
|
|
||||||
|
|
||||||
local np_humid = {
|
|
||||||
offset = 0,
|
|
||||||
scale = 1,
|
|
||||||
spread = {x = 384, y = 384, z = 384},
|
|
||||||
seed = -55500,
|
|
||||||
octaves = 2,
|
|
||||||
persist = 0.4
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 3D noise for fissures
|
-- 3D noise for fissures
|
||||||
|
|
||||||
local np_fissure = {
|
local np_fissure = {
|
||||||
@ -133,9 +119,9 @@ local np_fissure = {
|
|||||||
local np_cloud = {
|
local np_cloud = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x = 96, y = 96, z = 96},
|
spread = {x = 192, y = 192, z = 192},
|
||||||
seed = 2113,
|
seed = 2113,
|
||||||
octaves = 3,
|
octaves = 4,
|
||||||
persist = 0.7
|
persist = 0.7
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +142,6 @@ local nobj_smooth = nil
|
|||||||
local nobj_terblen = nil
|
local nobj_terblen = nil
|
||||||
local nobj_fissure = nil
|
local nobj_fissure = nil
|
||||||
local nobj_temp = nil
|
local nobj_temp = nil
|
||||||
local nobj_humid = nil
|
|
||||||
local nobj_cloud = nil
|
local nobj_cloud = nil
|
||||||
|
|
||||||
-- Localise noise buffers
|
-- Localise noise buffers
|
||||||
@ -166,7 +151,6 @@ local nbuf_smooth
|
|||||||
local nbuf_terblen
|
local nbuf_terblen
|
||||||
local nbuf_fissure
|
local nbuf_fissure
|
||||||
local nbuf_temp
|
local nbuf_temp
|
||||||
local nbuf_humid
|
|
||||||
local nbuf_cloud
|
local nbuf_cloud
|
||||||
|
|
||||||
-- On generated function
|
-- On generated function
|
||||||
@ -217,7 +201,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
nobj_terblen = nobj_terblen or minetest.get_perlin_map(np_terblen, chulens)
|
nobj_terblen = nobj_terblen or minetest.get_perlin_map(np_terblen, chulens)
|
||||||
nobj_fissure = nobj_fissure or minetest.get_perlin_map(np_fissure, chulens)
|
nobj_fissure = nobj_fissure or minetest.get_perlin_map(np_fissure, chulens)
|
||||||
nobj_temp = nobj_temp or minetest.get_perlin_map(np_temp, chulens)
|
nobj_temp = nobj_temp or minetest.get_perlin_map(np_temp, chulens)
|
||||||
nobj_humid = nobj_humid or minetest.get_perlin_map(np_humid, chulens)
|
|
||||||
nobj_cloud = nobj_cloud or minetest.get_perlin_map(np_cloud, chulens)
|
nobj_cloud = nobj_cloud or minetest.get_perlin_map(np_cloud, chulens)
|
||||||
|
|
||||||
local nvals_terrain = nobj_terrain:get3dMap_flat(minpos, nbuf_terrain)
|
local nvals_terrain = nobj_terrain:get3dMap_flat(minpos, nbuf_terrain)
|
||||||
@ -225,7 +208,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local nvals_terblen = nobj_terblen:get3dMap_flat(minpos, nbuf_terblen)
|
local nvals_terblen = nobj_terblen:get3dMap_flat(minpos, nbuf_terblen)
|
||||||
local nvals_fissure = nobj_fissure:get3dMap_flat(minpos, nbuf_fissure)
|
local nvals_fissure = nobj_fissure:get3dMap_flat(minpos, nbuf_fissure)
|
||||||
local nvals_temp = nobj_temp:get3dMap_flat(minpos, nbuf_temp)
|
local nvals_temp = nobj_temp:get3dMap_flat(minpos, nbuf_temp)
|
||||||
local nvals_humid = nobj_humid:get3dMap_flat(minpos, nbuf_humid)
|
|
||||||
local nvals_cloud = nobj_cloud:get3dMap_flat(minpos, nbuf_cloud)
|
local nvals_cloud = nobj_cloud:get3dMap_flat(minpos, nbuf_cloud)
|
||||||
|
|
||||||
local ni = 1
|
local ni = 1
|
||||||
@ -234,10 +216,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local vi = area:index(x0, y, z)
|
local vi = area:index(x0, y, z)
|
||||||
for x = x0, x1 do
|
for x = x0, x1 do
|
||||||
local nodid = data[vi]
|
local nodid = data[vi]
|
||||||
-- terrain blend
|
|
||||||
local n_terblen = nvals_terblen[ni]
|
|
||||||
local terblen = math.min(math.max(n_terblen + 0.5, 0), 1)
|
|
||||||
local terno = nvals_terrain[ni] * (1 - terblen) + nvals_smooth[ni] * terblen
|
|
||||||
-- noise gradient
|
-- noise gradient
|
||||||
local grad, sphexr, spheyr, sphezr, tubeyr, tubezr, cubexr, cubeyr, cubezr
|
local grad, sphexr, spheyr, sphezr, tubeyr, tubezr, cubexr, cubeyr, cubezr
|
||||||
if realm.flat then
|
if realm.flat then
|
||||||
@ -273,6 +252,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
grad = (CUBER - noddis) / TERRS
|
grad = (CUBER - noddis) / TERRS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- terrain blend
|
||||||
|
local n_terblen = nvals_terblen[ni]
|
||||||
|
local terblen = math.min(math.max(n_terblen + 0.5, 0), 1)
|
||||||
|
local terno = nvals_terrain[ni] * (1 - terblen) + nvals_smooth[ni] * terblen
|
||||||
|
if grad > 0 then -- make oceans shallower
|
||||||
|
terno = terno / 2
|
||||||
|
end
|
||||||
|
|
||||||
-- density field
|
-- density field
|
||||||
local density
|
local density
|
||||||
if realm.tube then
|
if realm.tube then
|
||||||
@ -285,40 +273,32 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
else
|
else
|
||||||
density = terno + grad
|
density = terno + grad
|
||||||
end
|
end
|
||||||
|
|
||||||
-- thin fine materials with altitude
|
-- thin fine materials with altitude
|
||||||
local tstone = TSTONE * (1 - grad / ROCK)
|
local tstone = TSTONE * (1 - grad / ROCK)
|
||||||
local altprop = math.max(1 + grad, 0)
|
local altprop = math.max(1 + grad, 0)
|
||||||
|
|
||||||
-- get biome
|
-- get biome
|
||||||
local desert = false -- desert biome
|
local desert = false -- desert biome
|
||||||
local rainforest = false -- rainforest biome
|
|
||||||
local grassland = false -- grassland biome
|
local grassland = false -- grassland biome
|
||||||
local forest = false -- deciduous forest biome
|
local forest = false -- deciduous forest biome
|
||||||
local tundra = false -- tundra biome
|
local tundra = false -- tundra biome
|
||||||
local taiga = false -- taiga forest biome
|
|
||||||
local temp = nvals_temp[ni] + grad
|
local temp = nvals_temp[ni] + grad
|
||||||
local n_humid = nvals_humid[ni]
|
|
||||||
local humid = n_humid + grad
|
|
||||||
if density > 0 or grad > 0 then -- if terrain or water calculate biome
|
if density > 0 or grad > 0 then -- if terrain or water calculate biome
|
||||||
if temp > 0.3 then
|
if temp > 0.4 then
|
||||||
if humid > 0.0 then
|
|
||||||
rainforest = true
|
|
||||||
else
|
|
||||||
desert = true
|
desert = true
|
||||||
end
|
elseif temp > 0.0 then
|
||||||
elseif temp < -0.3 then
|
grassland = true
|
||||||
if humid < 0.0 then
|
elseif temp > -0.4 then
|
||||||
tundra = true
|
|
||||||
else
|
|
||||||
taiga = true
|
|
||||||
end
|
|
||||||
elseif humid > 0.0 then
|
|
||||||
forest = true
|
forest = true
|
||||||
else
|
else
|
||||||
grassland = true
|
tundra = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- caves boolean
|
-- caves boolean
|
||||||
local nofis = math.abs(nvals_fissure[ni]) > TFIS
|
local nofis = math.abs(nvals_fissure[ni]) > TFIS
|
||||||
|
|
||||||
-- if surface node away from chunk boundary get up direction for flora
|
-- if surface node away from chunk boundary get up direction for flora
|
||||||
local surf = false
|
local surf = false
|
||||||
if density <= TSURF -- surface node
|
if density <= TSURF -- surface node
|
||||||
@ -327,6 +307,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
and z > z0 and z < z1 then
|
and z > z0 and z < z1 then
|
||||||
surf = true
|
surf = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- get up direction at point
|
||||||
-- nodrot 0 = y+, 12 = x+, 16 = x-, 4 = z+, 8 = z-, 20 = y-
|
-- nodrot 0 = y+, 12 = x+, 16 = x-, 4 = z+, 8 = z-, 20 = y-
|
||||||
local nodrot = 0
|
local nodrot = 0
|
||||||
if surf then
|
if surf then
|
||||||
@ -428,8 +410,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- mapgen
|
-- mapgen
|
||||||
if (density >= tstone and grad <= DEPT and nofis) then -- stone
|
if grad >= TLAVA and realm.planet or realm.cube then -- lava core
|
||||||
|
data[vi] = c_flrlavazero
|
||||||
|
elseif density >= tstone and nofis then -- stone
|
||||||
if (density >= 0.5 and density <= 0.55)
|
if (density >= 0.5 and density <= 0.55)
|
||||||
or (density >= 0.3 and density <= 0.4)
|
or (density >= 0.3 and density <= 0.4)
|
||||||
or (density >= 0.2 and density <= 0.25) then
|
or (density >= 0.2 and density <= 0.25) then
|
||||||
@ -457,8 +442,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
elseif density > 0 and density < tstone then -- fine materials
|
elseif density > 0 and density < tstone then -- fine materials
|
||||||
if grad >= TSAND then
|
if grad >= TSAND then
|
||||||
data[vi] = c_flrsand -- sand
|
data[vi] = c_flrsand -- sand
|
||||||
elseif nofis or (not nofis and grad > 0) then -- fine materials cut by
|
elseif nofis or (not nofis and grad > TSAND) then
|
||||||
if density >= TDIRT then -- fissures above sea level only
|
-- fine materials cut by fissures above sand level only
|
||||||
|
if density >= TDIRT then
|
||||||
if desert then
|
if desert then
|
||||||
data[vi] = c_flrdesand
|
data[vi] = c_flrdesand
|
||||||
elseif tundra then
|
elseif tundra then
|
||||||
@ -467,13 +453,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[vi] = c_flrdirt
|
data[vi] = c_flrdirt
|
||||||
end
|
end
|
||||||
else -- else surface nodes
|
else -- else surface nodes
|
||||||
if taiga then
|
if tundra then
|
||||||
if surf and math.random(flora.PINCHA) == 2 then
|
|
||||||
flexrealm_pinetree(x, y, z, nodrot, area, data, p2data)
|
|
||||||
else
|
|
||||||
data[vi] = c_snowblock
|
|
||||||
end
|
|
||||||
elseif tundra then
|
|
||||||
data[vi] = c_snowblock
|
data[vi] = c_snowblock
|
||||||
elseif forest then
|
elseif forest then
|
||||||
data[vi] = c_flrgrass
|
data[vi] = c_flrgrass
|
||||||
@ -491,18 +471,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
elseif surf and math.random(flora.FLOCHA) == 2 then
|
elseif surf and math.random(flora.FLOCHA) == 2 then
|
||||||
flexrealm_flower(x, y, z, nodrot, area, data, p2data)
|
flexrealm_flower(x, y, z, nodrot, area, data, p2data)
|
||||||
end
|
end
|
||||||
elseif rainforest then
|
|
||||||
data[vi] = c_flrgrass
|
|
||||||
if surf and math.random(flora.JUTCHA) == 2 then
|
|
||||||
flexrealm_jungletree(x, y, z, nodrot, area, data, p2data)
|
|
||||||
elseif surf and math.random(flora.JUGCHA) == 2 then
|
|
||||||
flexrealm_jungrass(x, y, z, nodrot, area, data, p2data)
|
|
||||||
end
|
|
||||||
elseif desert then
|
elseif desert then
|
||||||
|
data[vi] = c_flrdesand
|
||||||
if surf and math.random(flora.CACCHA) == 2 then
|
if surf and math.random(flora.CACCHA) == 2 then
|
||||||
flexrealm_cactus(x, y, z, nodrot, area, data, p2data)
|
flexrealm_cactus(x, y, z, nodrot, area, data, p2data)
|
||||||
else
|
elseif surf and math.random(flora.DSHCHA) == 2 then
|
||||||
data[vi] = c_flrdesand
|
flexrealm_dryshrub(x, y, z, nodrot, area, data, p2data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -520,7 +494,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local yrq = 16 * math.floor((y - y0) / 16)
|
local yrq = 16 * math.floor((y - y0) / 16)
|
||||||
local zrq = 16 * math.floor((z - z0) / 16)
|
local zrq = 16 * math.floor((z - z0) / 16)
|
||||||
local qixyz = zrq * facearea + yrq * sidelen + xrq + 1
|
local qixyz = zrq * facearea + yrq * sidelen + xrq + 1
|
||||||
if nvals_cloud[qixyz] > TCLOUD and grad < -0.895 + n_humid * 0.005 then
|
if nvals_cloud[qixyz] > TCLOUD then
|
||||||
data[vi] = c_flrcloud
|
data[vi] = c_flrcloud
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -535,7 +509,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
vm:set_param2_data(p2data)
|
vm:set_param2_data(p2data)
|
||||||
vm:calc_lighting()
|
vm:calc_lighting()
|
||||||
vm:write_to_map(data)
|
vm:write_to_map(data)
|
||||||
vm:update_liquids()
|
|
||||||
|
|
||||||
local chugent = math.ceil((os.clock() - t0) * 1000)
|
local chugent = math.ceil((os.clock() - t0) * 1000)
|
||||||
print ("[flexrealm] " .. chugent)
|
print ("[flexrealm] " .. chugent)
|
||||||
|
27
nodes.lua
27
nodes.lua
@ -62,6 +62,7 @@ minetest.register_node("flexrealm:cloud", {
|
|||||||
pointable = false,
|
pointable = false,
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
|
floodable = true,
|
||||||
post_effect_color = {a = 23, r = 241, g = 248, b = 255},
|
post_effect_color = {a = 23, r = 241, g = 248, b = 255},
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1},
|
||||||
})
|
})
|
||||||
@ -78,30 +79,6 @@ minetest.register_node("flexrealm:leaves", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("flexrealm:jungleleaves", {
|
|
||||||
description = "Flexrealm Jungle Leaves",
|
|
||||||
drawtype = "allfaces_optional",
|
|
||||||
waving = 1,
|
|
||||||
visual_scale = 1.3,
|
|
||||||
tiles = {"default_jungleleaves.png"},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("flexrealm:pine_needles",{
|
|
||||||
description = "Flexrealm Pine Needles",
|
|
||||||
drawtype = "allfaces_optional",
|
|
||||||
visual_scale = 1.3,
|
|
||||||
tiles = {"default_pine_needles.png"},
|
|
||||||
waving = 1,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("flexrealm:cactus", {
|
minetest.register_node("flexrealm:cactus", {
|
||||||
description = "Flexrealm Cactus",
|
description = "Flexrealm Cactus",
|
||||||
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
|
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
|
||||||
@ -178,5 +155,5 @@ minetest.register_node("flexrealm:lavazero", {
|
|||||||
liquid_range = 0,
|
liquid_range = 0,
|
||||||
damage_per_second = 8,
|
damage_per_second = 8,
|
||||||
post_effect_color = {a = 192, r = 255, g = 64, b = 0},
|
post_effect_color = {a = 192, r = 255, g = 64, b = 0},
|
||||||
groups = {lava = 3, liquid = 2, hot = 3, igniter = 1},
|
groups = {lava = 3, liquid = 2, igniter = 1},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user