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),