Make blossom revert back to regular leaves

It didn't, so that all apple leaves would permanently become blossom
over time.
This commit is contained in:
Rogier 2015-04-02 12:16:50 +02:00
parent f2abf39047
commit bb41483ee9
2 changed files with 7 additions and 6 deletions

View File

@ -36,7 +36,7 @@ minetest.register_abm({
chance = nature.blossom_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
nature.enqueue_node(pos, node, true)
nature.enqueue_node(pos, node, nature.blossom_node)
end
})
@ -47,7 +47,7 @@ minetest.register_abm({
chance = nature.blossom_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
nature.enqueue_node(pos, node, false)
nature.enqueue_node(pos, node, nature.blossom_leaves)
end
})

View File

@ -5,21 +5,22 @@ minetest.register_globalstep(function(dtime)
if #nature.blossomqueue > 0 and dtime < 0.2 then
local pos = nature.blossomqueue[1][1]
local node = nature.blossomqueue[1][2]
if (nature.blossomqueue[1][3] and not nature:is_near_water(pos)) then
local replace = nature.blossomqueue[1][3]
if (nature.blossomqueue[1][3] == nature.blossom_node and not nature:is_near_water(pos)) then
table.remove(nature.blossomqueue, 1) -- don't grow if it's not near water, pop from queue.
return
end
nature:grow_node(pos, nature.blossom_node) -- now actually grow it.
nature:grow_node(pos, replace) -- now actually grow it.
table.remove(nature.blossomqueue, 1)
end
end)
function nature.enqueue_node(pos, node, fcn)
function nature.enqueue_node(pos, node, replace)
local idx = #nature.blossomqueue
nature.blossomqueue[idx+1] = {}
nature.blossomqueue[idx+1][1] = pos
nature.blossomqueue[idx+1][2] = node
nature.blossomqueue[idx+1][3] = fcn
nature.blossomqueue[idx+1][3] = replace
end
local function set_young_node(pos)