From 8de5a7af338ee389df076fb3451f4009db2fa26e Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Apr 2024 00:34:54 +0100 Subject: launch cactus --- cactus.lua | 12 ++++++++---- 1 file 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) -- cgit v1.2.3