Minor particles optimisation

This commit is contained in:
stujones11 2019-03-26 18:28:08 +00:00
parent 78007fa332
commit 35ddb6c038

View file

@ -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
p.minpos = vector.subtract(pos, p.minpos) end
p.maxpos = vector.add(pos, p.maxpos) particles.minpos = vector.subtract(pos, particles.minpos)
minetest.add_particlespawner(p) particles.maxpos = vector.add(pos, particles.maxpos)
minetest.add_particlespawner(particles)
end end
shooter.play_node_sound = function(node, pos) shooter.play_node_sound = function(node, pos)