Improve bow/arrow physics

This commit is contained in:
Juraj Vajda 2022-10-30 10:54:11 -04:00
parent be4639044e
commit bfde48768e

32
api.lua
View File

@ -1324,21 +1324,23 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
local new_pos = selfObj.object:get_pos() local new_pos = selfObj.object:get_pos()
minetest.add_particlespawner({ if new_pos then
amount = 5, minetest.add_particlespawner({
time = 0.25, amount = 5,
minpos = {x = new_pos.x - 0.4, y = new_pos.y + 0.2, z = new_pos.z - 0.4}, time = 0.25,
maxpos = {x = new_pos.x + 0.4, y = new_pos.y + 0.3, z = new_pos.z + 0.4}, minpos = {x = new_pos.x - 0.4, y = new_pos.y + 0.2, z = new_pos.z - 0.4},
minvel = {x = 0, y = 3, z = 0}, maxpos = {x = new_pos.x + 0.4, y = new_pos.y + 0.3, z = new_pos.z + 0.4},
maxvel = {x = 0, y = 4, z = 0}, minvel = {x = 0, y = 3, z = 0},
minacc = {x = 0, y = -28, z = 0}, maxvel = {x = 0, y = 4, z = 0},
maxacc = {x = 0, y = -32, z = 0}, minacc = {x = 0, y = -28, z = 0},
minexptime = 1, maxacc = {x = 0, y = -32, z = 0},
maxexptime = 1.5, minexptime = 1,
node = {name = node_def.name}, maxexptime = 1.5,
collisiondetection = true, node = {name = node_def.name},
object_collision = true, collisiondetection = true,
}) object_collision = true,
})
end
minetest.sound_play(selfObj._sound_hit, { minetest.sound_play(selfObj._sound_hit, {
pos = pointed_thing.under, pos = pointed_thing.under,