Merge pull request 'Give the arrows a far less laggy look with an attached particle spawner with critical shot.' (#2710) from Arrow_visual_preformance into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2710
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-10-05 00:07:12 +00:00
commit ae61c7835d

View File

@ -171,27 +171,23 @@ function ARROW_ENTITY.on_step(self, dtime)
if self._damage >= 9 and self._in_player == false then if self._damage >= 9 and self._in_player == false then
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 1, amount = 20,
time = .001, time = .2,
minpos = pos, minpos = vector.new(0,0,0),
maxpos = pos, maxpos = vector.new(0,0,0),
minvel = vector.new(-0.1,-0.1,-0.1), minvel = vector.new(-0.1,-0.1,-0.1),
maxvel = vector.new(0.1,0.1,0.1), maxvel = vector.new(0.1,0.1,0.1),
minexptime = 0.5, minexptime = 0.5,
maxexptime = 0.5, maxexptime = 0.5,
minsize = 2, minsize = 2,
maxsize = 2, maxsize = 2,
attached = self.object,
collisiondetection = false, collisiondetection = false,
vertical = false, vertical = false,
texture = "mobs_mc_arrow_particle.png", texture = "mobs_mc_arrow_particle.png",
glow = 1, glow = 1,
}) })
end end
-- We just check for any hurtable objects nearby.
-- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often.
-- TODO: Implement an ACTUAL collision detection (engine support needed).
local closest_object local closest_object
local closest_distance local closest_distance