No luxore abm. Terblen exponent returns. Bugfix: enable xlscale. Grass, flowers return to forest, grassland

This commit is contained in:
paramat 2014-05-07 18:48:59 +01:00
parent b804a06c64
commit cc4e445d5b
3 changed files with 44 additions and 48 deletions

View File

@ -230,7 +230,8 @@ if SINGLENODE then
local BASAMP = 0.3 -- Base terrain amplitude local BASAMP = 0.3 -- Base terrain amplitude
local MIDAMP = 0.1 -- Mid terrain amplitude local MIDAMP = 0.1 -- Mid terrain amplitude
local CANAMP = 0.4 -- Canyon terrain maximum amplitude local CANAMP = 0.4 -- Canyon terrain maximum amplitude
local ATANAMP = 1 local ATANAMP = 1.1
local BLENEXP = 2
local xsp local xsp
local ysp local ysp
local zsp local zsp
@ -294,13 +295,16 @@ if SINGLENODE then
local n_absmid = math.abs(nvals_mid[nixz]) local n_absmid = math.abs(nvals_mid[nixz])
local n_absbase = math.abs(nvals_base[nixz]) local n_absbase = math.abs(nvals_base[nixz])
local n_xlscale = nvals_xlscale[nixz] local n_xlscale = nvals_xlscale[nixz]
local n_invbase = (1 - n_absbase) local n_invbase = (1 - n_absbase)
local terblen = (math.max(n_invbase, 0)) ^ BLENEXP
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = n_invbase * BASAMP + grad + 0.1 local densitybase = n_invbase * BASAMP + n_xlscale * XLSAMP + grad
local densitymid = n_absmid * MIDAMP + densitybase local densitymid = n_absmid * MIDAMP + densitybase
local canexp = 0.2 + n_invbase * 0.8 local canexp = 0.5 + terblen * 0.5
local canamp = n_invbase * CANAMP local canamp = terblen * CANAMP
local density = n_absterrain ^ canexp * canamp * n_absmid + densitymid local density = n_absterrain ^ canexp * canamp * n_absmid + densitymid
if y >= 1 and density > -0.01 and density < 0 then if y >= 1 and density > -0.01 and density < 0 then
ysp = y + 1 ysp = y + 1
xsp = x xsp = x
@ -340,19 +344,7 @@ end
-- ABM -- ABM
-- update luxore light -- Lava-water cooling
minetest.register_abm({
nodenames = {"watershed:luxoreoff"},
interval = 13,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.remove_node(pos)
minetest.place_node(pos, {name="watershed:luxoreon"})
end,
})
-- Lava water cooling
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:lava"}, nodenames = {"group:lava"},

View File

