From bd1d8bbd86fa6a892cb57932cd9f159b6975db91 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 26 Nov 2013 00:23:14 -0500 Subject: Make the tube_connects={} method work properly for technic devices. Also phase out "old new" API, leaving only the "tube_connects={}" method, as nothing in technic or pipeworks uses it. Fix a few more places where minetest.facedir_to_dir() was duplicated, since that code is part of Minetest 0.4.8. --- item_transport.lua | 77 +----------------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) (limited to 'item_transport.lua') diff --git a/item_transport.lua b/item_transport.lua index 6990907..3c40178 100644 --- a/item_transport.lua +++ b/item_transport.lua @@ -1,85 +1,10 @@ dofile(pipeworks.modpath.."/compat.lua") ---define the functions from https://github.com/minetest/minetest/pull/834 while waiting for the devs to notice it -local function dir_to_facedir(dir, is6d) - --account for y if requested - if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then - - --from above - if dir.y < 0 then - if math.abs(dir.x) > math.abs(dir.z) then - if dir.x < 0 then - return 19 - else - return 13 - end - else - if dir.z < 0 then - return 10 - else - return 4 - end - end - - --from below - else - if math.abs(dir.x) > math.abs(dir.z) then - if dir.x < 0 then - return 15 - else - return 17 - end - else - if dir.z < 0 then - return 6 - else - return 8 - end - end - end - - --otherwise, place horizontally - elseif math.abs(dir.x) > math.abs(dir.z) then - if dir.x < 0 then - return 3 - else - return 1 - end - else - if dir.z < 0 then - return 2 - else - return 0 - end - end -end - -local function facedir_to_dir(facedir) - --a table of possible dirs - return ({{x=0, y=0, z=1}, - {x=1, y=0, z=0}, - {x=0, y=0, z=-1}, - {x=-1, y=0, z=0}, - {x=0, y=-1, z=0}, - {x=0, y=1, z=0}}) - - --indexed into by a table of correlating facedirs - [({[0]=1, 2, 3, 4, - 5, 2, 6, 4, - 6, 2, 5, 4, - 1, 5, 3, 6, - 1, 6, 3, 5, - 1, 4, 3, 2}) - - --indexed into by the facedir in question - [facedir]] -end - --and an extra function for getting the right-facing vector local function facedir_to_right_dir(facedir) --find the other directions - local backdir = facedir_to_dir(facedir) + local backdir = minetest.facedir_to_dir(facedir) local topdir = ({[0]={x=0, y=1, z=0}, {x=0, y=0, z=1}, {x=0, y=0, z=-1}, -- cgit v1.2.3