Minor particles optimisation
This commit is contained in:
parent
78007fa332
commit
35ddb6c038
1 changed files with 6 additions and 8 deletions
|
@ -146,16 +146,14 @@ shooter.spawn_particles = function(pos, particles)
|
||||||
if not config.enable_particle_fx == true or particles.amount == 0 then
|
if not config.enable_particle_fx == true or particles.amount == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local copy = function(v)
|
|
||||||
return type(v) == "table" and table.copy(v) or v
|
|
||||||
end
|
|
||||||
local p = {}
|
|
||||||
for k, v in pairs(shooter.default_particles) do
|
for k, v in pairs(shooter.default_particles) do
|
||||||
p[k] = particles[k] and copy(particles[k]) or copy(v)
|
if not particles[k] then
|
||||||
|
particles[k] = type(v) == "table" and table.copy(v) or v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
p.minpos = vector.subtract(pos, p.minpos)
|
particles.minpos = vector.subtract(pos, particles.minpos)
|
||||||
p.maxpos = vector.add(pos, p.maxpos)
|
particles.maxpos = vector.add(pos, particles.maxpos)
|
||||||
minetest.add_particlespawner(p)
|
minetest.add_particlespawner(particles)
|
||||||
end
|
end
|
||||||
|
|
||||||
shooter.play_node_sound = function(node, pos)
|
shooter.play_node_sound = function(node, pos)
|
||||||
|
|
Loading…
Reference in a new issue