Skip to content
Permalink
Browse files

Leafdecay: Do not restart aready running timers

  • Loading branch information...
paramat committed Mar 30, 2017
1 parent acfd58c commit 9e4f0d368969d2b80ac93cf64bc9fe4a5fad614f
Showing with 3 additions and 2 deletions.
  1. +3 −2 mods/default/functions.lua
@@ -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

0 comments on commit 9e4f0d3

Please sign in to comment.
You can’t perform that action at this time.