summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cactus.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/cactus.lua b/cactus.lua
index 83b3f58..0934d55 100644
--- a/cactus.lua
+++ b/cactus.lua
@@ -68,10 +68,14 @@ local function turn_to_face(newfacing)
end
local function moveby_xz(dv)
- turn_to_face(vector.new(numutil.sign(dv.x), 0, 0))
- for i=1,math.abs(dv.x) do turtle.forward() end
- turn_to_face(vector.new(0, 0, numutil.sign(dv.z)))
- for i=1,math.abs(dv.z) do turtle.forward() end
+ if dv.x ~= 0 then
+ turn_to_face(vector.new(numutil.sign(dv.x), 0, 0))
+ for i=1,math.abs(dv.x) do turtle.forward() end
+ end
+ if dv.z ~= 0 then
+ turn_to_face(vector.new(0, 0, numutil.sign(dv.z)))
+ for i=1,math.abs(dv.z) do turtle.forward() end
+ end
end
local function moveby(delta)