forest soil near some pebbles

master
Mossmanikin 2013-09-20 00:08:58 +02:00
parent cb5fd2e0e6
commit 069387dab5
2 changed files with 45 additions and 9 deletions

View File

@ -1,6 +1,11 @@
-- generating of forest soils
abstract_forestsoils.place_soil = function(pos)
if minetest.find_node_near(pos, 3, {"group:tree"}) then
minetest.add_node(pos, {name="forestsoils:dirt_with_leaves_1"})
local node_here = minetest.get_node(pos)
if minetest.registered_nodes[node_here.name] then -- instead of check_air = true,
if minetest.find_node_near(pos, 3, {"group:tree"}) then
minetest.add_node(pos, {name="forestsoils:dirt_with_leaves_1"})
end
end
end
@ -19,9 +24,34 @@ plantslib:register_generate_plant({
"abstract_forestsoils.place_soil"
)
abstract_forestsoils.place_soil_1 = function(pos)
local node_here = minetest.get_node(pos)
local node_above = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if minetest.registered_nodes[node_here.name] then -- instead of check_air = true,
if string.find(node_above.name, "bush") -- doesn't work, just here as a "reminder"
or string.find(node_above.name, "pebble") then
minetest.add_node(pos, {name="forestsoils:dirt_with_leaves_1"})
end
end
end
plantslib:register_generate_plant({
surface = {"default:dirt_with_grass"},
max_count = 6400,
rarity = 67,
min_elevation = 1,
plantlife_limit = -1,
check_air = false,
},
"abstract_forestsoils.place_soil_1"
)
abstract_forestsoils.place_soil_2 = function(pos)
if minetest.find_node_near(pos, 1, {"forestsoils:dirt_with_leaves_1"}) then
minetest.add_node(pos, {name="forestsoils:grass_with_leaves_2"})
local node_here = minetest.get_node(pos)
if minetest.registered_nodes[node_here.name] then -- instead of check_air = true,
if minetest.find_node_near(pos, 1, {"forestsoils:dirt_with_leaves_1"}) then
minetest.add_node(pos, {name="forestsoils:grass_with_leaves_2"})
end
end
end
@ -37,8 +67,11 @@ plantslib:register_generate_plant({
)
abstract_forestsoils.place_soil_3 = function(pos)
if minetest.find_node_near(pos, 1, {"forestsoils:grass_with_leaves_2"}) then
minetest.add_node(pos, {name="forestsoils:grass_with_leaves_1"})
local node_here = minetest.get_node(pos)
if minetest.registered_nodes[node_here.name] then -- instead of check_air = true,
if minetest.find_node_near(pos, 1, {"forestsoils:grass_with_leaves_2"}) then
minetest.add_node(pos, {name="forestsoils:grass_with_leaves_1"})
end
end
end
@ -54,8 +87,11 @@ plantslib:register_generate_plant({
)
abstract_forestsoils.place_soil_4 = function(pos)
if minetest.find_node_near(pos, 1, {"forestsoils:dirt_with_leaves_1"}) then
minetest.add_node(pos, {name="forestsoils:dirt_with_leaves_2"})
local node_here = minetest.get_node(pos)
if minetest.registered_nodes[node_here.name] then -- instead of check_air = true,
if minetest.find_node_near(pos, 1, {"forestsoils:dirt_with_leaves_1"}) then
minetest.add_node(pos, {name="forestsoils:dirt_with_leaves_2"})
end
end
end

View File

@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------
local title = "Forrest Soils"
local version = "0.0.3"
local version = "0.0.4"
local mname = "forestsoils"
-----------------------------------------------------------------------------------------------