mirror of
https://github.com/HybridDog/nether-pack.git
synced 2025-01-13 19:30:26 +01:00
update nether tree loop, @Ombridride l hope it works for you, and fix missing degrotate paramtype2 of leaves
This commit is contained in:
parent
9cee9d0ec6
commit
163bd4a021
@ -741,14 +741,17 @@ function nether.grow_tree(pos, generated)
|
|||||||
local trunks = {}
|
local trunks = {}
|
||||||
local trunk_corners = {}
|
local trunk_corners = {}
|
||||||
local h_stem = math.random(h_stem_min, h_stem_max)
|
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 todo,n = {{x=pos.x, y=pos.y+h_stem, z=pos.z}},1
|
||||||
local fi
|
while n do
|
||||||
while not fi do
|
local p = todo[n]
|
||||||
for n,p in pairs(stems) do
|
todo[n] = nil
|
||||||
local used_dirs = {}
|
n = next(todo)
|
||||||
|
|
||||||
|
local used_dirs,u = {},1
|
||||||
for _,dir in pairs(dirs) do
|
for _,dir in pairs(dirs) do
|
||||||
if math.random(1,2) == 1 then
|
if math.random(1,2) == 1 then
|
||||||
table.insert(used_dirs, dir)
|
used_dirs[u] = dir
|
||||||
|
u = u+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not used_dirs[1] then
|
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
|
trunks[p.x.." "..p.y+i.." "..p.z] = true
|
||||||
end
|
end
|
||||||
p.y = p.y+h
|
p.y = p.y+h
|
||||||
table.insert(stems, p)
|
--n = #todo+1 -- causes small trees
|
||||||
|
todo[#todo+1] = p
|
||||||
end
|
end
|
||||||
if p.y > pos.y+h_trunk_max then
|
if p.y > pos.y+h_trunk_max then
|
||||||
fi = true
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
stems[n] = nil
|
|
||||||
end
|
n = n or next(todo)
|
||||||
end
|
end
|
||||||
local leaves = {}
|
local leaves = {}
|
||||||
local fruits = {}
|
local fruits = {}
|
||||||
|
@ -527,6 +527,7 @@ minetest.register_node("nether:leaves", {
|
|||||||
inventory_image = "nether_leaves.png",
|
inventory_image = "nether_leaves.png",
|
||||||
wield_image = "nether_leaves.png",
|
wield_image = "nether_leaves.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "degrotate",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {snappy=3, leafdecay=3, leaves=1},
|
groups = {snappy=3, leafdecay=3, leaves=1},
|
||||||
drop = {
|
drop = {
|
||||||
|
Loading…
Reference in New Issue
Block a user