Fix arrows not getting stuck when flying up
This commit is contained in:
parent
af8515b6e4
commit
763d9458bf
|
@ -199,7 +199,6 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for node collision
|
-- Check for node collision
|
||||||
-- FIXME: Also collides with ignore
|
|
||||||
if self._lastpos.x~=nil and not self._stuck then
|
if self._lastpos.x~=nil and not self._stuck then
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity()
|
||||||
|
@ -207,10 +206,12 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
if (math.abs(vel.x) < 0.0001) or (math.abs(vel.z) < 0.0001) or (math.abs(vel.y) < 0.00001) then
|
if (math.abs(vel.x) < 0.0001) or (math.abs(vel.z) < 0.0001) or (math.abs(vel.y) < 0.00001) then
|
||||||
-- Check for the node to which the arrow is pointing
|
-- Check for the node to which the arrow is pointing
|
||||||
local dir
|
local dir
|
||||||
if vel.y >= 0 and vel.y < 0.00001 then
|
if math.abs(vel.y) < 0.00001 then
|
||||||
dir = {x=0, y=-1, z=0}
|
if self._lastpos.y < pos.y then
|
||||||
elseif vel.y <= 0 and vel.y > 0.00001 then
|
dir = {x=0, y=1, z=0}
|
||||||
dir = {x=0, y=1, z=0}
|
else
|
||||||
|
dir = {x=0, y=-1, z=0}
|
||||||
|
end
|
||||||
else
|
else
|
||||||
dir = minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(self.object:get_yaw()-YAW_OFFSET)))
|
dir = minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(self.object:get_yaw()-YAW_OFFSET)))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue