diff --git a/abm.lua b/abm.lua index 42d9cc1..c5ec8ad 100644 --- a/abm.lua +++ b/abm.lua @@ -1,6 +1,6 @@ -- LUALOCALS < --------------------------------------------------------- -local include, nodecore -= include, nodecore +local include, nodecore, math += include, nodecore, math -- LUALOCALS > --------------------------------------------------------- minetest.register_abm({ @@ -10,6 +10,12 @@ minetest.register_abm({ nodenames = {"group:go_stone"}, action = function(pos, node) if not (node.param2 == 0) then + -- if smoke level is higher than 1, it can decay (lazy pseudoexponential decay) + if math.random() < (0.01 * (node.param2 - 1)) then + node.param2 = node.param2 - 1 + minetest.swap_node(pos, node) + end + nodecore.smokefx(pos, 60, node.param2) end end