0
0
Fork 0

Use node texture for sprint particles

This commit is contained in:
Wuzzy 2020-07-10 14:23:03 +02:00
parent 6ba537a096
commit 1bfd4ca490
1 changed files with 20 additions and 14 deletions

View File

@ -88,23 +88,29 @@ minetest.register_globalstep(function(dtime)
players[playerName].sprintDistance = players[playerName].sprintDistance - superficial players[playerName].sprintDistance = players[playerName].sprintDistance - superficial
end end
-- Sprint dirt particles -- Sprint node particles
local numParticles = math.random(1, 2)
local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]}) local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]})
local def = minetest.registered_nodes[playerNode.name] local def = minetest.registered_nodes[playerNode.name]
if def and def.walkable then if def and def.walkable then
for i=1, numParticles, 1 do minetest.add_particlespawner({
minetest.add_particle({ amount = math.random(1, 2),
pos = {x=playerPos["x"]+math.random(-1,1)*math.random()/2,y=playerPos["y"]+0.1,z=playerPos["z"]+math.random(-1,1)*math.random()/2}, time = 1,
velocity = {x=0, y=5, z=0}, minpos = {x=-0.5, y=0.1, z=-0.5},
acceleration = {x=0, y=-13, z=0}, maxpos = {x=0.5, y=0.1, z=0.5},
expirationtime = math.random(), minvel = {x=0, y=5, z=0},
size = math.random()+0.5, maxvel = {x=0, y=5, z=0},
collisiondetection = true, minacc = {x=0, y=-13, z=0},
vertical = false, maxacc = {x=0, y=-13, z=0},
texture = "default_dirt.png", minexptime = 0.1,
}) maxexptime = 1,
end minsize = 0.5,
maxsize = 1.5,
collisiondetection = true,
attached = player,
vertical = false,
node = playerNode,
node_tile = 1,
})
end end
end end