forked from mtcontrib/plantlife_modpack
Fixed a minor bug, made growing abm always check for grow_nodes
under the plant to be grown and to check for air above it.
This commit is contained in:
parent
693f59a3fc
commit
e327630ea5
16
API.txt
16
API.txt
@ -198,13 +198,12 @@ gresult: Name of the node into which the above should transform
|
|||||||
dry_early_node: This value is ignored except for jungle grass, where it
|
dry_early_node: This value is ignored except for jungle grass, where it
|
||||||
indicates which node the grass must be on in order for it
|
indicates which node the grass must be on in order for it
|
||||||
to turn from "short" to default:dry_shrub.
|
to turn from "short" to default:dry_shrub.
|
||||||
grow_nodes: This node must be under the plant in order for it to grow
|
grow_nodes: One of these nodes must be under the plant in order for it to
|
||||||
at all. Normally this should be the same as the list of
|
grow at all. Normally this should be the same as the list of
|
||||||
surfaces passed to the spawning ABM as the "nodenames"
|
surfaces passed to the spawning ABM as the "nodenames"
|
||||||
parameter, such as {"default:dirt_with_grass",
|
parameter. This is so that the plant can be manually placed
|
||||||
"default:sand"}. This is so that the plant can be
|
on something like a flower pot or something without it growing
|
||||||
manually placed on something like a flower pot or
|
and eventually dieing. Defaults to "default:dirt_with_grass".
|
||||||
something without it growing and eventually dieing.
|
|
||||||
facedir: Same as with spawning a plant. If supplied, this value is
|
facedir: Same as with spawning a plant. If supplied, this value is
|
||||||
passed to the param2 variable when changing the plant. If
|
passed to the param2 variable when changing the plant. If
|
||||||
nil or left out, no new param2 value is applied.
|
nil or left out, no new param2 value is applied.
|
||||||
@ -229,8 +228,9 @@ grow_function: String indicating what function to use to grow the plant, if
|
|||||||
parameter for the current position, followed by the "can grow
|
parameter for the current position, followed by the "can grow
|
||||||
here" and temperature map Perlin values at that location. If
|
here" and temperature map Perlin values at that location. If
|
||||||
it's a table, the tree described by that table is spawned at
|
it's a table, the tree described by that table is spawned at
|
||||||
the current position. In both cases, all parameters from
|
the current position. In both string and table cases, all
|
||||||
gresult to ground_nodes are ignored.
|
parameters from gresult to ground_nodes, except for
|
||||||
|
grow_nodes, are ignored.
|
||||||
seed_diff: The Perlin seed diff to be use to calculate the first noise
|
seed_diff: The Perlin seed diff to be use to calculate the first noise
|
||||||
value given to the above grow_function. Should be the same as
|
value given to the above grow_function. Should be the same as
|
||||||
the seed diff used when first spawning the plant that's being
|
the seed diff used when first spawning the plant that's being
|
||||||
|
@ -213,7 +213,7 @@ function plantslib:grow_plants(
|
|||||||
if need_wall ~= true then need_wall = false end
|
if need_wall ~= true then need_wall = false end
|
||||||
if grow_vertically ~= true then grow_vertically = false end
|
if grow_vertically ~= true then grow_vertically = false end
|
||||||
if height_limit == nil then height_limit = 62000 end
|
if height_limit == nil then height_limit = 62000 end
|
||||||
if ground_node == nil then ground_nodes = { "default:dirt_with_grass" } end
|
if ground_nodes == nil then ground_nodes = { "default:dirt_with_grass" } end
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = { gplant },
|
nodenames = { gplant },
|
||||||
interval = gdelay,
|
interval = gdelay,
|
||||||
@ -223,9 +223,9 @@ function plantslib:grow_plants(
|
|||||||
local p_bot = {x=pos.x, y=pos.y-1, z=pos.z}
|
local p_bot = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
local n_top = minetest.env:get_node(p_top)
|
local n_top = minetest.env:get_node(p_top)
|
||||||
local n_bot = minetest.env:get_node(p_bot)
|
local n_bot = minetest.env:get_node(p_bot)
|
||||||
local groundnode = minetest.env:get_node({x=pos.x, y=pos.y-height_limit, z=pos.z})
|
local root_node = minetest.env:get_node({x=pos.x, y=pos.y-height_limit, z=pos.z})
|
||||||
if grow_function == nil then
|
|
||||||
if string.find(dump(grow_nodes), n_bot.name) ~= nil and n_top.name == "air" then
|
if string.find(dump(grow_nodes), n_bot.name) ~= nil and n_top.name == "air" then
|
||||||
|
if grow_function == nil then
|
||||||
if grow_vertically then
|
if grow_vertically then
|
||||||
if plantslib:find_first_node(pos, height_limit, ground_nodes) ~= nil then
|
if plantslib:find_first_node(pos, height_limit, ground_nodes) ~= nil then
|
||||||
if need_wall then
|
if need_wall then
|
||||||
@ -257,7 +257,6 @@ function plantslib:grow_plants(
|
|||||||
minetest.env:add_node(pos, { name = gresult, param2 = facedir })
|
minetest.env:add_node(pos, { name = gresult, param2 = facedir })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if seed_diff == nil then seed_diff = 0 end
|
if seed_diff == nil then seed_diff = 0 end
|
||||||
local perlin1 = minetest.env:get_perlin(seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
|
local perlin1 = minetest.env:get_perlin(seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
|
||||||
@ -274,6 +273,7 @@ function plantslib:grow_plants(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user