Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this program allows any turtle to become a miner
- M_StartCord = {...}
- TurtleX = 1
- TurtleY = 1
- TurtleZ = 1
- TurtleHeading = 1
- TargetCord = {...}
- Layer = 1
- Dir = 1
- local MineMode = 1
- start()
- function start()
- end
- function MinerManager()
- while true do
- if MineMode == 1 then
- if TurtleZ < TargetCord[3] then
- Move("Forward")
- elseif TurtleZ > TargetCord[3] then
- Move("Back")
- elseif TurtleZ == TargetCord[3] then
- Move("Right")
- end
- if TurtleX == TargetCord[1] and TurtleZ == TargetCord[3] and TurtleY == TargetCord[2] then
- MineMode = 3
- elseif TurtleX == TargetCord[1] and TurtleZ == TargetCord[3] then
- MineMode = 2
- end
- elseif MineMode == 2 then
- if TurtleX > M_StartCord[1] then
- Move("Right")
- elseif TurtleX < M_StartCord[1] then
- Move("Left")
- end
- if TurtleZ > M_StartCord[2] then
- Move("Back")
- elseif TurtleZ < M_StartCord[2] then
- Move("Forward")
- end
- end
- end
- end
- function Move(Direction)
- if Direction == "Forward" then
- TurtleZ = TurtleZ + 1
- turtle.forward()
- elseif Direction == "Back" then
- TurtleZ = TurtleZ - 1
- turtle.backwards()
- elseif Direction == "Right" then
- TurtleX = TurtleX + 1
- turtle.right()
- elseif Direction == "Left" then
- TurtleX = TurtleX - 1
- turtle.left()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement