From 51c5e9b6417b807ea3b7890240bd2ea43e8a297a Mon Sep 17 00:00:00 2001
From: FaceDeer <derksenmobile@gmail.com>
Date: Sat, 14 Jan 2017 16:58:37 -0700
Subject: Diagonal movement setting for the auto-controller.

---
 util.lua | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'util.lua')

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)
-- 
cgit v1.2.3