From 5ac9658c3aebce6fbc8f4d32eb0fdc76fc33e5e9 Mon Sep 17 00:00:00 2001 From: Kai Vogelgesang Date: Tue, 7 Jul 2020 00:58:47 +0200 Subject: [PATCH] Update lib --- kai/lib.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kai/lib.lua b/kai/lib.lua index 7d8b45e..602567a 100644 --- a/kai/lib.lua +++ b/kai/lib.lua @@ -21,6 +21,10 @@ state = (function () }) end)() +if state.x == nil or state.y == nil or state.z == nil or state.o == nil then + print("[WARNING] position is not set") +end + --[[ orientation: 0 = South (+z) @@ -45,7 +49,7 @@ return { fwd = move(turtle.forward, function() if state.o == 1 or state.o == 3 then state.x = state.x + ((state.o == 1) and -1 or 1) - else + elseif state.o == 0 or state.o == 2 then state.z = state.z + ((state.o == 2) and -1 or 1) end end), @@ -53,7 +57,7 @@ return { back = move(turtle.back, function() if state.o == 1 or state.o == 3 then state.x = state.x + ((state.o == 1 and 1 or -1)) - else + elseif state.o == 0 or state.o == 2 then state.z = state.z + ((state.o == 2) and 1 or -1) end end),