Skip to content

Commit

Permalink
Leafdecay: Do not restart aready running timers
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Apr 11, 2017
1 parent acfd58c commit 9e4f0d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mods/default/functions.lua
Expand Up @@ -330,8 +330,9 @@ local function leafdecay_after_destruct(pos, oldnode, def)
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
vector.add(pos, def.radius), def.leaves)) do
local node = minetest.get_node(v)
if node.param2 == 0 then
minetest.get_node_timer(v):start(math.random(20, 120) / 10)
local timer = minetest.get_node_timer(v)
if node.param2 == 0 and not timer:is_started() then
timer:start(math.random(20, 120) / 10)
end
end
end
Expand Down

0 comments on commit 9e4f0d3

Please sign in to comment.