Modify leaf decay

master
oilboi 2019-04-15 20:18:56 -04:00
parent f19092154f
commit c71d752e14
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
--gets called when leaf decay timer ends
function leafdecay_on_timer(pos)
if minetest.find_node_near(pos, 2, "nodes:tree") then
return false
@ -23,14 +23,13 @@ function leafdecay_on_timer(pos)
mining_particle_explosion(tile,pos,20,0.5,1.5,1)
end
--starts leaf decay timer when you mine tree
function leafdecay_after_destruct(pos, oldnode)
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, 2),
vector.add(pos, 2), "nodes:leaves")) do
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, 3),vector.add(pos, 3), "nodes:leaves")) do
local node = minetest.get_node(v)
local timer = minetest.get_node_timer(v)
if node.param2 == 0 and not timer:is_started() then
timer:start(0)--(math.random(20, 120) / 10)
timer:start(math.random())--(math.random(20, 120) / 10)
end
end
end

View File

@ -308,10 +308,6 @@ for name,def in pairs(minetest.registered_nodes) do
local sounds = def.sounds
local worldaligntex = false
print(dump(name))
print(dump(def))
-- Set backface culling and world-aligned textures
local stair_images = {}
for i, image in ipairs(images) do

View File

@ -0,0 +1,6 @@
--this has such a weird name to make sure it loads first
-- Set random seed for all other mods (Remember to make sure no other mod calls this function)
math.randomseed(os.time())
print("initialized math.random() seed")