diff --git a/api.lua b/api.lua index 517e4ff..3cb3da0 100644 --- a/api.lua +++ b/api.lua @@ -386,6 +386,38 @@ function obsidianmese.dig_up(pos, node, digger) minetest.node_dig(np, nn, digger) + -- try to find a node texture + local def = minetest.registered_nodes[nn.name] + local texture = "default_dirt.png" + + if def then + if def.tiles then + if #def.tiles > 0 then + if type(def.tiles[1]) == "string" then + texture = def.tiles[1] + end + end + end + end + + -- add particles only when not too far + minetest.add_particlespawner({ + amount = math.random(1, 3), + time = 0.5, + minpos = {x=np.x-0.7, y=np.y, z=np.z-0.7}, + maxpos = {x=np.x+0.7, y=np.y+0.75, z=np.z+0.7}, + minvel = {x = -0.5, y = -4, z = -0.5}, + maxvel = {x = 0.5, y = -2, z = 0.5}, + minacc = {x = -0.5, y = -4, z = -0.5}, + maxacc = {x = 0.5, y = -2, z = 0.5}, + minexptime = 0.5, + maxexptime = 1, + minsize = 0.5, + maxsize = 2, + collisiondetection = true, + texture = texture + }) + if #branches_pos > 0 then for i = 1, #branches_pos do -- prevent infinite loop when node protected