Craft 8 lights at once. Mid colour blend water. Flatter lowlands: terblen exponent, vary canexp, canamp. Grassy sides on mod grass

This commit is contained in:
paramat 2014-04-22 14:21:21 +01:00
parent c6acea60cb
commit 123ab76e4f
7 changed files with 121 additions and 32 deletions

View File

@ -1,4 +1,4 @@
watershed 0.3.13 by paramat watershed 0.3.14 by paramat
For latest stable Minetest back to 0.4.8 For latest stable Minetest back to 0.4.8
Depends default bucket Depends default bucket
Licenses: code WTFPL, textures CC BY-SA Licenses: code WTFPL, textures CC BY-SA

View File

@ -229,8 +229,8 @@ if SINGLENODE then
local ATANAMP = 1.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 XLSAMP = 0.2 -- Extra large scale height variation amplitude local XLSAMP = 0.2 -- Extra large scale height variation amplitude
local BASAMP = 0.4 -- Base terrain amplitude local BASAMP = 0.4 -- Base terrain amplitude
local CANAMP = 0.4 -- Canyon terrain amplitude local CANAMP = 0.4 -- Canyon terrain maximum amplitude
local CANEXP = 1.33 -- Canyon shape exponent local BLENEXP = 2 -- Terrain blend exponent
local xsp local xsp
local ysp local ysp
local zsp local zsp
@ -271,7 +271,7 @@ if SINGLENODE then
scale = 1, scale = 1,
spread = {x=4096, y=4096, z=4096}, spread = {x=4096, y=4096, z=4096},
seed = 8890, seed = 8890,
octaves = 4, octaves = 3,
persist = 0.33 persist = 0.33
} }
local np_xlscale = { local np_xlscale = {
@ -280,7 +280,7 @@ if SINGLENODE then
spread = {x=8192, y=8192, z=8192}, spread = {x=8192, y=8192, z=8192},
seed = -72, seed = -72,
octaves = 3, octaves = 3,
persist = 0.4 persist = 0.33
} }
for chunk = 1, 64 do for chunk = 1, 64 do
print ("[watershed] searching for spawn "..chunk) print ("[watershed] searching for spawn "..chunk)
@ -317,10 +317,12 @@ if SINGLENODE then
local n_xlscale = nvals_xlscale[nixz] local n_xlscale = nvals_xlscale[nixz]
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad
local terblen = math.max(1 - math.abs(n_base), 0) local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP
local canexp = 0.5 + terblen
local canamp = 0.03 + terblen * CANAMP
local density = densitybase + local density = densitybase +
math.abs((n_rough + n_roughalt) * 0.5 * terblen + math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.25 * (1 - terblen)) ^ CANEXP * CANAMP (n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp
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

View File

@ -1,10 +1,13 @@
-- watershed 0.3.13 by paramat -- watershed 0.3.14 by paramat
-- For latest stable Minetest and back to 0.4.8 -- For latest stable Minetest and back to 0.4.8
-- Depends default bucket -- Depends default bucket
-- 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
-- y = 47 bugfix: add snowblocks in chunk above -- light crafting gives 8 lights
-- mid colour water at y == 2
-- flatter lowlands: terblen exponent, vary canexp, canamp
-- grassy sides on mod grass
-- Parameters -- Parameters
@ -20,9 +23,9 @@ local CLOUDS = true -- Mod clouds?
local TERSCA = 512 -- Vertical terrain scale local TERSCA = 512 -- Vertical terrain scale
local XLSAMP = 0.2 -- Extra large scale height variation amplitude local XLSAMP = 0.2 -- Extra large scale height variation amplitude
local BASAMP = 0.4 -- Base terrain amplitude local BASAMP = 0.4 -- Base terrain amplitude
local CANAMP = 0.4 -- Canyon terrain amplitude local CANAMP = 0.4 -- Canyon terrain maximum amplitude
local CANEXP = 1.33 -- Canyon shape exponent
local ATANAMP = 1.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 TRIV = -0.02 -- Maximum densitybase threshold for river water local TRIV = -0.02 -- Maximum densitybase threshold for river water
@ -160,7 +163,7 @@ local np_base = {
scale = 1, scale = 1,
spread = {x=4096, y=4096, z=4096}, spread = {x=4096, y=4096, z=4096},
seed = 8890, seed = 8890,
octaves = 4, octaves = 3,
persist = 0.33 persist = 0.33
} }
@ -172,7 +175,7 @@ local np_xlscale = {
spread = {x=8192, y=8192, z=8192}, spread = {x=8192, y=8192, z=8192},
seed = -72, seed = -72,
octaves = 3, octaves = 3,
persist = 0.4 persist = 0.33
} }
-- 2D noise for magma surface -- 2D noise for magma surface
@ -242,6 +245,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_wsfreshwater = minetest.get_content_id("watershed:freshwater") local c_wsfreshwater = minetest.get_content_id("watershed:freshwater")
local c_wsmixwater = minetest.get_content_id("watershed:mixwater")
local c_wsstone = minetest.get_content_id("watershed:stone") local c_wsstone = minetest.get_content_id("watershed:stone")
local c_wsredstone = minetest.get_content_id("watershed:redstone") local c_wsredstone = minetest.get_content_id("watershed:redstone")
local c_wsgrass = minetest.get_content_id("watershed:grass") local c_wsgrass = minetest.get_content_id("watershed:grass")
@ -304,12 +308,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
local n_xlscale = nvals_xlscale[nixz] local n_xlscale = nvals_xlscale[nixz]
local n_magma = nvals_magma[nixz] local n_magma = nvals_magma[nixz]
-- get densitybase and density -- get densitybase and density
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP -- vertical density gradient local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad -- base terrain local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad
local terblen = math.max(1 - math.abs(n_base), 0) -- canyon terrain blend of rough and smooth local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP
local density = densitybase + -- add canyon terrain local canexp = 0.5 + terblen
local canamp = 0.03 + terblen * CANAMP
local density = densitybase +
math.abs((n_rough + n_roughalt) * 0.5 * terblen + math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.25 * (1 - terblen)) ^ CANEXP * CANAMP (n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp
-- other values -- other values
local triv = TRIV * (1 - terblen) -- river threshold local triv = TRIV * (1 - terblen) -- river threshold
local tsand = TSAND * (1 - terblen) -- sand threshold local tsand = TSAND * (1 - terblen) -- sand threshold
@ -396,8 +402,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
stable[si] = 1 stable[si] = 1
under[si] = 0 under[si] = 0
elseif density >= tstone and nofis -- stone cut by fissures elseif density >= tstone and nofis -- stone cut by fissures
or (density >= tstone and density < TSTONE * 2 and y <= YWAT) -- stone around water or (density >= tstone and density < TSTONE * 1.5 and y <= YWAT) -- stone around water
or (density >= tstone and density < TSTONE * 2 and densitybase >= triv ) then -- stone around river or (density >= tstone and density < TSTONE * 1.5 and densitybase >= triv ) then -- stone around river
local densitystr = n_strata * 0.25 + (TERCEN - y) / TERSCA local densitystr = n_strata * 0.25 + (TERCEN - y) / TERSCA
local densityper = densitystr - math.floor(densitystr) -- periodic strata 'density' local densityper = densitystr - math.floor(densitystr) -- periodic strata 'density'
if (densityper >= 0.05 and densityper <= 0.09) -- sandstone strata if (densityper >= 0.05 and densityper <= 0.09) -- sandstone strata
@ -408,7 +414,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
or (densityper >= 0.84 and densityper <= 0.87) or (densityper >= 0.84 and densityper <= 0.87)
or (densityper >= 0.95 and densityper <= 0.98) then or (densityper >= 0.95 and densityper <= 0.98) then
data[vi] = c_sandstone data[vi] = c_sandstone
elseif biome == 7 and density < TSTONE * 4 then -- desert stone as surface layer elseif biome == 7 and density < TSTONE * 3 then -- desert stone as surface layer
data[vi] = c_wsredstone data[vi] = c_wsredstone
elseif math.abs(n_seam) < SEAMT then elseif math.abs(n_seam) < SEAMT then
if densityper >= 0 and densityper <= ORETHI * 4 then -- ore seams if densityper >= 0 and densityper <= ORETHI * 4 then -- ore seams
@ -491,7 +497,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
stable[si] = 0 stable[si] = 0
under[si] = 0 under[si] = 0
end end
elseif y >= YWAT - bergdep and y <= YWAT + bergdep / 8 and n_temp < ICETET -- iceberg elseif y >= YWAT - bergdep and y <= YWAT + bergdep / 8 and n_temp < ICETET -- icesheet
and density < tstone and math.abs(n_fissure) > 0.01 then and density < tstone and math.abs(n_fissure) > 0.01 then
data[vi] = c_ice data[vi] = c_ice
under[si] = 12 under[si] = 12
@ -503,9 +509,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif densitybase >= triv and density < tstone then -- river water not in fissures elseif densitybase >= triv and density < tstone then -- river water not in fissures
if n_temp < ICETET then if n_temp < ICETET then
data[vi] = c_wsfreshice data[vi] = c_wsfreshice
else
if y == YWAT + 1 then
data[vi] = c_wsmixwater
else else
data[vi] = c_wsfreshwater data[vi] = c_wsfreshwater
end end
end
stable[si] = 0 stable[si] = 0
under[si] = 0 under[si] = 0
elseif CLOUDS and y == y1 and y >= YCLOMIN then -- clouds elseif CLOUDS and y == y1 and y >= YCLOMIN then -- clouds
@ -598,7 +608,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
if math.random(PAPCHA) == 2 then if math.random(PAPCHA) == 2 then
watershed_papyrus(x, y, z, area, data) watershed_papyrus(x, y, z, area, data)
end end
elseif under[si] == 12 and n_humid > LOHUT then -- snowy iceberg elseif under[si] == 12
and n_humid > LOHUT + (math.random() - 0.5) * BLEND then -- snowy iceberg
data[vi] = c_snowblock data[vi] = c_snowblock
end end
end end

View File

@ -85,7 +85,7 @@ minetest.register_node("watershed:icydirt", {
minetest.register_node("watershed:grass", { minetest.register_node("watershed:grass", {
description = "WS Grass", description = "WS Grass",
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, tiles = {"default_grass.png", "default_dirt.png", "default_grass.png"},
is_ground_content = false, is_ground_content = false,
groups = {crumbly=3,soil=1}, groups = {crumbly=3,soil=1},
drop = "default:dirt", drop = "default:dirt",
@ -278,8 +278,8 @@ minetest.register_node("watershed:freshwater", {
liquid_alternative_source = "watershed:freshwater", liquid_alternative_source = "watershed:freshwater",
liquid_viscosity = WATER_VISC, liquid_viscosity = WATER_VISC,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 2, liquid_range = 4,
post_effect_color = {a=64, r=100, g=100, b=200}, post_effect_color = {a=64, r=100, g=150, b=200},
groups = {water=3, liquid=3, puts_out_fire=1}, groups = {water=3, liquid=3, puts_out_fire=1},
}) })
@ -315,8 +315,8 @@ minetest.register_node("watershed:freshwaterflow", {
liquid_alternative_source = "watershed:freshwater", liquid_alternative_source = "watershed:freshwater",
liquid_viscosity = WATER_VISC, liquid_viscosity = WATER_VISC,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 2, liquid_range = 4,
post_effect_color = {a=64, r=100, g=100, b=200}, post_effect_color = {a=64, r=100, g=150, b=200},
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1}, groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
}) })
@ -395,6 +395,81 @@ minetest.register_node("watershed:lavaflow", {
groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1}, groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
}) })
minetest.register_node("watershed:mixwater", {
description = "WS Mixed Water Source",
inventory_image = minetest.inventorycube("watershed_mixwater.png"),
drawtype = "liquid",
tiles = {
{
name="watershed_mixwateranim.png",
animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2.0}
}
},
special_tiles = {
{
name="watershed_mixwateranim.png",
animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2.0},
backface_culling = false,
}
},
alpha = WATER_ALPHA,
paramtype = "light",
is_ground_content = false,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "watershed:mixwaterflow",
liquid_alternative_source = "watershed:mixwater",
liquid_viscosity = WATER_VISC,
liquid_renewable = false,
liquid_range = 4,
post_effect_color = {a=64, r=100, g=120, b=200},
groups = {water=3, liquid=3, puts_out_fire=1},
})
minetest.register_node("watershed:mixwaterflow", {
description = "WS Flowing Mixed Water",
inventory_image = minetest.inventorycube("watershed_mixwater.png"),
drawtype = "flowingliquid",
tiles = {"watershed_mixwater.png"},
special_tiles = {
{
image="watershed_mixwaterflowanim.png",
backface_culling=false,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
},
{
image="watershed_mixwaterflowanim.png",
backface_culling=true,
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
},
},
alpha = WATER_ALPHA,
paramtype = "light",
paramtype2 = "flowingliquid",
is_ground_content = false,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "watershed:mixwaterflow",
liquid_alternative_source = "watershed:mixwater",
liquid_viscosity = WATER_VISC,
liquid_renewable = false,
liquid_range = 4,
post_effect_color = {a=64, r=100, g=120, b=200},
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
})
-- Items -- Items
minetest.register_craftitem("watershed:luxcrystal", { minetest.register_craftitem("watershed:luxcrystal", {
@ -411,10 +486,11 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "watershed:light", output = "watershed:light 8",
recipe = { recipe = {
{"default:glass"}, {"default:glass", "default:glass", "default:glass"},
{"watershed:luxcrystal"}, {"default:glass", "watershed:luxcrystal", "default:glass"},
{"default:glass", "default:glass", "default:glass"},
}, },
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB