add particles to tree capitator
parent
0e1673686b
commit
d50eb4aa41
32
api.lua
32
api.lua
|
@ -386,6 +386,38 @@ function obsidianmese.dig_up(pos, node, digger)
|
||||||
|
|
||||||
minetest.node_dig(np, nn, 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
|
if #branches_pos > 0 then
|
||||||
for i = 1, #branches_pos do
|
for i = 1, #branches_pos do
|
||||||
-- prevent infinite loop when node protected
|
-- prevent infinite loop when node protected
|
||||||
|
|
Loading…
Reference in New Issue