Advertisement
jschuldes

LittleFarmingTurtle

Feb 13th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- copied from http://www.computercraft.info/forums2/index.php?/topic/2962-little-farming-turtle-lft-ver2/
  2.  
  3. --[[
  4.         12 X 12 farm
  5. ]]--
  6.  
  7. local function move()
  8.     turtle.digDown()
  9.     turtle.placeDown()
  10.     while not turtle.forward() do
  11.         sleep(1)
  12.     end
  13. end
  14.  
  15. local function move2()
  16.     while not turtle.forward() do
  17.         sleep(1)
  18.     end
  19. end
  20. local function plow()
  21.     while not turtle.up() do
  22.         sleep(1)
  23.     end
  24.     move2()
  25.     for o = 1,6 do
  26.  
  27.         for i = 1,12 do
  28.             move()
  29.         end
  30.         turtle.turnRight()
  31.         move()
  32.         turtle.turnRight()
  33.         move()
  34.         for i = 1,12 do
  35.             move()
  36.         end
  37.         turtle.turnLeft()
  38.         move2()
  39.         turtle.turnLeft()
  40.         move2()
  41.     end
  42.     for i = 1,12 do
  43.         move()
  44.     end
  45.     move()
  46.     while not turtle.down() do
  47.         sleep(1)
  48.     end
  49.     turtle.turnLeft()
  50.     turtle.turnLeft()
  51. end
  52. local iRepeat = 0
  53. local iMin = 40
  54. local iCount = 0
  55. local spacer = ""
  56. while true do
  57.     term.clear()
  58.     term.setCursorPos(1,4)
  59.     print("Fuel Remaning : "..tostring(turtle.getFuelLevel()))
  60.     term.setCursorPos(1,1)
  61.     iRepeat = iRepeat+1
  62.     print("plowing   :"..iRepeat)
  63.     plow()
  64.     term.setCursorPos(1,4)
  65.     print("Fuel Remaning : "..tostring(turtle.getFuelLevel()))
  66.     iCount = iMin
  67.     while true do
  68.         iCount = iCount-1
  69.         term.setCursorPos(1,2)
  70.         term.clearLine()
  71.         print("sleeping "..iMin.." minuites")
  72.         for i = 59,0,-1 do
  73.             sleep(1)
  74.             term.setCursorPos(1,3)
  75.             term.clearLine()
  76.             if i < 10 then
  77.                 spacer = "0"
  78.             else
  79.                 spacer = ""
  80.             end
  81.             write("To go    "..iCount..":"..spacer..i)
  82.         end
  83.         if iCount == 0 then
  84.             break
  85.         end
  86.     end
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement