Flower colour areas, faults/cliffs, desert stone as layer, climbable jungletrees

This commit is contained in:
paramat 2014-03-22 06:40:39 +00:00
parent 9c85ca40f9
commit 9f0b9d6137
4 changed files with 78 additions and 31 deletions

View File

@ -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
Depends default
Licenses: code WTFPL

View File

@ -66,6 +66,7 @@ end
function watershed_jungletree(x, y, z, area, data)
local c_juntree = minetest.get_content_id("default:jungletree")
local c_wsjunleaf = minetest.get_content_id("watershed:jungleleaf")
local c_wsvine = minetest.get_content_id("watershed:vine")
for j = -5, 17 do
if j == 11 or j == 17 then
for i = -2, 2 do
@ -76,6 +77,15 @@ function watershed_jungletree(x, y, z, area, data)
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
local vit = area:index(x, y + j, z)
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_grass4 = minetest.get_content_id("default:grass_4")
local c_grass5 = minetest.get_content_id("default:grass_5")
local rand = math.random(5)
if rand == 1 then
local ran = math.random(5)
if ran == 1 then
data[vi] = c_grass1
elseif rand == 2 then
elseif ran == 2 then
data[vi] = c_grass2
elseif rand == 3 then
elseif ran == 3 then
data[vi] = c_grass3
elseif rand == 4 then
elseif ran == 4 then
data[vi] = c_grass4
else
data[vi] = c_grass5
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_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 rand = math.random(6)
if rand == 1 then
if noise > 0.8 then
data[vi] = c_danwhi
elseif rand == 2 then
elseif noise > 0.4 then
data[vi] = c_rose
elseif rand == 3 then
elseif noise > 0 then
data[vi] = c_tulip
elseif rand == 4 then
elseif noise > -0.4 then
data[vi] = c_danyel
elseif rand == 5 then
elseif noise > -0.8 then
data[vi] = c_geranium
else
data[vi] = c_viola

View File

@ -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
-- Depends default
-- 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
-- fog
-- jungletrees from rainforest mod
-- Parameters
@ -76,6 +81,17 @@ local np_smooth = {
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
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_jungrass = minetest.get_content_id("default:junglegrass")
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_mese = minetest.get_content_id("default:mese")
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_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_temp = minetest.get_perlin_map(np_temp, 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 tsand = TSAND * (1 - altprop * 1.1)
local tstone = TSTONE * (1 - math.atan(altprop) * 0.6) -- 1 to 0.05
local density = densitybase
+ math.abs(nvals_rough[nixyz] * terblen
+ nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP
local density
if nvals_fault[nixyz] >= 0 then
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
if density >= 0 then -- if terrain set fissure flag
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
or (densityper >= 0.05 and densityper <= 0.1) then
data[vi] = c_sandstone
elseif biome == 6 then -- desert stone
elseif biome == 6 and density < TSTONE * 3 then -- desert stone
data[vi] = c_wsredstone
elseif math.abs(nvals_ore[nixyz]) < ORET then -- if seam
if densityper >= 0.9 and densityper <= 0.9 + ORETHI
@ -435,9 +464,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
under[si] = 0
soil[si] = 0
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 qixz = zrq * 80 + xrq + 1
local qixz = zrq * 80 + xrq + 1 -- quantised index
if nvals_cloud[qixz] > TCLOUD then
local yrq = 16 * math.floor((y - y0) / 16)
local qixyz = zrq * 6400 + yrq * 80 + xrq + 1
@ -452,6 +481,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
soil[si] = 0
else -- possible above surface air node
if y >= YWAT and under[si] ~= 0 then
local fnoise = nvals_fissure[nixyz]
if under[si] == 1 then
if math.random(121) == 2 then
data[viu] = c_dirtsnow
@ -478,7 +508,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[viu] = c_wsgrass
if math.random(FLOCHA) == 2 then
data[viu] = c_wsgrass
watershed_flower(data, vi)
watershed_flower(data, vi, fnoise)
elseif math.random(FOGCHA) == 2 then
data[viu] = c_wsgrass
watershed_grass(data, vi)
@ -496,13 +526,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif under[si] == 4 then
data[viu] = c_wsgrass
if math.random(FLOCHA) == 2 then
watershed_flower(data, vi)
watershed_flower(data, vi, fnoise)
elseif math.random(GRACHA) == 2 then
if math.random(11) == 2 then
data[vi] = c_wsgoldgrass
else
watershed_grass(data, vi)
end
watershed_grass(data, vi)
end
elseif under[si] == 8 then
if math.random(JUTCHA) == 2 and soil[si] >= 5 then

View File

@ -64,7 +64,6 @@ minetest.register_node("watershed:cloud", {
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
post_effect_color = {a=64, r=241, g=248, b=255},
groups = {not_in_creative_inventory=1},
})
@ -80,7 +79,6 @@ minetest.register_node("watershed:darkcloud", {
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
post_effect_color = {a=128, r=241, g=248, b=255},
groups = {not_in_creative_inventory=1},
})
@ -134,6 +132,20 @@ minetest.register_node("watershed:permafrost", {
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", {
description = "WS Water Source",
inventory_image = minetest.inventorycube("default_water.png"),