Simple boulders return. Compressed snow on paths. New snowypines. Add humidity from water distance. Re-add grass noise. Vary acaciatree height. 7 biomes
@ -1,4 +1,4 @@
|
||||
riverdev 0.5.6 by paramat
|
||||
riverdev 0.5.7 by paramat
|
||||
For latest stable Minetest back to 0.4.8
|
||||
Depends default
|
||||
Licenses: code WTFPL
|
||||
|
177
functions.lua
@ -89,61 +89,64 @@ function riverdev_snowypine(x, y, z, area, data)
|
||||
local c_snowblock = minetest.get_content_id("default:snowblock")
|
||||
for j = -4, 14 do
|
||||
if j == 3 or j == 6 or j == 9 or j == 12 then
|
||||
for i = -2, 2 do
|
||||
for k = -2, 2 do
|
||||
if math.abs(i) == 2 or math.abs(k) == 2 then
|
||||
if math.random(7) ~= 2 then
|
||||
local vil = area:index(x + i, y + j, z + k)
|
||||
data[vil] = c_needles
|
||||
local vila = area:index(x + i, y + j + 1, z + k)
|
||||
data[vila] = c_snowblock
|
||||
local vi = area:index(x - 2, y + j, z + k)
|
||||
local via = area:index(x - 2, y + j + 1, z + k)
|
||||
for i = -2, 2 do
|
||||
if math.abs(i) == 1 and math.abs(k) == 1 then
|
||||
data[vi] = c_pinetree
|
||||
elseif math.abs(i) + math.abs(k) == 2
|
||||
or math.abs(i) + math.abs(k) == 3 then
|
||||
data[vi] = c_needles
|
||||
data[via] = c_snowblock
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif j == 4 or j == 7 or j == 10 then
|
||||
for i = -1, 1 do
|
||||
elseif j == 4 or j == 7 or j == 10 or j == 13 then
|
||||
for k = -1, 1 do
|
||||
if not (i == 0 and j == 0) then
|
||||
if math.random(11) ~= 2 then
|
||||
local vil = area:index(x + i, y + j, z + k)
|
||||
data[vil] = c_needles
|
||||
local vila = area:index(x + i, y + j + 1, z + k)
|
||||
data[vila] = c_snowblock
|
||||
local vi = area:index(x - 1, y + j, z + k)
|
||||
local via = area:index(x - 1, y + j + 1, z + k)
|
||||
for i = -1, 1 do
|
||||
if not (i == 0 and j == 0) then
|
||||
data[vi] = c_needles
|
||||
data[via] = c_snowblock
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif j == 13 then
|
||||
for i = -1, 1 do
|
||||
elseif j == 14 then
|
||||
for k = -1, 1 do
|
||||
if not (i == 0 and j == 0) then
|
||||
local vil = area:index(x + i, y + j, z + k)
|
||||
data[vil] = c_needles
|
||||
local vila = area:index(x + i, y + j + 1, z + k)
|
||||
data[vila] = c_needles
|
||||
local vilaa = area:index(x + i, y + j + 2, z + k)
|
||||
data[vilaa] = c_snowblock
|
||||
local vi = area:index(x - 1, y + j, z + k)
|
||||
local via = area:index(x - 1, y + j + 1, z + k)
|
||||
for i = -1, 1 do
|
||||
if math.abs(i) + math.abs(k) == 1 then
|
||||
data[vi] = c_needles
|
||||
data[via] = c_snowblock
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local vit = area:index(x, y + j, z)
|
||||
data[vit] = c_pinetree
|
||||
local vi = area:index(x, y + j, z)
|
||||
data[vi] = c_pinetree
|
||||
end
|
||||
local vil = area:index(x, y + 15, z)
|
||||
local vila = area:index(x, y + 16, z)
|
||||
local vilaa = area:index(x, y + 17, z)
|
||||
data[vil] = c_needles
|
||||
data[vila] = c_needles
|
||||
data[vilaa] = c_snowblock
|
||||
local vi = area:index(x, y + 15, z)
|
||||
local via = area:index(x, y + 16, z)
|
||||
local viaa = area:index(x, y + 17, z)
|
||||
data[vi] = c_needles
|
||||
data[via] = c_needles
|
||||
data[viaa] = c_snowblock
|
||||
end
|
||||
|
||||
function riverdev_jungletree(x, y, z, area, data, y1)
|
||||
local c_juntree = minetest.get_content_id("default:jungletree")
|
||||
local c_junleaf = minetest.get_content_id("riverdev:jungleleaf")
|
||||
local c_vine = minetest.get_content_id("riverdev:vine")
|
||||
local top = math.min(math.random(17,23), y1 +16 - y) -- avoid chopped trees
|
||||
local top = math.random(13, math.min(y1 + 16 - y, 23)) -- avoid chopped trees
|
||||
local branch = math.floor(top * 0.6)
|
||||
for j = -5, top do
|
||||
if j == top or j == top - 1 or j == branch + 1 or j == branch + 2 then
|
||||
@ -182,35 +185,70 @@ function riverdev_jungletree(x, y, z, area, data, y1)
|
||||
end
|
||||
end
|
||||
|
||||
function riverdev_boulder(x, y, z, area, data)
|
||||
local np_boulder = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=16, y=16, z=16},
|
||||
seed = 5933,
|
||||
octaves = 2,
|
||||
persist = 0.67
|
||||
}
|
||||
local chulens = {x=17, y=17, z=17}
|
||||
local minpos = {x=x-8, y=y-8, z=z-8}
|
||||
local nvals_boulder = minetest.get_perlin_map(np_boulder, chulens):get3dMap_flat(minpos)
|
||||
local c_boulder
|
||||
if math.random() < 0.2 then
|
||||
c_boulder = minetest.get_content_id("default:sandstone")
|
||||
else
|
||||
c_boulder = minetest.get_content_id("riverdev:stone")
|
||||
function riverdev_acaciatree(x, y, z, area, data)
|
||||
local c_actree = minetest.get_content_id("riverdev:acaciatree")
|
||||
local c_acleaf = minetest.get_content_id("riverdev:acacialeaf")
|
||||
local top = 4 + math.random(3)
|
||||
for j = -3, top do
|
||||
if j == top then
|
||||
for i = -4, 4 do
|
||||
for k = -4, 4 do
|
||||
if not (i == 0 or k == 0) then
|
||||
if math.random(7) ~= 2 then
|
||||
local vi = area:index(x + i, y + j, z + k)
|
||||
data[vi] = c_acleaf
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif j == top - 1 then
|
||||
for i = -2, 2, 4 do
|
||||
for k = -2, 2, 4 do
|
||||
local vi = area:index(x + i, y + j, z + k)
|
||||
data[vi] = c_actree
|
||||
end
|
||||
end
|
||||
elseif j == top - 2 then
|
||||
for i = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
if math.abs(i) + math.abs(k) == 2 then
|
||||
local vi = area:index(x + i, y + j, z + k)
|
||||
data[vi] = c_actree
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local vi = area:index(x, y + j, z)
|
||||
data[vi] = c_actree
|
||||
end
|
||||
end
|
||||
local avrad = 2 + math.random() * 3
|
||||
local ni = 1
|
||||
end
|
||||
|
||||
function riverdev_cactus(x, y, z, area, data)
|
||||
local c_cactus = minetest.get_content_id("riverdev:cactus")
|
||||
for j = -2, 4 do
|
||||
for i = -2, 2 do
|
||||
if i == 0 or j == 2 or (j == 3 and math.abs(i) == 2) then
|
||||
local vic = area:index(x + i, y + j, z)
|
||||
data[vic] = c_cactus
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function riverdev_boulder(x, y, z, area, data)
|
||||
local c_stone = minetest.get_content_id("riverdev:stone")
|
||||
local dx = math.random() * 15 + 1
|
||||
local dy = math.random() * 15 + 1
|
||||
local dz = math.random() * 15 + 1
|
||||
for k = -8, 8 do
|
||||
for j = -8, 8 do
|
||||
local vi = area:index(x-8, y+j, z+k)
|
||||
for i = -8, 8 do
|
||||
if (i ^ 2 + j ^ 2 + k ^ 2) ^ 0.5 < avrad * (1 + nvals_boulder[ni] * 0.7) then
|
||||
data[vi] = c_boulder
|
||||
if (i ^ 2 * dx + j ^ 2 * dy + k ^ 2 * dz) ^ 0.5 < 8 then
|
||||
data[vi] = c_stone
|
||||
end
|
||||
vi = vi + 1
|
||||
ni = ni + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -316,6 +354,29 @@ minetest.register_abm({
|
||||
end,
|
||||
})
|
||||
|
||||
-- Acacia sapling
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"riverdev:acacialing"},
|
||||
interval = 61,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local pos1 = {x=x-4, y=y-3, z=z-4}
|
||||
local pos2 = {x=x+4, y=y+7, z=z+4}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local data = vm:get_data()
|
||||
riverdev_acaciatree(x, y, z, area, data)
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set mapgen parameters
|
||||
|
||||
minetest.register_on_mapgen_init(function(mgparams)
|
||||
|
183
init.lua
@ -1,22 +1,20 @@
|
||||
-- riverdev 0.5.6 by paramat
|
||||
-- riverdev 0.5.7 by paramat
|
||||
-- For latest stable Minetest and back to 0.4.8
|
||||
-- Depends default
|
||||
-- License: code WTFPL
|
||||
|
||||
-- remove tunnel expansion
|
||||
-- add caves using 5 noises
|
||||
-- jungletrees auto-limit height to avoid chop
|
||||
-- add fissures
|
||||
-- 3d noise boulders, some sandstone
|
||||
-- return to simple boulders
|
||||
-- compressed snow on paths in taiga
|
||||
-- update snowypines
|
||||
-- add humidity noise from water distance
|
||||
-- re-add long grasses noise
|
||||
-- vary acaciatree height
|
||||
-- add biomes
|
||||
-- TODO
|
||||
-- regeneration command: use of mapgen loop function
|
||||
-- update snowypines
|
||||
-- coloured stone: desertstone orange sandstone green blue violet
|
||||
-- inclined strata with 3d biomes of coloured stone mixes
|
||||
-- ores in strata
|
||||
-- add humidity from water distance
|
||||
-- add all watershed biomes
|
||||
-- gravel in tunnels/caves
|
||||
|
||||
-- Parameters
|
||||
|
||||
@ -24,7 +22,7 @@ local YMIN = -33000 -- Y limits of realm generation
|
||||
local YMAX = 1024
|
||||
local YWATER = 1 -- Water surface y
|
||||
local YSAND = 4 -- Top of beach y
|
||||
local YTER = -92 -- Deepest seabed y
|
||||
local YTER = -64 -- Deepest seabed y
|
||||
local YPINE = 47 -- Pines above this y
|
||||
|
||||
local TERSCA = 512 -- Terrain vertical scale in nodes
|
||||
@ -43,15 +41,21 @@ local TOBS = 0.025 -- Obsidian tube width
|
||||
|
||||
local ORECHA = 1 / 5 ^ 3 -- Ore chance per stone node
|
||||
-- 1 / n ^ 3 where n = average distance between ores
|
||||
local BOLCHA = 1 / 32 ^ 2 -- Boulder maximum chance per grass node.
|
||||
-- 1 / n ^ 2 where n = average minimum distance between flora
|
||||
local APPCHA = 1 / 5 ^ 2 -- Appletree maximum chance per grass node
|
||||
local PINCHA = 1 / 6 ^ 2 -- Pinetree maximum chance per grass node
|
||||
local JUNCHA = 1 / 4 ^ 2 -- Jungletree maximum chance per grass node
|
||||
local GRACHA = 1 / 5 ^ 2 -- Grasses maximum chance per grass node
|
||||
local FLOCHA = 1 / 61 ^ 2 -- Flower chance per grass node
|
||||
local LOTET = -0.4 -- Low temperature threshold for taiga/snowyplains
|
||||
local HITET = 0.4 -- High temperature threshold for Rainforest
|
||||
local BOLCHA = 1 / 127 ^ 2 -- Boulder maximum chance per surface node
|
||||
-- 1 / n ^ 2 where n = average distance between features
|
||||
local APPCHA = 1 / 5 ^ 2 -- Appletree maximum chance per node
|
||||
local PINCHA = 1 / 6 ^ 2 -- Pinetree maximum chance per node
|
||||
local JUNCHA = 1 / 4 ^ 2 -- Jungletree maximum chance per node
|
||||
local ACACHA = 1 / 47 ^ 2 -- Acaciatree maximum chance per node
|
||||
local GRACHA = 1 / 4 ^ 2 -- Grasses maximum chance per node
|
||||
local FLOCHA = 1 / 37 ^ 2 -- Flower chance per node
|
||||
local CACCHA = 1 / 73 ^ 2 -- Cactus chance per node
|
||||
|
||||
local LOTET = -0.4 -- Low temperature threshold
|
||||
local HITET = 0.4 -- High
|
||||
local LOHUT = -0.4 -- Low humidity threshold
|
||||
local MIDHUT = 0 -- Mid
|
||||
local HIHUT = 0.4 -- High
|
||||
|
||||
-- 3D noise for highland terrain
|
||||
|
||||
@ -64,18 +68,18 @@ local np_terrain = {
|
||||
persist = 0.67
|
||||
}
|
||||
|
||||
-- 2D noise for mid terrain / river
|
||||
-- 2D noise for mid terrain / river / humidity
|
||||
|
||||
local np_mid = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=768, y=768, z=768},
|
||||
spread = {x=1536, y=1536, z=1536},
|
||||
seed = 85546,
|
||||
octaves = 5,
|
||||
octaves = 6,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 2D noise for base terrain
|
||||
-- 2D noise for base terrain / humidity
|
||||
|
||||
local np_base = {
|
||||
offset = 0,
|
||||
@ -115,7 +119,7 @@ local np_temp = {
|
||||
scale = 1,
|
||||
spread = {x=3072, y=3072, z=3072},
|
||||
seed = 18882,
|
||||
octaves = 4,
|
||||
octaves = 3,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
@ -130,6 +134,17 @@ local np_tree = {
|
||||
persist = 0.6
|
||||
}
|
||||
|
||||
-- 2D noise for grasses
|
||||
|
||||
local np_grass = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=192, y=192, z=192},
|
||||
seed = -138,
|
||||
octaves = 4,
|
||||
persist = 0.7
|
||||
}
|
||||
|
||||
-- 3D noises for tunnels
|
||||
|
||||
local np_weba = {
|
||||
@ -204,7 +219,7 @@ local function riverdev_pathbrush(x, y, z, area, data,
|
||||
local c_stone = minetest.get_content_id("riverdev:stone")
|
||||
local c_path = minetest.get_content_id("riverdev:path")
|
||||
local c_wood = minetest.get_content_id("default:junglewood")
|
||||
local c_ice = minetest.get_content_id("default:ice")
|
||||
local c_snow = minetest.get_content_id("default:snow")
|
||||
if wood and math.random() < 0.2 then
|
||||
local vi = area:index(x, y-2, z)
|
||||
for j = y-2, y0-16, -1 do -- use mapblock shell
|
||||
@ -226,8 +241,8 @@ local function riverdev_pathbrush(x, y, z, area, data,
|
||||
data[vi] = c_path
|
||||
end
|
||||
if data[via] ~= c_path and data[via] ~= c_wood
|
||||
and under[si] == 3 then
|
||||
data[via] = c_ice
|
||||
and under[si] == 2 then
|
||||
data[via] = c_snow
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
@ -238,17 +253,34 @@ local function riverdev_pathbrush(x, y, z, area, data,
|
||||
end
|
||||
|
||||
local function riverdev_surface(x, y, z, area, data, y1, vi, viu,
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, under, si)
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, n_humid, under, si)
|
||||
local c_grass = minetest.get_content_id("riverdev:grass")
|
||||
local c_grass5 = minetest.get_content_id("default:grass_5")
|
||||
local c_snowblock = minetest.get_content_id("default:snowblock")
|
||||
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
||||
if under[si] == 1 then -- sand
|
||||
if math.random() < BOLCHA
|
||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||
riverdev_boulder(x, y, z, area, data)
|
||||
local c_dryshrub = minetest.get_content_id("default:dry_shrub")
|
||||
local c_drygrass = minetest.get_content_id("riverdev:drygrass")
|
||||
local c_goldengrass = minetest.get_content_id("riverdev:goldengrass")
|
||||
local c_icydirt = minetest.get_content_id("riverdev:icydirt")
|
||||
if under[si] == 1 then -- tundra
|
||||
data[viu] = c_icydirt
|
||||
if math.random() < GRACHA * n_grass then
|
||||
data[vi] = c_dryshrub
|
||||
end
|
||||
elseif under[si] == 2 then -- forest/grassland
|
||||
elseif under[si] == 2 then -- taiga
|
||||
if math.random() < PINCHA * n_tree
|
||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||
riverdev_snowypine(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_grass
|
||||
data[vi] = c_snowblock
|
||||
end
|
||||
elseif under[si] == 3 then -- dry grassland
|
||||
data[viu] = c_drygrass
|
||||
if math.random() < GRACHA * n_grass then
|
||||
data[vi] = c_dryshrub
|
||||
end
|
||||
elseif under[si] == 4 then -- forest/grassland
|
||||
if math.random() < BOLCHA
|
||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||
riverdev_boulder(x, y, z, area, data)
|
||||
@ -266,15 +298,20 @@ local function riverdev_surface(x, y, z, area, data, y1, vi, viu,
|
||||
data[vi] = c_grass5
|
||||
end
|
||||
end
|
||||
elseif under[si] == 3 then -- taiga
|
||||
if math.random() < PINCHA * n_tree
|
||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||
riverdev_snowypine(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_grass
|
||||
data[vi] = c_snowblock
|
||||
elseif under[si] == 5 then -- desert
|
||||
if math.random() < CACCHA * n_grass then
|
||||
riverdev_cactus(x, y, z, area, data)
|
||||
end
|
||||
elseif under[si] == 4 then -- rainforest
|
||||
elseif under[si] == 6 then
|
||||
if math.random() < ACACHA * n_tree then
|
||||
riverdev_acaciatree(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_drygrass
|
||||
if math.random() < GRACHA * n_grass then
|
||||
data[vi] = c_goldengrass
|
||||
end
|
||||
end
|
||||
elseif under[si] == 7 then -- rainforest
|
||||
if math.random() < JUNCHA
|
||||
and n_abspatha > TPFLO / 2 and n_abspathb > TPFLO / 2 then
|
||||
riverdev_jungletree(x, y, z, area, data, y1)
|
||||
@ -284,7 +321,12 @@ local function riverdev_surface(x, y, z, area, data, y1, vi, viu,
|
||||
data[vi] = c_jungrass
|
||||
end
|
||||
end
|
||||
elseif under[si] == 5 and n_temp < LOTET then -- stone
|
||||
elseif under[si] == 8 then -- sand
|
||||
if math.random() < BOLCHA
|
||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||
riverdev_boulder(x, y, z, area, data)
|
||||
end
|
||||
elseif under[si] == 9 and n_temp < LOTET then -- stone
|
||||
data[vi] = c_snowblock
|
||||
end
|
||||
end
|
||||
@ -321,6 +363,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local c_obsidian = minetest.get_content_id("default:obsidian")
|
||||
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
||||
local c_ice = minetest.get_content_id("default:ice")
|
||||
local c_desand = minetest.get_content_id("default:desert_sand")
|
||||
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
||||
local c_stomese = minetest.get_content_id("default:stone_with_mese")
|
||||
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
||||
@ -336,6 +379,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local c_mixwater = minetest.get_content_id("riverdev:mixwater")
|
||||
local c_freshwaterflow = minetest.get_content_id("riverdev:freshwaterflow")
|
||||
local c_mixwaterflow = minetest.get_content_id("riverdev:mixwaterflow")
|
||||
local c_permafrost = minetest.get_content_id("riverdev:permafrost")
|
||||
|
||||
local sidelen = x1 - x0 + 1 -- mapgen chunk side length
|
||||
local overlen = sidelen + 1 -- perlinmap overgeneration horizontal side length
|
||||
@ -360,6 +404,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local nvals_pathb = minetest.get_perlin_map(np_pathb, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_temp = minetest.get_perlin_map(np_temp, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_tree = minetest.get_perlin_map(np_tree, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_grass = minetest.get_perlin_map(np_grass, chulensxz):get2dMap_flat(minposxz)
|
||||
|
||||
--local noiset = math.ceil((os.clock() - t0) * 1000)
|
||||
--print ("[riverdev] noise "..noiset.." ms")
|
||||
@ -383,10 +428,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local nodidu = data[viu]
|
||||
local chunkxz = x >= x0 and z >= z0
|
||||
|
||||
local n_temp = nvals_temp[nixz]
|
||||
local n_tree = math.min(math.max(nvals_tree[nixz], 0), 1)
|
||||
local n_grass = math.min(math.max(-nvals_tree[nixz], 0), 1)
|
||||
|
||||
local n_patha = nvals_patha[nixz]
|
||||
local n_abspatha = math.abs(n_patha)
|
||||
local n_zprepatha = nvals_patha[(nixz - overlen)]
|
||||
@ -424,7 +465,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local tobs = TOBS + (density + tstone)
|
||||
local n_strata = nvals_strata[nixyz]
|
||||
local densitystrata = grad + n_strata * 0.5
|
||||
|
||||
local n_humid = n_absbase - n_absmid
|
||||
local n_temp = nvals_temp[nixz]
|
||||
local n_tree = math.min(math.max(nvals_tree[nixz], 0), 1)
|
||||
local n_grass = math.min(math.max(nvals_grass[nixz], 0), 1)
|
||||
|
||||
if chunkxz and y == y0 - 1 then -- overgeneration, initialise tables
|
||||
under[si] = 0
|
||||
if ungen then -- guess by calculating density
|
||||
@ -482,7 +527,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
data[vi] = c_stone -- stone
|
||||
end
|
||||
stable[si] = stable[si] + 1
|
||||
under[si] = 5
|
||||
under[si] = 9
|
||||
elseif y > YSAND
|
||||
and ((not wood and density < 0 and under[si] ~= 0)
|
||||
or (wood and densitybase > trsand * 2 and densitybase < trsand * 2 + 0.002))
|
||||
@ -498,16 +543,34 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
and stable[si] >= 2 and nodid ~= c_stone then -- do not replace boulder
|
||||
if y <= YSAND or densitybase >= trsand then
|
||||
data[vi] = c_sand
|
||||
under[si] = 1
|
||||
elseif n_temp < LOTET then -- taiga/snowyplains
|
||||
data[vi] = c_dirt
|
||||
under[si] = 3
|
||||
elseif n_temp > HITET then -- rainforest
|
||||
data[vi] = c_dirt
|
||||
under[si] = 4
|
||||
under[si] = 8
|
||||
elseif n_temp < LOTET then
|
||||
if n_humid < MIDHUT then -- tundra
|
||||
data[vi] = c_permafrost
|
||||
under[si] = 1
|
||||
else -- taiga
|
||||
data[vi] = c_dirt
|
||||
under[si] = 2
|
||||
end
|
||||
elseif n_temp > HITET then
|
||||
if n_humid < LOHUT then -- desert
|
||||
data[vi] = c_desand
|
||||
under[si] = 5
|
||||
elseif n_humid > HIHUT then -- savanna
|
||||
data[vi] = c_dirt
|
||||
under[si] = 6
|
||||
else -- rainforest
|
||||
data[vi] = c_dirt
|
||||
under[si] = 7
|
||||
end
|
||||
else
|
||||
data[vi] = c_dirt -- deciduous forest/grassland
|
||||
under[si] = 2
|
||||
if n_humid < MIDHUT then -- drygrass
|
||||
data[vi] = c_dirt
|
||||
under[si] = 3
|
||||
else -- deciduous forest / grassland
|
||||
data[vi] = c_dirt
|
||||
under[si] = 4
|
||||
end
|
||||
end
|
||||
elseif y <= YWATER and density < tstone and nodid ~= c_stone then -- sea water
|
||||
data[vi] = c_water
|
||||
@ -528,7 +591,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
and nodid ~= c_wood and nodidu ~= c_wood then
|
||||
|
||||
riverdev_surface(x, y, z, area, data, y1, vi, viu,
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, under, si)
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, n_humid, under, si)
|
||||
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
@ -555,7 +618,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
and nodid ~= c_wood and nodidu ~= c_wood then
|
||||
|
||||
riverdev_surface(x, y, z, area, data, y1, vi, viu,
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, under, si)
|
||||
n_abspatha, n_abspathb, n_tree, n_grass, n_temp, n_humid, under, si)
|
||||
|
||||
end
|
||||
end
|
||||
|
132
nodes.lua
@ -174,6 +174,121 @@ minetest.register_node("riverdev:jungling", {
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("riverdev:acaciatree", {
|
||||
description = "Acacia tree",
|
||||
tiles = {"riverdev_acaciatreetop.png", "riverdev_acaciatreetop.png", "riverdev_acaciatree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:acacialeaf", {
|
||||
description = "Acacia leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"riverdev_acacialeaf.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"riverdev:acacialing"},rarity = 20},
|
||||
{items = {"riverdev:acacialeaf"}}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:acacialing", {
|
||||
description = "Acacia tree sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"riverdev_acacialing.png"},
|
||||
inventory_image = "riverdev_acacialing.png",
|
||||
wield_image = "riverdev_acacialing.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:acaciawood", {
|
||||
description = "Acacia wood planks",
|
||||
tiles = {"riverdev_acaciawood.png"},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:goldengrass", {
|
||||
description = "Golden grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"riverdev_goldengrass.png"},
|
||||
inventory_image = "riverdev_goldengrass.png",
|
||||
wield_image = "riverdev_goldengrass.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:drygrass", {
|
||||
description = "Dry grass",
|
||||
tiles = {"riverdev_drygrass.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1,soil=1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:icydirt", {
|
||||
description = "Icy dirt",
|
||||
tiles = {"riverdev_icydirt.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.15},
|
||||
dug = {name="default_snow_footstep", gain=0.45},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:permafrost", {
|
||||
description = "Permafrost",
|
||||
tiles = {"riverdev_permafrost.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:cactus", {
|
||||
description = "Cactus",
|
||||
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=3,flammable=2},
|
||||
drop = "default:cactus",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("riverdev:freshwater", {
|
||||
description = "Fresh Water Source",
|
||||
inventory_image = minetest.inventorycube("riverdev_freshwater.png"),
|
||||
@ -333,6 +448,13 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "riverdev:acaciawood 4",
|
||||
recipe = {
|
||||
{"riverdev:acaciatree"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Register stairs and slabs
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
@ -345,3 +467,13 @@ stairs.register_stair_and_slab(
|
||||
default.node_sound_wood_defaults()
|
||||
)
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
"acaciawood",
|
||||
"riverdev:acaciawood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
{"riverdev_acaciawood.png"},
|
||||
"Acaciawood stair",
|
||||
"Acaciawood slab",
|
||||
default.node_sound_wood_defaults()
|
||||
)
|
||||
|
||||
|
BIN
textures/riverdev_acacialeaf.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
textures/riverdev_acacialing.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
textures/riverdev_acaciatree.png
Normal file
After Width: | Height: | Size: 682 B |
BIN
textures/riverdev_acaciatreetop.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
textures/riverdev_acaciawood.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
textures/riverdev_drygrass.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
textures/riverdev_goldengrass.png
Normal file
After Width: | Height: | Size: 683 B |
BIN
textures/riverdev_icydirt.png
Normal file
After Width: | Height: | Size: 746 B |
BIN
textures/riverdev_permafrost.png
Normal file
After Width: | Height: | Size: 897 B |