Register buckets. remove leafdecay, grass function. watershed:appleaf. tune temp/humid params

This commit is contained in:
paramat 2014-03-31 05:16:20 +01:00
parent 0314e6f2ed
commit 1049f85e88
5 changed files with 62 additions and 71 deletions

View File

@ -1,4 +1,4 @@
watershed 0.2.14 by paramat watershed 0.2.15 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

@ -1 +1,2 @@
default default
bucket

View File

@ -1,7 +1,7 @@
function watershed_appletree(x, y, z, area, data) function watershed_appletree(x, y, z, area, data)
local c_tree = minetest.get_content_id("default:tree") local c_tree = minetest.get_content_id("default:tree")
local c_apple = minetest.get_content_id("default:apple") local c_apple = minetest.get_content_id("default:apple")
local c_leaves = minetest.get_content_id("default:leaves") local c_wsappleaf = minetest.get_content_id("watershed:appleleaf")
for j = -2, 4 do for j = -2, 4 do
if j >= 1 then if j >= 1 then
for i = -2, 2 do for i = -2, 2 do
@ -9,8 +9,8 @@ function watershed_appletree(x, y, z, area, data)
local vil = area:index(x + i, y + j + 1, z + k) local vil = area:index(x + i, y + j + 1, z + k)
if math.random(48) == 2 then if math.random(48) == 2 then
data[vil] = c_apple data[vil] = c_apple
elseif math.random(3) ~= 2 then elseif math.random(5) ~= 2 then
data[vil] = c_leaves data[vil] = c_wsappleaf
end end
end end
end end
@ -124,8 +124,8 @@ end
function watershed_acaciatree(x, y, z, area, data) function watershed_acaciatree(x, y, z, area, data)
local c_tree = minetest.get_content_id("default:tree") local c_tree = minetest.get_content_id("default:tree")
local c_leaves = minetest.get_content_id("default:leaves") local c_leaves = minetest.get_content_id("default:leaves")
for j = -3, 7 do for j = -3, 6 do
if j == 7 then if j == 6 then
for i = -4, 4 do for i = -4, 4 do
for k = -4, 4 do for k = -4, 4 do
if not (i == 0 or k == 0) then if not (i == 0 or k == 0) then
@ -136,14 +136,14 @@ function watershed_acaciatree(x, y, z, area, data)
end end
end end
end end
elseif j == 6 then elseif j == 5 then
for i = -2, 2, 4 do for i = -2, 2, 4 do
for k = -2, 2, 4 do for k = -2, 2, 4 do
local vit = area:index(x + i, y + j, z + k) local vit = area:index(x + i, y + j, z + k)
data[vit] = c_tree data[vit] = c_tree
end end
end end
elseif j == 5 then elseif j == 4 then
for i = -1, 1 do for i = -1, 1 do
for k = -1, 1 do for k = -1, 1 do
if math.abs(i) + math.abs(k) == 2 then if math.abs(i) + math.abs(k) == 2 then
@ -159,26 +159,6 @@ function watershed_acaciatree(x, y, z, area, data)
end end
end end
function watershed_grass(data, vi)
local c_grass1 = minetest.get_content_id("default:grass_1")
local c_grass2 = minetest.get_content_id("default:grass_2")
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 ran = math.random(5)
if ran == 1 then
data[vi] = c_grass1
elseif ran == 2 then
data[vi] = c_grass2
elseif ran == 3 then
data[vi] = c_grass3
elseif ran == 4 then
data[vi] = c_grass4
else
data[vi] = c_grass5
end
end
function watershed_flower(data, vi, noise) 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")
@ -222,26 +202,27 @@ function watershed_papyrus(x, y, z, area, data)
end end
end end
-- ABMs -- Register buckets, lava fuel
minetest.register_abm({ bucket.register_liquid(
nodenames = {"watershed:lavaflow"}, "watershed:water",
neighbors = {"group:water"}, "watershed:waterflow",
interval = 1, "watershed:bucket_water",
chance = 11, "bucket_water.png",
action = function(pos, node, active_object_count, active_object_count_wider) "WS Water Bucket"
minetest.set_node(pos, {name="watershed:stone"}) )
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
end,
})
minetest.register_abm({ bucket.register_liquid(
nodenames = {"watershed:lava"}, "watershed:lava",
neighbors = {"group:water"}, "watershed:lavaflow",
interval = 1, "watershed:bucket_lava",
chance = 11, "bucket_lava.png",
action = function(pos, node, active_object_count, active_object_count_wider) "WS Lava Bucket"
minetest.set_node(pos, {name="default:obsidian"}) )
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
end, minetest.register_craft({
type = "fuel",
recipe = "watershed:bucket_lava",
burntime = 60,
replacements = {{"watershed:bucket_lava", "bucket:bucket_empty"}},
}) })

