update nether tree loop, @Ombridride l hope it works for you, and fix missing degrotate paramtype2 of leaves

This commit is contained in:
HybridDog 2016-01-10 12:28:15 +01:00
parent 9cee9d0ec6
commit 163bd4a021
2 changed files with 46 additions and 42 deletions

View File

@ -741,14 +741,17 @@ function nether.grow_tree(pos, generated)
local trunks = {}
local trunk_corners = {}
local h_stem = math.random(h_stem_min, h_stem_max)
local stems = {{x=pos.x, y=pos.y+h_stem, z=pos.z}}
local fi
while not fi do
for n,p in pairs(stems) do
local used_dirs = {}
local todo,n = {{x=pos.x, y=pos.y+h_stem, z=pos.z}},1
while n do
local p = todo[n]
todo[n] = nil
n = next(todo)
local used_dirs,u = {},1
for _,dir in pairs(dirs) do
if math.random(1,2) == 1 then
table.insert(used_dirs, dir)
used_dirs[u] = dir
u = u+1
end
end
if not used_dirs[1] then
@ -777,14 +780,14 @@ function nether.grow_tree(pos, generated)
trunks[p.x.." "..p.y+i.." "..p.z] = true
end
p.y = p.y+h
table.insert(stems, p)
--n = #todo+1 -- causes small trees
todo[#todo+1] = p
end
if p.y > pos.y+h_trunk_max then
fi = true
break
end
stems[n] = nil
end
n = n or next(todo)
end
local leaves = {}
local fruits = {}

View File

@ -527,6 +527,7 @@ minetest.register_node("nether:leaves", {
inventory_image = "nether_leaves.png",
wield_image = "nether_leaves.png",
paramtype = "light",
paramtype2 = "degrotate",
is_ground_content = false,
groups = {snappy=3, leafdecay=3, leaves=1},
drop = {