1
0
Fork 0

Fix button pushed by arrows from wrong direction

This commit is contained in:
Wuzzy 2018-05-09 18:04:34 +02:00
parent 1823aba35a
commit 7ca61b7185
1 changed files with 6 additions and 2 deletions

View File

@ -226,7 +226,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
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
self._stuckin = vector.add(pos, dir) self._stuckin = vector.add(dpos, dir)
local snode = minetest.get_node(self._stuckin) local snode = minetest.get_node(self._stuckin)
local sdef = minetest.registered_nodes[snode.name] local sdef = minetest.registered_nodes[snode.name]
@ -249,7 +249,11 @@ ARROW_ENTITY.on_step = function(self, dtime)
-- Push the button! Push, push, push the button! -- Push the button! Push, push, push the button!
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
mesecon.push_button(dpos, node) local bdir = minetest.wallmounted_to_dir(node.param2)
-- Check the button orientation
if vector.equals(vector.add(dpos, bdir), self._stuckin) then
mesecon.push_button(dpos, node)
end
end end
elseif (def and def.liquidtype ~= "none") then elseif (def and def.liquidtype ~= "none") then
-- Slow down arrow in liquids -- Slow down arrow in liquids