View File

@ -1,15 +1,15 @@
-- watershed 0.2.14 by paramat -- watershed 0.2.15 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
-- new pine tree -- register bucket water lava
-- magma rises to surface along ridges -- remove leaves from leafdecay, grass function
-- lavacooling abms -- appleleaf mod node
-- TODO -- TODO
-- magma rising at ridges
-- all tree heights vary -- all tree heights vary
-- fog -- fog
-- register bucket water lava
-- singlenode option -- singlenode option
-- Parameters -- Parameters
@ -25,24 +25,23 @@ 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 amplitude
local CANEXP = 1.33 -- Canyon shape exponent local CANEXP = 1.33 -- Canyon shape exponent
local ATANAMP = 1.2 -- 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 TSTONE = 0.01 -- Density threshold for stone, depth of soil at TERCEN local TSTONE = 0.01 -- Density threshold for stone, depth of soil at TERCEN
local TRIV = -0.015 -- Maximum densitybase threshold for river water local TRIV = -0.015 -- Maximum densitybase threshold for river water
local TSAND = -0.018 -- Maximum densitybase threshold for river sand local TSAND = -0.018 -- Maximum densitybase threshold for river sand
local TLAVA = 2 -- Maximum densitybase threshold for lava
local FIST = 0 -- Fissure threshold at surface, controls size of fissure entrances at surface local FIST = 0 -- Fissure threshold at surface, controls size of fissure entrances at surface
local FISEXP = 0.02 -- Fissure expansion rate under surface local FISEXP = 0.02 -- Fissure expansion rate under surface
local ORETHI = 0.001 -- Ore seam thickness tuner local ORETHI = 0.001 -- Ore seam thickness tuner
local ORET = 0.02 -- Ore threshold for seam local ORET = 0.02 -- Ore threshold for seam
local TCLOUD = 0.5 -- Cloud threshold local TCLOUD = 0.5 -- Cloud threshold
local HITET = 0.5 -- High temperature threshold local HITET = 0.4 -- High temperature threshold
local LOTET = -0.5 -- Low .. local LOTET = -0.4 -- Low ..
local ICETET = -0.8 -- Ice .. local ICETET = -0.8 -- Ice ..
local HIHUT = 0.5 -- High humidity threshold local HIHUT = 0.4 -- High humidity threshold
local MIDHUT = 0 -- Mid .. local MIDHUT = 0 -- Mid ..
local LOHUT = -0.5 -- Low .. local LOHUT = -0.4 -- Low ..
local CLOHUT = 0 -- Cloud humidity threshold local CLOHUT = 0 -- Cloud humidity threshold
local DCLOHUT = 1 -- Dark cloud .. local DCLOHUT = 1 -- Dark cloud ..
@ -256,6 +255,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_sandstone = minetest.get_content_id("default:sandstone") local c_sandstone = minetest.get_content_id("default:sandstone")
local c_gravel = minetest.get_content_id("default:gravel") local c_gravel = minetest.get_content_id("default:gravel")
local c_clay = minetest.get_content_id("default:clay") local c_clay = minetest.get_content_id("default:clay")
local c_grass5 = minetest.get_content_id("default:grass_5")
local c_wswater = minetest.get_content_id("watershed:water") local c_wswater = minetest.get_content_id("watershed:water")
local c_wsstone = minetest.get_content_id("watershed:stone") local c_wsstone = minetest.get_content_id("watershed:stone")
@ -311,7 +311,6 @@ 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 tlava = TLAVA * (1 - terblen ^ 10)
local density local density
if nvals_fault[nixyz] >= 0 then if nvals_fault[nixyz] >= 0 then
density = densitybase density = densitybase
@ -379,11 +378,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
if density >= TSTONE and densitybase >= tlava then if density >= tstone and nofis -- stone cut by fissures
data[vi] = c_wslava
stable[si] = 0
under[si] = 0
elseif density >= tstone and nofis -- stone cut by fissures
or (density >= tstone and density < TSTONE * 3 and y <= YWAT) -- stone around water or (density >= tstone and density < TSTONE * 3 and y <= YWAT) -- stone around water
or (density >= tstone and density < TSTONE * 3 and densitybase >= triv ) then -- stone around river or (density >= tstone and density < TSTONE * 3 and densitybase >= triv ) then -- stone around river
local densitystr = nvals_strata[nixyz] / 4 + (TERCEN - y) / TERSCA local densitystr = nvals_strata[nixyz] / 4 + (TERCEN - y) / TERSCA
@ -528,7 +523,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
watershed_flower(data, vi, fnoise) 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) data[vi] = c_grass5
end end
end end
elseif under[si] == 3 then elseif under[si] == 3 then
@ -545,7 +540,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
if math.random(FLOCHA) == 2 then if math.random(FLOCHA) == 2 then
watershed_flower(data, vi, fnoise) watershed_flower(data, vi, fnoise)
elseif math.random(GRACHA) == 2 then elseif math.random(GRACHA) == 2 then
watershed_grass(data, vi) data[vi] = c_grass5
end end
elseif under[si] == 8 then elseif under[si] == 8 then
if math.random(JUTCHA) == 2 then if math.random(JUTCHA) == 2 then

