Place grass under junglegrass

Don't turn dirt dry if junglegrass above
Start of activity-based vegetation growth
This commit is contained in:
James Stevenson 2016-01-21 09:01:14 -05:00
parent 9d8c0902aa
commit 0638ce9cfb
2 changed files with 11 additions and 2 deletions

View File

@ -113,6 +113,11 @@ minetest.register_abm({
interval = 2,
chance = 200,
action = function(pos, node)
local n = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name
if n == "default:junglegrass" or string.match(n, "default:grass_") then
minetest.set_node(pos, {name = "default:grass"})
return
end
if (minetest.find_node_near(pos, 6, {"group:water"}) and minetest.find_node_near(pos, 1, {"default:grass"})) or minetest.find_node_near(pos, 1, {"group:water"}) then
pos.y = pos.y+1
local nn = minetest.get_node(pos).name
@ -132,6 +137,10 @@ minetest.register_abm({
interval = 2,
chance = 20,
action = function(pos, node)
local n = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name
if n == "default:junglegrass" or string.match(n, "default:grass_") then
return
end
if not minetest.find_node_near(pos, 6, {"group:water"}) then
minetest.set_node(pos, {name="default:dry_dirt"})
else

View File

@ -202,8 +202,8 @@ minetest.register_abm({
return
end
if minetest.get_node(seedling).name == "air" then
minetest.set_node(seedling, {name=node.name})
minetest.set_node(seedling, {name = node.name})
end
end
end,
end
})