Interval = 60, chance = 20

This commit is contained in:
Kotolegokot 2012-11-07 15:47:21 +06:00
parent 757b5963f6
commit dd2469e071
2 changed files with 17 additions and 10 deletions

View File

@ -24,8 +24,8 @@ end)
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:sapling"}, nodenames = {"default:sapling"},
interval = 10, interval = 60,
chance = 50, chance = 20,
action = function(pos, node) action = function(pos, node)
if not minetest.env:get_node_light(pos) then if not minetest.env:get_node_light(pos) then
return return
@ -33,14 +33,17 @@ minetest.register_abm({
if minetest.env:get_node_light(pos) < 8 then if minetest.env:get_node_light(pos) < 8 then
return return
end end
for dy=1,5 do local height = math.random(4,5)
pos.y = pos.y+dy for y=1,4 do
if not minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then if not minetest.env:get_node({x=pos.x,y=pos.y+y,z=pos.z}).buildable_to then
return if y == 4 then
height = 4
else
return
end
end end
pos.y = pos.y-dy
end end
make_tree(pos, math.random(1,4)==1) make_tree(pos, math.random(1,4)==1, height)
end end
}) })

View File

@ -98,8 +98,12 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
end end
end end
function make_tree(pos, is_apple_tree) function make_tree(pos, is_apple_tree, height)
for _=1,math.random(4,5) do if not height then
height = math.random(4,5)
end
for _=1,height do
minetest.env:set_node(pos, {name="default:tree"}) minetest.env:set_node(pos, {name="default:tree"})
pos.y = pos.y+1 pos.y = pos.y+1
end end