View File

@ -1,8 +1,22 @@
minetest.register_node("watershed:appleleaf", {
description = "WS Appletree Leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tiles = {"default_leaves.png"},
paramtype = "light",
is_ground_content = false,
groups = {snappy=3, flammable=2, leaves=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("watershed:needles", { minetest.register_node("watershed:needles", {
description = "WS Pine Needles", description = "WS Pine Needles",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tiles = {"watershed_needles.png"}, tiles = {"watershed_needles.png"},
paramtype = "light",
is_ground_content = false, is_ground_content = false,
groups = {snappy=3, leafdecay=3}, groups = {snappy=3},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -13,7 +27,7 @@ minetest.register_node("watershed:jungleleaf", {
tiles = {"default_jungleleaves.png"}, tiles = {"default_jungleleaves.png"},
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
groups = {snappy=3, leafdecay=4, flammable=2, leaves=1}, groups = {snappy=3, flammable=2, leaves=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -249,7 +263,7 @@ minetest.register_node("watershed:lava", {
liquid_alternative_source = "watershed:lava", liquid_alternative_source = "watershed:lava",
liquid_viscosity = LAVA_VISC, liquid_viscosity = LAVA_VISC,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 0, liquid_range = 2,
damage_per_second = 8, damage_per_second = 8,
post_effect_color = {a=192, r=255, g=64, b=0}, post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=2, hot=3, igniter=1}, groups = {lava=3, liquid=2, hot=3, igniter=1},
@ -288,7 +302,7 @@ minetest.register_node("watershed:lavaflow", {
liquid_alternative_source = "watershed:lava", liquid_alternative_source = "watershed:lava",
liquid_viscosity = LAVA_VISC, liquid_viscosity = LAVA_VISC,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 0, liquid_range = 2,
damage_per_second = 8, damage_per_second = 8,
post_effect_color = {a=192, r=255, g=64, b=0}, post_effect_color = {a=192, r=255, g=64, b=0},
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},