Merge branch 'api-tweak'

This commit is contained in:
Vanessa Ezekowitz 2014-08-21 01:06:52 -04:00
commit a60f89a8a2
2 changed files with 14 additions and 5 deletions

View File

@ -331,7 +331,8 @@ biome = {
-- empty region above the spawn target.
-- Useful when adding trees to snow biomes.
-- Defaults to false.
spawn_replace_node = bool -- same as with the ABM spawner.
spawn_replace_node = bool, -- same as with the ABM spawner.
random_facedir = {table}, -- same as with the ABM spawner.
}
Regarding node_or_function_or_treedef, this must either be table with an

View File

@ -286,8 +286,12 @@ function plantslib:generate_block_with_air_checking(minp, maxp, blockseed)
plantslib:generate_tree(pos, node_or_function_or_model)
spawned = true
elseif objtype == "string" and
minetest.registered_nodes[node_or_function_or_model] then
minetest.set_node(p_top, { name = node_or_function_or_model })
minetest.registered_nodes[node_or_function_or_model] then
local fdir = nil
if biome.random_facedir then
fdir = math.random(biome.random_facedir[1], biome.random_facedir[2])
end
minetest.set_node(p_top, { name = node_or_function_or_model, param2 = fdir })
spawned = true
elseif objtype == "function" then
node_or_function_or_model(pos)
@ -402,8 +406,12 @@ function plantslib:generate_block_no_air_check(minp, maxp, blockseed)
plantslib:generate_tree(pos, node_or_function_or_model)
spawned = true
elseif objtype == "string" and
minetest.registered_nodes[node_or_function_or_model] then
minetest.set_node(p_top, { name = node_or_function_or_model })
minetest.registered_nodes[node_or_function_or_model] then
local fdir = nil
if biome.random_facedir then
fdir = math.random(biome.random_facedir[1], biome.random_facedir[2])
end
minetest.set_node(p_top, { name = node_or_function_or_model, param2 = fdir })
spawned = true
elseif objtype == "function" then
node_or_function_or_model(pos)