summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-14 16:58:37 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-14 16:58:37 -0700
commit51c5e9b6417b807ea3b7890240bd2ea43e8a297a (patch)
tree94c33a1c482b4509d10b31a3e260b1f187aaad53 /util.lua
parentf0e09f136a40efa7ebf41db880693b67b3f9f628 (diff)
Diagonal movement setting for the auto-controller.
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/util.lua b/util.lua
index c6b2cc9..b0588e3 100644
--- a/util.lua
+++ b/util.lua
@@ -19,16 +19,18 @@ digtron.find_new_pos = function(pos, facing)
return vector.add(pos, dir)
end
-digtron.find_new_pos_downward = function(pos, facing)
- local downdir = (
+digtron.facedir_to_down_dir = function(facing)
+ return (
{[0]={x=0, y=-1, z=0},
{x=0, y=0, z=-1},
{x=0, y=0, z=1},
{x=-1, y=0, z=0},
{x=1, y=0, z=0},
{x=0, y=1, z=0}})[math.floor(facing/4)]
- return vector.add(pos, downdir)
+end
+digtron.find_new_pos_downward = function(pos, facing)
+ return vector.add(pos, digtron.facedir_to_down_dir(facing))
end
digtron.mark_diggable = function(pos, nodes_dug)