Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local home_x,home_y,home_z = 0,0,0
- shell.run("gps","locate")
- local x,y,z = gps.locate()
- local function find_dir() --dir 1,2,3,4
- local xx,yy,zz = gps.locate()
- turtle.forward()
- local x_,y_z_ = gps.locate()
- shell.run("turn","right","2")
- turtle.forward()
- shell.run("turn","right","2")
- if xx < x_ then
- return 4 --west
- elseif xx > x_
- return 2 --east
- elseif zz > z_
- return 1 --north
- elseif zz < z_
- return 3 --south
- else
- return 0
- end
- end
- local function change_dir(toDir,dir_)
- while toDir ~= dir_ do
- turtle.turnRight()
- dir_ = dir_ + 1
- end
- end
- while y < 100 do
- turtle.digUp()
- turtle.up()
- while x <
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement