add pseudoexponential decay to last-move smoke intensity (so it doesn't stay intense indefinitely after a large capture)

master
alexbobp 8 months ago
parent b6fdf54334
commit 4b7005f856
  1. 10
      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

Loading…
Cancel
Save