Update trees.lua
This commit is contained in:
parent
5a0f565d70
commit
e533d8ece7
|
@ -53,7 +53,7 @@ function default.grow_sapling(pos)
|
|||
if mg_name == "v6" then
|
||||
default.grow_tree(pos, random(1, 4) == 1)
|
||||
else
|
||||
default.grow_new_apple_tree(pos)
|
||||
default.grow_new_jogan_tree(pos)
|
||||
end
|
||||
elseif node.name == "default:junglesapling" then
|
||||
minetest.log("action", "A jungle sapling grows into a tree at "..
|
||||
|
@ -119,14 +119,14 @@ minetest.register_lbm({
|
|||
-- Tree generation
|
||||
--
|
||||
|
||||
-- Apple tree and jungle tree trunk and leaves function
|
||||
-- Jogan tree and jungle tree trunk and leaves function
|
||||
|
||||
local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
||||
height, size, iters, is_apple_tree)
|
||||
height, size, iters, is_jogan_tree)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
local c_jogan = minetest.get_content_id("default:joganfruit")
|
||||
|
||||
-- Trunk
|
||||
data[a:index(x, y, z)] = tree_cid -- Force-place lowest trunk node to replace sapling
|
||||
|
@ -144,8 +144,8 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
|||
local vi = a:index(x - 1, y + height + y_dist, z + z_dist)
|
||||
for x_dist = -1, 1 do
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if is_apple_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_apple
|
||||
if is_jogan_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_jogan
|
||||
else
|
||||
data[vi] = leaves_cid
|
||||
end
|
||||
|
@ -166,8 +166,8 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
|||
for zi = 0, 1 do
|
||||
local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if is_apple_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_apple
|
||||
if is_jogan_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_jogan
|
||||
else
|
||||
data[vi] = leaves_cid
|
||||
end
|
||||
|
@ -179,9 +179,9 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
|||
end
|
||||
|
||||
|
||||
-- Apple tree
|
||||
-- Jogan tree
|
||||
|
||||
function default.grow_tree(pos, is_apple_tree, bad)
|
||||
function default.grow_tree(pos, is_jogan_tree, bad)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
|
@ -204,7 +204,7 @@ function default.grow_tree(pos, is_apple_tree, bad)
|
|||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
|
||||
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
|
||||
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_jogan_tree)
|
||||
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
|
@ -391,11 +391,11 @@ function default.grow_pine_tree(pos, snow)
|
|||
end
|
||||
|
||||
|
||||
-- New apple tree
|
||||
-- New jogan tree
|
||||
|
||||
function default.grow_new_apple_tree(pos)
|
||||
function default.grow_new_jogan_tree(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/apple_tree_from_sapling.mts"
|
||||
"/schematics/jogan_tree_from_sapling.mts"
|
||||
minetest.place_schematic({x = pos.x - 3, y = pos.y - 1, z = pos.z - 3},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue