allow random_facedir parameter during mapgen call

This commit is contained in:
Vanessa Ezekowitz 2014-08-20 13:38:44 -04:00
parent 0f20658a2a
commit 9c7e96dd62
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

@ -287,7 +287,11 @@ function plantslib:generate_block_with_air_checking(minp, maxp, blockseed)
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 })
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)
@ -403,7 +407,11 @@ function plantslib:generate_block_no_air_check(minp, maxp, blockseed)
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 })
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)