MP.lua
Never
local facing = 0 function getFace() print("Starte getFace()") for a=3,0,-1 do if turtle.detect() then print("Block gefunden: Drehe") turtle.turnLeft() else local x,y,z = gps.locate() if x == nil then print("kein GPS") end sleep(1) print("turtle forward") turtle.forward() sleep(1) print("turtle forwarded") local x1,y1,z1 = gps.locate() if x > x1 then facing = 2 turtle.back() return true elseif x < x1 then facing = 4 turtle.back() return true elseif z > z1 then facing = 1 turtle.back() return true elseif z < z1 then facing = 3 turtle.back() return true else print("getFace(): ERROR") end a = 0 end end end turtle.refuel() getFace() print(facing)