From 763d9458bf2b1d7550819e80d4f90e14be3863fb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 9 May 2018 15:17:19 +0200 Subject: [PATCH] Fix arrows not getting stuck when flying up --- mods/ITEMS/mcl_bows/arrow.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 596a0d9b..0360dc00 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -199,7 +199,6 @@ ARROW_ENTITY.on_step = function(self, dtime) end -- Check for node collision - -- FIXME: Also collides with ignore if self._lastpos.x~=nil and not self._stuck then local def = minetest.registered_nodes[node.name] 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 -- Check for the node to which the arrow is pointing local dir - if vel.y >= 0 and vel.y < 0.00001 then - dir = {x=0, y=-1, z=0} - elseif vel.y <= 0 and vel.y > 0.00001 then - dir = {x=0, y=1, z=0} + if math.abs(vel.y) < 0.00001 then + if self._lastpos.y < pos.y then + dir = {x=0, y=1, z=0} + else + dir = {x=0, y=-1, z=0} + end else dir = minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(self.object:get_yaw()-YAW_OFFSET))) end