Leafdecay: Do not restart aready running timers
authorparamat <mat.gregory@virginmedia.com>
Thu, 30 Mar 2017 04:06:49 +0000 (05:06 +0100)
committerparamat <mat.gregory@virginmedia.com>
Tue, 11 Apr 2017 02:57:07 +0000 (03:57 +0100)
mods/default/functions.lua

index 8e9132d039be6ad246d5436b2086a0b16740e250..2268263e43f7d09ae618add288bb9e556d432ecf 100644 (file)
@@ -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