summaryrefslogtreecommitdiff
path: root/item_transport.lua
diff options
context:
space:
mode:
Diffstat (limited to 'item_transport.lua')
-rw-r--r--item_transport.lua77
1 files changed, 1 insertions, 76 deletions
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},