@ -4,8 +4,10 @@
-- License: code WTFPL, textures CC BY-SA -- License: code WTFPL, textures CC BY-SA
-- Red cobble texture CC BY-SA by brunob.santos -- Red cobble texture CC BY-SA by brunob.santos
-- ore/strata vertical scale of 512 -- no luxore abm
-- tune params via riverdev -- terblen exponent returns
-- enable xlscale
-- grass, flowers return to forest, grassland
-- Parameters -- Parameters
@ -23,13 +25,14 @@ local XLSAMP = 0.1 -- Extra large scale height variation amplitude
local BASAMP = 0.3 -- Base terrain amplitude local BASAMP = 0.3 -- Base terrain amplitude
local MIDAMP = 0.1 -- Mid terrain amplitude local MIDAMP = 0.1 -- Mid terrain amplitude
local CANAMP = 0.4 -- Canyon terrain maximum amplitude local CANAMP = 0.4 -- Canyon terrain maximum amplitude
local ATANAMP = 1 -- Arctan function amplitude, smaller = more and larger floatlands above ridges local ATANAMP = 1.1 -- Arctan function amplitude, smaller = more and larger floatlands above ridges
local BLENEXP = 2 -- Terrain blend exponent
local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN
local TRIVER = -0.028 local TRIVER = -0.028 -- Densitybase threshold for river surface
local TRSAND = -0.035 local TRSAND = -0.035 -- Densitybase threshold for river sand
local TSTREAM = -0.004 local TSTREAM = -0.004 -- Densitymid threshold for stream surface
local TSSAND = -0.005 local TSSAND = -0.005 -- Densitymid threshold for stream sand
local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear
local TFIS = 0.01 -- Fissure threshold, controls width local TFIS = 0.01 -- Fissure threshold, controls width
local TSEAM = 0.1 -- Seam threshold, width of seams local TSEAM = 0.1 -- Seam threshold, width of seams
@ -48,16 +51,16 @@ local BLEND = 0.02 -- Biome blend randomness
local PINCHA = 36 -- Pine tree 1/x chance per node local PINCHA = 36 -- Pine tree 1/x chance per node
local APTCHA = 36 -- Appletree local APTCHA = 36 -- Appletree
local FLOCHA = 121 -- Flower local FLOCHA = 289 -- Flower
local GRACHA = 25 -- Grassland grasses local GRACHA = 36 -- Grassland grasses
local JUTCHA = 16 -- Jungletree local JUTCHA = 16 -- Jungletree
local JUGCHA = 16 -- Junglegrass local JUGCHA = 16 -- Junglegrass
local CACCHA = 841 -- Cactus local CACCHA = 841 -- Cactus
local DRYCHA = 169 -- Dry shrub local DRYCHA = 121 -- Dry shrub
local ACACHA = 841 -- Acacia tree local ACACHA = 841 -- Acacia tree
local GOGCHA = 16 -- Golden grass local GOGCHA = 16 -- Golden grass
local PAPCHA = 4 -- Papyrus local PAPCHA = 4 -- Papyrus
local DUGCHA = 25 -- Dune grass local DUGCHA = 16 -- Dune grass
-- 3D noise for terrain -- 3D noise for terrain
@ -236,7 +239,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_wslava = minetest.get_content_id("watershed:lava") local c_wslava = minetest.get_content_id("watershed:lava")
local c_wsfreshice = minetest.get_content_id("watershed:freshice") local c_wsfreshice = minetest.get_content_id("watershed:freshice")
local c_wscloud = minetest.get_content_id("watershed:cloud") local c_wscloud = minetest.get_content_id("watershed:cloud")
local c_wsluxoreoff = minetest.get_content_id("watershed:luxoreoff") local c_wsluxore = minetest.get_content_id("watershed:luxore")
local c_wsicydirt = minetest.get_content_id("watershed:icydirt") local c_wsicydirt = minetest.get_content_id("watershed:icydirt")
-- perlinmap stuff -- perlinmap stuff
local sidelen = x1 - x0 + 1 -- chunk sidelength local sidelen = x1 - x0 + 1 -- chunk sidelength
@ -285,14 +288,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
local n_magma = nvals_magma[nixz] local n_magma = nvals_magma[nixz]
-- get densities -- get densities
local n_invbase = (1 - n_absbase) local n_invbase = (1 - n_absbase)
local terblen = (math.max(n_invbase, 0)) ^ BLENEXP
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = n_invbase * BASAMP + grad + 0.1 local densitybase = n_invbase * BASAMP + n_xlscale * XLSAMP + grad
local densitymid = n_absmid * MIDAMP + densitybase local densitymid = n_absmid * MIDAMP + densitybase
local canexp = 0.2 + n_invbase * 0.8 local canexp = 0.5 + terblen * 0.5
local canamp = n_invbase * CANAMP local canamp = terblen * CANAMP
local density = n_absterrain ^ canexp * canamp * n_absmid + densitymid local density = n_absterrain ^ canexp * canamp * n_absmid + densitymid
-- other values -- other values
local terblen = math.max(1 - n_absbase, 0) -- = 1 at ridge
local triver = TRIVER * n_absbase -- river threshold local triver = TRIVER * n_absbase -- river threshold
local trsand = TRSAND * n_absbase -- river sand local trsand = TRSAND * n_absbase -- river sand
local tstream = TSTREAM * (1 - n_absmid) -- stream threshold local tstream = TSTREAM * (1 - n_absmid) -- stream threshold
@ -407,7 +410,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif densityper >= 0.55 and densityper <= 0.55 + ORETHI * 2 then elseif densityper >= 0.55 and densityper <= 0.55 + ORETHI * 2 then
data[vi] = c_gravel data[vi] = c_gravel
elseif densityper >= 0.1 and densityper <= 0.1 + ORETHI * 2 then elseif densityper >= 0.1 and densityper <= 0.1 + ORETHI * 2 then
data[vi] = c_wsluxoreoff data[vi] = c_wsluxore
elseif densityper >= 0.2 and densityper <= 0.2 + ORETHI * 2 elseif densityper >= 0.2 and densityper <= 0.2 + ORETHI * 2
and math.random(2) == 2 then and math.random(2) == 2 then
data[vi] = c_stoiron data[vi] = c_stoiron
@ -440,10 +443,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif y <= ysand then -- seabed/beach/dune sand not cut by fissures elseif y <= ysand then -- seabed/beach/dune sand not cut by fissures
data[vi] = c_sand data[vi] = c_sand
under[si] = 10 -- beach/dunes under[si] = 10 -- beach/dunes
elseif densitybase >= trsand + math.random() * 0.003 then -- river sand elseif densitybase >= trsand + math.random() * 0.001 then -- river sand
data[vi] = c_sand data[vi] = c_sand
under[si] = 11 -- riverbank papyrus under[si] = 11 -- riverbank papyrus
elseif densitymid >= tssand + math.random() * 0.003 then -- stream sand elseif densitymid >= tssand + math.random() * 0.001 then -- stream sand
data[vi] = c_sand data[vi] = c_sand
under[si] = 0 under[si] = 0
elseif nofis then -- fine materials cut by fissures elseif nofis then -- fine materials cut by fissures
@ -516,6 +519,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local fnoise = n_fissure -- noise for flower colours local fnoise = n_fissure -- noise for flower colours
if under[si] == 1 then if under[si] == 1 then
data[viu] = c_wsicydirt data[viu] = c_wsicydirt
if math.random(DRYCHA) == 2 then
data[vi] = c_dryshrub
end
elseif under[si] == 2 then elseif under[si] == 2 then
data[viu] = c_dirtsnow data[viu] = c_dirtsnow
data[vi] = c_snowblock data[vi] = c_snowblock
@ -528,8 +534,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
elseif under[si] == 4 then elseif under[si] == 4 then
data[viu] = c_wsdrygrass data[viu] = c_wsdrygrass
if math.random(DRYCHA) == 2 then
data[vi] = c_dryshrub
end
elseif under[si] == 5 then elseif under[si] == 5 then
data[viu] = c_wsgrass data[viu] = c_wsgrass
if math.random(FLOCHA) == 2 then
watershed_flower(data, vi, fnoise)
elseif math.random(GRACHA) == 2 then
data[vi] = c_grass5
end
elseif under[si] == 6 then elseif under[si] == 6 then
if math.random(APTCHA) == 2 then if math.random(APTCHA) == 2 then
watershed_appletree(x, y, z, area, data) watershed_appletree(x, y, z, area, data)

View File

@ -205,18 +205,8 @@ minetest.register_node("watershed:cloud", {
post_effect_color = {a=23, r=241, g=248, b=255}, post_effect_color = {a=23, r=241, g=248, b=255},
}) })
minetest.register_node("watershed:luxoreoff", { minetest.register_node("watershed:luxore", {
description = "WS Lux Ore Off", description = "WS Lux Ore",
tiles = {"watershed_luxore.png"},
light_source = 14,
is_ground_content = false,
groups = {cracky=3},
drop = "watershed:luxcrystal 8",
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("watershed:luxoreon", {
description = "WS Lux Ore On",
tiles = {"watershed_luxore.png"}, tiles = {"watershed_luxore.png"},
light_source = 14, light_source = 14,
groups = {cracky=3}, groups = {cracky=3},