forked from mtcontrib/watershed
Flower colour areas, faults/cliffs, desert stone as layer, climbable jungletrees
This commit is contained in:
parent
9c85ca40f9
commit
9f0b9d6137
@ -1,4 +1,4 @@
|
|||||||
watershed 0.2.9 by paramat
|
watershed 0.2.10 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
|
@ -66,6 +66,7 @@ end
|
|||||||
function watershed_jungletree(x, y, z, area, data)
|
function watershed_jungletree(x, y, z, area, data)
|
||||||
local c_juntree = minetest.get_content_id("default:jungletree")
|
local c_juntree = minetest.get_content_id("default:jungletree")
|
||||||
local c_wsjunleaf = minetest.get_content_id("watershed:jungleleaf")
|
local c_wsjunleaf = minetest.get_content_id("watershed:jungleleaf")
|
||||||
|
local c_wsvine = minetest.get_content_id("watershed:vine")
|
||||||
for j = -5, 17 do
|
for j = -5, 17 do
|
||||||
if j == 11 or j == 17 then
|
if j == 11 or j == 17 then
|
||||||
for i = -2, 2 do
|
for i = -2, 2 do
|
||||||
@ -76,6 +77,15 @@ function watershed_jungletree(x, y, z, area, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif j >= 0 then
|
||||||
|
for i = -1, 1 do
|
||||||
|
for k = -1, 1 do
|
||||||
|
if math.abs(i) + math.abs(k) == 1 then
|
||||||
|
local viv = area:index(x + i, y + j, z + k)
|
||||||
|
data[viv] = c_wsvine
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local vit = area:index(x, y + j, z)
|
local vit = area:index(x, y + j, z)
|
||||||
data[vit] = c_juntree
|
data[vit] = c_juntree
|
||||||
@ -126,37 +136,36 @@ function watershed_grass(data, vi)
|
|||||||
local c_grass3 = minetest.get_content_id("default:grass_3")
|
local c_grass3 = minetest.get_content_id("default:grass_3")
|
||||||
local c_grass4 = minetest.get_content_id("default:grass_4")
|
local c_grass4 = minetest.get_content_id("default:grass_4")
|
||||||
local c_grass5 = minetest.get_content_id("default:grass_5")
|
local c_grass5 = minetest.get_content_id("default:grass_5")
|
||||||
local rand = math.random(5)
|
local ran = math.random(5)
|
||||||
if rand == 1 then
|
if ran == 1 then
|
||||||
data[vi] = c_grass1
|
data[vi] = c_grass1
|
||||||
elseif rand == 2 then
|
elseif ran == 2 then
|
||||||
data[vi] = c_grass2
|
data[vi] = c_grass2
|
||||||
elseif rand == 3 then
|
elseif ran == 3 then
|
||||||
data[vi] = c_grass3
|
data[vi] = c_grass3
|
||||||
elseif rand == 4 then
|
elseif ran == 4 then
|
||||||
data[vi] = c_grass4
|
data[vi] = c_grass4
|
||||||
else
|
else
|
||||||
data[vi] = c_grass5
|
data[vi] = c_grass5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function watershed_flower(data, vi)
|
function watershed_flower(data, vi, noise)
|
||||||
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")
|
||||||
local c_rose = minetest.get_content_id("flowers:rose")
|
local c_rose = minetest.get_content_id("flowers:rose")
|
||||||
local c_tulip = minetest.get_content_id("flowers:tulip")
|
local c_tulip = minetest.get_content_id("flowers:tulip")
|
||||||
local c_geranium = minetest.get_content_id("flowers:geranium")
|
local c_geranium = minetest.get_content_id("flowers:geranium")
|
||||||
local c_viola = minetest.get_content_id("flowers:viola")
|
local c_viola = minetest.get_content_id("flowers:viola")
|
||||||
local rand = math.random(6)
|
if noise > 0.8 then
|
||||||
if rand == 1 then
|
|
||||||
data[vi] = c_danwhi
|
data[vi] = c_danwhi
|
||||||
elseif rand == 2 then
|
elseif noise > 0.4 then
|
||||||
data[vi] = c_rose
|
data[vi] = c_rose
|
||||||
elseif rand == 3 then
|
elseif noise > 0 then
|
||||||
data[vi] = c_tulip
|
data[vi] = c_tulip
|
||||||
elseif rand == 4 then
|
elseif noise > -0.4 then
|
||||||
data[vi] = c_danyel
|
data[vi] = c_danyel
|
||||||
elseif rand == 5 then
|
elseif noise > -0.8 then
|
||||||
data[vi] = c_geranium
|
data[vi] = c_geranium
|
||||||
else
|
else
|
||||||
data[vi] = c_viola
|
data[vi] = c_viola
|
||||||
|
58
init.lua
58
init.lua
@ -1,12 +1,17 @@
|
|||||||
-- watershed 0.2.9 by paramat
|
-- watershed 0.2.10 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
|
||||||
|
|
||||||
-- 0.2.9 added clay at mid-temperatures
|
-- 0.2.10
|
||||||
|
-- flower colour areas
|
||||||
|
-- faults and cliffs
|
||||||
|
-- desert stone as a thin density layer
|
||||||
|
-- climbable jungletrees
|
||||||
|
|
||||||
-- TODO
|
-- TODO
|
||||||
-- fog
|
-- fog
|
||||||
|
-- jungletrees from rainforest mod
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
@ -76,6 +81,17 @@ local np_smooth = {
|
|||||||
persist = 0.4
|
persist = 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- 3D noise for faults
|
||||||
|
|
||||||
|
local np_fault = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=512, y=1024, z=512},
|
||||||
|
seed = 14440002,
|
||||||
|
octaves = 6,
|
||||||
|
persist = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
-- 3D noise for fissures
|
-- 3D noise for fissures
|
||||||
|
|
||||||
local np_fissure = {
|
local np_fissure = {
|
||||||
@ -225,6 +241,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
|
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
|
||||||
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
||||||
local c_dryshrub = minetest.get_content_id("default:dry_shrub")
|
local c_dryshrub = minetest.get_content_id("default:dry_shrub")
|
||||||
|
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
||||||
|
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
||||||
|
local c_rose = minetest.get_content_id("flowers:rose")
|
||||||
|
local c_tulip = minetest.get_content_id("flowers:tulip")
|
||||||
|
local c_geranium = minetest.get_content_id("flowers:geranium")
|
||||||
|
local c_viola = minetest.get_content_id("flowers:viola")
|
||||||
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
||||||
local c_mese = minetest.get_content_id("default:mese")
|
local c_mese = minetest.get_content_id("default:mese")
|
||||||
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
||||||
@ -253,6 +275,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
|
|
||||||
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
|
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
|
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
|
||||||
|
local nvals_fault = minetest.get_perlin_map(np_fault, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
|
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz)
|
local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz)
|
||||||
local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz)
|
local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz)
|
||||||
@ -294,10 +317,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local triv = TRIV * (1 - altprop * 1.1)
|
local triv = TRIV * (1 - altprop * 1.1)
|
||||||
local tsand = TSAND * (1 - altprop * 1.1)
|
local tsand = TSAND * (1 - altprop * 1.1)
|
||||||
local tstone = TSTONE * (1 - math.atan(altprop) * 0.6) -- 1 to 0.05
|
local tstone = TSTONE * (1 - math.atan(altprop) * 0.6) -- 1 to 0.05
|
||||||
local density = densitybase
|
local density
|
||||||
+ math.abs(nvals_rough[nixyz] * terblen
|
if nvals_fault[nixyz] >= 0 then
|
||||||
+ nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP
|
density = densitybase
|
||||||
|
+ math.abs(nvals_rough[nixyz] * terblen
|
||||||
|
+ nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP
|
||||||
|
else
|
||||||
|
density = densitybase
|
||||||
|
+ math.abs(nvals_rough[nixyz] * terblen
|
||||||
|
- nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP
|
||||||
|
end
|
||||||
local nofis = false
|
local nofis = false
|
||||||
if density >= 0 then -- if terrain set fissure flag
|
if density >= 0 then -- if terrain set fissure flag
|
||||||
if math.abs(nvals_fissure[nixyz]) > FIST + math.sqrt(density) * FISEXP then
|
if math.abs(nvals_fissure[nixyz]) > FIST + math.sqrt(density) * FISEXP then
|
||||||
@ -340,7 +369,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if (densityper >= -0.1 and densityper <= -0.05) -- sandstone strata
|
if (densityper >= -0.1 and densityper <= -0.05) -- sandstone strata
|
||||||
or (densityper >= 0.05 and densityper <= 0.1) then
|
or (densityper >= 0.05 and densityper <= 0.1) then
|
||||||
data[vi] = c_sandstone
|
data[vi] = c_sandstone
|
||||||
elseif biome == 6 then -- desert stone
|
elseif biome == 6 and density < TSTONE * 3 then -- desert stone
|
||||||
data[vi] = c_wsredstone
|
data[vi] = c_wsredstone
|
||||||
elseif math.abs(nvals_ore[nixyz]) < ORET then -- if seam
|
elseif math.abs(nvals_ore[nixyz]) < ORET then -- if seam
|
||||||
if densityper >= 0.9 and densityper <= 0.9 + ORETHI
|
if densityper >= 0.9 and densityper <= 0.9 + ORETHI
|
||||||
@ -435,9 +464,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
under[si] = 0
|
under[si] = 0
|
||||||
soil[si] = 0
|
soil[si] = 0
|
||||||
elseif y == YCLOUD then -- clouds
|
elseif y == YCLOUD then -- clouds
|
||||||
local xrq = 16 * math.floor((x - x0) / 16)
|
local xrq = 16 * math.floor((x - x0) / 16) -- quantise to 16x16 lattice
|
||||||
local zrq = 16 * math.floor((z - z0) / 16)
|
local zrq = 16 * math.floor((z - z0) / 16)
|
||||||
local qixz = zrq * 80 + xrq + 1
|
local qixz = zrq * 80 + xrq + 1 -- quantised index
|
||||||
if nvals_cloud[qixz] > TCLOUD then
|
if nvals_cloud[qixz] > TCLOUD then
|
||||||
local yrq = 16 * math.floor((y - y0) / 16)
|
local yrq = 16 * math.floor((y - y0) / 16)
|
||||||
local qixyz = zrq * 6400 + yrq * 80 + xrq + 1
|
local qixyz = zrq * 6400 + yrq * 80 + xrq + 1
|
||||||
@ -452,6 +481,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
soil[si] = 0
|
soil[si] = 0
|
||||||
else -- possible above surface air node
|
else -- possible above surface air node
|
||||||
if y >= YWAT and under[si] ~= 0 then
|
if y >= YWAT and under[si] ~= 0 then
|
||||||
|
local fnoise = nvals_fissure[nixyz]
|
||||||
if under[si] == 1 then
|
if under[si] == 1 then
|
||||||
if math.random(121) == 2 then
|
if math.random(121) == 2 then
|
||||||
data[viu] = c_dirtsnow
|
data[viu] = c_dirtsnow
|
||||||
@ -478,7 +508,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[viu] = c_wsgrass
|
data[viu] = c_wsgrass
|
||||||
if math.random(FLOCHA) == 2 then
|
if math.random(FLOCHA) == 2 then
|
||||||
data[viu] = c_wsgrass
|
data[viu] = c_wsgrass
|
||||||
watershed_flower(data, vi)
|
watershed_flower(data, vi, fnoise)
|
||||||
elseif math.random(FOGCHA) == 2 then
|
elseif math.random(FOGCHA) == 2 then
|
||||||
data[viu] = c_wsgrass
|
data[viu] = c_wsgrass
|
||||||
watershed_grass(data, vi)
|
watershed_grass(data, vi)
|
||||||
@ -496,13 +526,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
elseif under[si] == 4 then
|
elseif under[si] == 4 then
|
||||||
data[viu] = c_wsgrass
|
data[viu] = c_wsgrass
|
||||||
if math.random(FLOCHA) == 2 then
|
if math.random(FLOCHA) == 2 then
|
||||||
watershed_flower(data, vi)
|
watershed_flower(data, vi, fnoise)
|
||||||
elseif math.random(GRACHA) == 2 then
|
elseif math.random(GRACHA) == 2 then
|
||||||
if math.random(11) == 2 then
|
watershed_grass(data, vi)
|
||||||
data[vi] = c_wsgoldgrass
|
|
||||||
else
|
|
||||||
watershed_grass(data, vi)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
elseif under[si] == 8 then
|
elseif under[si] == 8 then
|
||||||
if math.random(JUTCHA) == 2 and soil[si] >= 5 then
|
if math.random(JUTCHA) == 2 and soil[si] >= 5 then
|
||||||
|
16
nodes.lua
16
nodes.lua
@ -64,7 +64,6 @@ minetest.register_node("watershed:cloud", {
|
|||||||
pointable = false,
|
pointable = false,
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
is_ground_content = false,
|
|
||||||
post_effect_color = {a=64, r=241, g=248, b=255},
|
post_effect_color = {a=64, r=241, g=248, b=255},
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
@ -80,7 +79,6 @@ minetest.register_node("watershed:darkcloud", {
|
|||||||
pointable = false,
|
pointable = false,
|
||||||
diggable = false,
|
diggable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
is_ground_content = false,
|
|
||||||
post_effect_color = {a=128, r=241, g=248, b=255},
|
post_effect_color = {a=128, r=241, g=248, b=255},
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
@ -134,6 +132,20 @@ minetest.register_node("watershed:permafrost", {
|
|||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("watershed:vine", {
|
||||||
|
description = "WS Jungletree Vine",
|
||||||
|
drawtype = "airlike",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("watershed:water", {
|
minetest.register_node("watershed:water", {
|
||||||
description = "WS Water Source",
|
description = "WS Water Source",
|
||||||
inventory_image = minetest.inventorycube("default_water.png"),
|
inventory_image = minetest.inventorycube("default_water.png"),
|
||||||
|
Loading…
Reference in New Issue
Block a user