Simple boulders return. Compressed snow on paths. New snowypines. Add humidity from water distance. Re-add grass noise. Vary acaciatree height. 7 biomes

This commit is contained in:
paramat 2014-10-25 07:14:34 +01:00
parent eae273e641
commit d57c557eff
13 changed files with 375 additions and 119 deletions

View File

@ -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 For latest stable Minetest back to 0.4.8
Depends default Depends default
Licenses: code WTFPL Licenses: code WTFPL

View File

@ -89,61 +89,64 @@ function riverdev_snowypine(x, y, z, area, data)
local c_snowblock = minetest.get_content_id("default:snowblock") local c_snowblock = minetest.get_content_id("default:snowblock")
for j = -4, 14 do for j = -4, 14 do
if j == 3 or j == 6 or j == 9 or j == 12 then if j == 3 or j == 6 or j == 9 or j == 12 then
for i = -2, 2 do
for k = -2, 2 do for k = -2, 2 do
if math.abs(i) == 2 or math.abs(k) == 2 then local vi = area:index(x - 2, y + j, z + k)
if math.random(7) ~= 2 then local via = area:index(x - 2, y + j + 1, z + k)
local vil = area:index(x + i, y + j, z + k) for i = -2, 2 do
data[vil] = c_needles if math.abs(i) == 1 and math.abs(k) == 1 then
local vila = area:index(x + i, y + j + 1, z + k) data[vi] = c_pinetree
data[vila] = c_snowblock 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 end
vi = vi + 1
via = via + 1
end end
end end
end elseif j == 4 or j == 7 or j == 10 or j == 13 then
elseif j == 4 or j == 7 or j == 10 then
for i = -1, 1 do
for k = -1, 1 do for k = -1, 1 do
if not (i == 0 and j == 0) then local vi = area:index(x - 1, y + j, z + k)
if math.random(11) ~= 2 then local via = area:index(x - 1, y + j + 1, z + k)
local vil = area:index(x + i, y + j, z + k) for i = -1, 1 do
data[vil] = c_needles if not (i == 0 and j == 0) then
local vila = area:index(x + i, y + j + 1, z + k) data[vi] = c_needles
data[vila] = c_snowblock data[via] = c_snowblock
end end
vi = vi + 1
via = via + 1
end end
end end
end elseif j == 14 then
elseif j == 13 then
for i = -1, 1 do
for k = -1, 1 do for k = -1, 1 do
if not (i == 0 and j == 0) then local vi = area:index(x - 1, y + j, z + k)
local vil = area:index(x + i, y + j, z + k) local via = area:index(x - 1, y + j + 1, z + k)
data[vil] = c_needles for i = -1, 1 do
local vila = area:index(x + i, y + j + 1, z + k) if math.abs(i) + math.abs(k) == 1 then
data[vila] = c_needles data[vi] = c_needles
local vilaa = area:index(x + i, y + j + 2, z + k) data[via] = c_snowblock
data[vilaa] = c_snowblock end
vi = vi + 1
via = via + 1
end end
end end
end
end end
local vit = area:index(x, y + j, z) local vi = area:index(x, y + j, z)
data[vit] = c_pinetree data[vi] = c_pinetree
end end
local vil = area:index(x, y + 15, z) local vi = area:index(x, y + 15, z)
local vila = area:index(x, y + 16, z) local via = area:index(x, y + 16, z)
local vilaa = area:index(x, y + 17, z) local viaa = area:index(x, y + 17, z)
data[vil] = c_needles data[vi] = c_needles
data[vila] = c_needles data[via] = c_needles
data[vilaa] = c_snowblock data[viaa] = c_snowblock
end end
function riverdev_jungletree(x, y, z, area, data, y1) function riverdev_jungletree(x, y, z, area, data, y1)
local c_juntree = minetest.get_content_id("default:jungletree") local c_juntree = minetest.get_content_id("default:jungletree")
local c_junleaf = minetest.get_content_id("riverdev:jungleleaf") local c_junleaf = minetest.get_content_id("riverdev:jungleleaf")
local c_vine = minetest.get_content_id("riverdev:vine") 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) local branch = math.floor(top * 0.6)
for j = -5, top do for j = -5, top do
if j == top or j == top - 1 or j == branch + 1 or j == branch + 2 then 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
end end
function riverdev_boulder(x, y, z, area, data) function riverdev_acaciatree(x, y, z, area, data)
local np_boulder = { local c_actree = minetest.get_content_id("riverdev:acaciatree")
offset = 0, local c_acleaf = minetest.get_content_id("riverdev:acacialeaf")
scale = 1, local top = 4 + math.random(3)
spread = {x=16, y=16, z=16}, for j = -3, top do
seed = 5933, if j == top then
octaves = 2, for i = -4, 4 do
persist = 0.67 for k = -4, 4 do
} if not (i == 0 or k == 0) then
local chulens = {x=17, y=17, z=17} if math.random(7) ~= 2 then
local minpos = {x=x-8, y=y-8, z=z-8} local vi = area:index(x + i, y + j, z + k)
local nvals_boulder = minetest.get_perlin_map(np_boulder, chulens):get3dMap_flat(minpos) data[vi] = c_acleaf
local c_boulder end
if math.random() < 0.2 then end
c_boulder = minetest.get_content_id("default:sandstone") end
else end
c_boulder = minetest.get_content_id("riverdev:stone") 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 end
local avrad = 2 + math.random() * 3 end
local ni = 1
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 k = -8, 8 do
for j = -8, 8 do for j = -8, 8 do
local vi = area:index(x-8, y+j, z+k) local vi = area:index(x-8, y+j, z+k)
for i = -8, 8 do for i = -8, 8 do
if (i ^ 2 + j ^ 2 + k ^ 2) ^ 0.5 < avrad * (1 + nvals_boulder[ni] * 0.7) then if (i ^ 2 * dx + j ^ 2 * dy + k ^ 2 * dz) ^ 0.5 < 8 then
data[vi] = c_boulder data[vi] = c_stone
end end
vi = vi + 1 vi = vi + 1
ni = ni + 1
end end
end end
end end
@ -316,6 +354,29 @@ minetest.register_abm({
end, 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 -- Set mapgen parameters
minetest.register_on_mapgen_init(function(mgparams) minetest.register_on_mapgen_init(function(mgparams)

181
init.lua
View File

@ -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 -- For latest stable Minetest and back to 0.4.8
-- Depends default -- Depends default
-- License: code WTFPL -- License: code WTFPL
-- remove tunnel expansion -- return to simple boulders
-- add caves using 5 noises -- compressed snow on paths in taiga
-- jungletrees auto-limit height to avoid chop -- update snowypines
-- add fissures -- add humidity noise from water distance
-- 3d noise boulders, some sandstone -- re-add long grasses noise
-- vary acaciatree height
-- add biomes
-- TODO -- TODO
-- regeneration command: use of mapgen loop function -- regeneration command: use of mapgen loop function
-- update snowypines
-- coloured stone: desertstone orange sandstone green blue violet -- coloured stone: desertstone orange sandstone green blue violet
-- inclined strata with 3d biomes of coloured stone mixes -- inclined strata with 3d biomes of coloured stone mixes
-- ores in strata -- ores in strata
-- add humidity from water distance
-- add all watershed biomes
-- gravel in tunnels/caves
-- Parameters -- Parameters
@ -24,7 +22,7 @@ local YMIN = -33000 -- Y limits of realm generation
local YMAX = 1024 local YMAX = 1024
local YWATER = 1 -- Water surface y local YWATER = 1 -- Water surface y
local YSAND = 4 -- Top of beach 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 YPINE = 47 -- Pines above this y
local TERSCA = 512 -- Terrain vertical scale in nodes 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 local ORECHA = 1 / 5 ^ 3 -- Ore chance per stone node
-- 1 / n ^ 3 where n = average distance between ores -- 1 / n ^ 3 where n = average distance between ores
local BOLCHA = 1 / 32 ^ 2 -- Boulder maximum chance per grass node. local BOLCHA = 1 / 127 ^ 2 -- Boulder maximum chance per surface node
-- 1 / n ^ 2 where n = average minimum distance between flora -- 1 / n ^ 2 where n = average distance between features
local APPCHA = 1 / 5 ^ 2 -- Appletree maximum chance per grass node local APPCHA = 1 / 5 ^ 2 -- Appletree maximum chance per node
local PINCHA = 1 / 6 ^ 2 -- Pinetree maximum chance per grass node local PINCHA = 1 / 6 ^ 2 -- Pinetree maximum chance per node
local JUNCHA = 1 / 4 ^ 2 -- Jungletree maximum chance per grass node local JUNCHA = 1 / 4 ^ 2 -- Jungletree maximum chance per node
local GRACHA = 1 / 5 ^ 2 -- Grasses maximum chance per grass node local ACACHA = 1 / 47 ^ 2 -- Acaciatree maximum chance per node
local FLOCHA = 1 / 61 ^ 2 -- Flower chance per grass node local GRACHA = 1 / 4 ^ 2 -- Grasses maximum chance per node
local LOTET = -0.4 -- Low temperature threshold for taiga/snowyplains local FLOCHA = 1 / 37 ^ 2 -- Flower chance per node
local HITET = 0.4 -- High temperature threshold for Rainforest 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 -- 3D noise for highland terrain
@ -64,18 +68,18 @@ local np_terrain = {
persist = 0.67 persist = 0.67
} }
-- 2D noise for mid terrain / river -- 2D noise for mid terrain / river / humidity
local np_mid = { local np_mid = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=768, y=768, z=768}, spread = {x=1536, y=1536, z=1536},
seed = 85546, seed = 85546,
octaves = 5, octaves = 6,
persist = 0.4 persist = 0.4
} }
-- 2D noise for base terrain -- 2D noise for base terrain / humidity
local np_base = { local np_base = {
offset = 0, offset = 0,
@ -115,7 +119,7 @@ local np_temp = {
scale = 1, scale = 1,
spread = {x=3072, y=3072, z=3072}, spread = {x=3072, y=3072, z=3072},
seed = 18882, seed = 18882,
octaves = 4, octaves = 3,
persist = 0.4 persist = 0.4
} }
@ -130,6 +134,17 @@ local np_tree = {
persist = 0.6 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 -- 3D noises for tunnels
local np_weba = { 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_stone = minetest.get_content_id("riverdev:stone")
local c_path = minetest.get_content_id("riverdev:path") local c_path = minetest.get_content_id("riverdev:path")
local c_wood = minetest.get_content_id("default:junglewood") 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 if wood and math.random() < 0.2 then
local vi = area:index(x, y-2, z) local vi = area:index(x, y-2, z)
for j = y-2, y0-16, -1 do -- use mapblock shell 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 data[vi] = c_path
end end
if data[via] ~= c_path and data[via] ~= c_wood if data[via] ~= c_path and data[via] ~= c_wood
and under[si] == 3 then and under[si] == 2 then
data[via] = c_ice data[via] = c_snow
end end
vi = vi + 1 vi = vi + 1
via = via + 1 via = via + 1
@ -238,17 +253,34 @@ local function riverdev_pathbrush(x, y, z, area, data,
end end
local function riverdev_surface(x, y, z, area, data, y1, vi, viu, 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_grass = minetest.get_content_id("riverdev:grass")
local c_grass5 = minetest.get_content_id("default:grass_5") local c_grass5 = minetest.get_content_id("default:grass_5")
local c_snowblock = minetest.get_content_id("default:snowblock") local c_snowblock = minetest.get_content_id("default:snowblock")
local c_jungrass = minetest.get_content_id("default:junglegrass") local c_jungrass = minetest.get_content_id("default:junglegrass")
if under[si] == 1 then -- sand local c_dryshrub = minetest.get_content_id("default:dry_shrub")
if math.random() < BOLCHA local c_drygrass = minetest.get_content_id("riverdev:drygrass")
and n_abspatha > TPFLO and n_abspathb > TPFLO then local c_goldengrass = minetest.get_content_id("riverdev:goldengrass")
riverdev_boulder(x, y, z, area, data) 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 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 if math.random() < BOLCHA
and n_abspatha > TPFLO and n_abspathb > TPFLO then and n_abspatha > TPFLO and n_abspathb > TPFLO then
riverdev_boulder(x, y, z, area, data) 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 data[vi] = c_grass5
end end
end end
elseif under[si] == 3 then -- taiga elseif under[si] == 5 then -- desert
if math.random() < PINCHA * n_tree if math.random() < CACCHA * n_grass then
and n_abspatha > TPFLO and n_abspathb > TPFLO then riverdev_cactus(x, y, z, area, data)
riverdev_snowypine(x, y, z, area, data)
else
data[viu] = c_grass
data[vi] = c_snowblock
end 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 if math.random() < JUNCHA
and n_abspatha > TPFLO / 2 and n_abspathb > TPFLO / 2 then and n_abspatha > TPFLO / 2 and n_abspathb > TPFLO / 2 then
riverdev_jungletree(x, y, z, area, data, y1) 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 data[vi] = c_jungrass
end end
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 data[vi] = c_snowblock
end end
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_obsidian = minetest.get_content_id("default:obsidian")
local c_jungrass = minetest.get_content_id("default:junglegrass") local c_jungrass = minetest.get_content_id("default:junglegrass")
local c_ice = minetest.get_content_id("default:ice") 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_stodiam = minetest.get_content_id("default:stone_with_diamond")
local c_stomese = minetest.get_content_id("default:stone_with_mese") local c_stomese = minetest.get_content_id("default:stone_with_mese")
local c_stogold = minetest.get_content_id("default:stone_with_gold") 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_mixwater = minetest.get_content_id("riverdev:mixwater")
local c_freshwaterflow = minetest.get_content_id("riverdev:freshwaterflow") local c_freshwaterflow = minetest.get_content_id("riverdev:freshwaterflow")
local c_mixwaterflow = minetest.get_content_id("riverdev:mixwaterflow") 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 sidelen = x1 - x0 + 1 -- mapgen chunk side length
local overlen = sidelen + 1 -- perlinmap overgeneration horizontal 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_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_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_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) --local noiset = math.ceil((os.clock() - t0) * 1000)
--print ("[riverdev] noise "..noiset.." ms") --print ("[riverdev] noise "..noiset.." ms")
@ -383,10 +428,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
local nodidu = data[viu] local nodidu = data[viu]
local chunkxz = x >= x0 and z >= z0 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_patha = nvals_patha[nixz]
local n_abspatha = math.abs(n_patha) local n_abspatha = math.abs(n_patha)
local n_zprepatha = nvals_patha[(nixz - overlen)] local n_zprepatha = nvals_patha[(nixz - overlen)]
@ -424,6 +465,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
local tobs = TOBS + (density + tstone) local tobs = TOBS + (density + tstone)
local n_strata = nvals_strata[nixyz] local n_strata = nvals_strata[nixyz]
local densitystrata = grad + n_strata * 0.5 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 if chunkxz and y == y0 - 1 then -- overgeneration, initialise tables
under[si] = 0 under[si] = 0
@ -482,7 +527,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[vi] = c_stone -- stone data[vi] = c_stone -- stone
end end
stable[si] = stable[si] + 1 stable[si] = stable[si] + 1
under[si] = 5 under[si] = 9
elseif y > YSAND elseif y > YSAND
and ((not wood and density < 0 and under[si] ~= 0) and ((not wood and density < 0 and under[si] ~= 0)
or (wood and densitybase > trsand * 2 and densitybase < trsand * 2 + 0.002)) 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 and stable[si] >= 2 and nodid ~= c_stone then -- do not replace boulder
if y <= YSAND or densitybase >= trsand then if y <= YSAND or densitybase >= trsand then
data[vi] = c_sand data[vi] = c_sand
under[si] = 1 under[si] = 8
elseif n_temp < LOTET then -- taiga/snowyplains elseif n_temp < LOTET then
data[vi] = c_dirt if n_humid < MIDHUT then -- tundra
under[si] = 3 data[vi] = c_permafrost
elseif n_temp > HITET then -- rainforest under[si] = 1
data[vi] = c_dirt else -- taiga
under[si] = 4 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 else
data[vi] = c_dirt -- deciduous forest/grassland if n_humid < MIDHUT then -- drygrass
under[si] = 2 data[vi] = c_dirt
under[si] = 3
else -- deciduous forest / grassland
data[vi] = c_dirt
under[si] = 4
end
end end
elseif y <= YWATER and density < tstone and nodid ~= c_stone then -- sea water elseif y <= YWATER and density < tstone and nodid ~= c_stone then -- sea water
data[vi] = c_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 and nodid ~= c_wood and nodidu ~= c_wood then
riverdev_surface(x, y, z, area, data, y1, vi, viu, 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 stable[si] = 0
under[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 and nodid ~= c_wood and nodidu ~= c_wood then
riverdev_surface(x, y, z, area, data, y1, vi, viu, 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
end end

132
nodes.lua
View File

@ -174,6 +174,121 @@ minetest.register_node("riverdev:jungling", {
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("riverdev:freshwater", {
description = "Fresh Water Source", description = "Fresh Water Source",
inventory_image = minetest.inventorycube("riverdev_freshwater.png"), 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 -- Register stairs and slabs
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
@ -345,3 +467,13 @@ stairs.register_stair_and_slab(
default.node_sound_wood_defaults() 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()
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B