Advertisement
AnonymusHochgenuss

farm

Feb 23rd, 2020 (edited)
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. os.setComputerLabel("farmer")
  2. function farm()
  3.  shell.run("clear")
  4.  print("Farm Programm by M3veronMast3r")
  5.  print("------------------------------")
  6.  print("   !!!-WORK IN PROGRESS-!!!")
  7.  print("Sent all Fails to +491748274510")
  8. end
  9.  
  10. -- Settings --
  11. -- laenge:
  12. x= 12
  13. -- breite: (MUSS EINE GERADE ZAHL SEIN)
  14. z= 12
  15.  
  16. -- functions --
  17.  
  18. function forward()
  19.  while not turtle.forward() do
  20.   sleep(1)
  21.  end
  22. end
  23.  
  24. function back()
  25.  while not turtle.back() do
  26.   sleep(1)
  27.  end
  28. end
  29.  
  30. function reboot()
  31.  while turtle.getItemCount(16) < 1 do
  32.   shell.run("clear")
  33.   print("Need Chest in Slot 16")
  34.   sleep(1)
  35.  end
  36.  shell.run("clear")
  37.  print("starting Farm Programm..")
  38.  turtle.select(16)
  39.  while not turtle.compare() do
  40.   while not turtle.detect() do
  41.    forward()
  42.   end
  43.   if turtle.compare() then
  44.   else
  45.    turtle.turnRight()
  46.   end
  47.  end
  48.  turtle.turnRight()
  49.  farm()
  50. end
  51.  
  52. function check()
  53.  if turtle.getItemCount(e) < 1 then
  54.   while turtle.getItemCount(e) < 1 do
  55.    e=e+1
  56.    if e > 15 then
  57.     e=1
  58.     turtle.select(e)
  59.     return
  60.    end
  61.   end
  62.  end
  63.  turtle.select(e)
  64. end
  65.  
  66. function drop()
  67.  for i=5,15 do
  68.   turtle.select(i)
  69.   turtle.drop()
  70.  end
  71. end
  72. -- functions end --
  73. reboot()
  74. e=1
  75. r=0
  76. r2=0
  77. f=0
  78. check()
  79. if turtle.getItemCount(e) < 1 then
  80.  if not fs.exists("farmfirststart") then
  81.   shell.run("clear")
  82.   print("Need some Potatoes or Carrots for first start. Continue if you inserted some or planted")
  83.   print("")
  84.   write("Press ENTER to continue")
  85.   read()
  86.   fs.open("farmfirststart","w")
  87.   farm()
  88.  end
  89. end
  90. while true do
  91.  while z > 0 do
  92.   while x > 0 do
  93.    check()
  94.    turtle.digDown()
  95.    turtle.digDown()
  96.    turtle.suckDown()
  97.    turtle.suckDown()
  98.    turtle.placeDown()
  99.    if x > 1 then
  100.     forward()
  101.    end
  102.    x=x-1
  103.    r2=r2+1
  104.   end
  105.   while r2 > 0 do
  106.    x=x+1
  107.    r2=r2-1
  108.   end
  109.   r=r+1
  110.   z=z-1
  111.   if z > 0 then
  112.    if f < 1 then
  113.     turtle.turnRight()
  114.     forward()
  115.     turtle.turnRight()
  116.     f=1
  117.    elseif f > 0 then
  118.     turtle.turnLeft()
  119.     forward()
  120.     turtle.turnLeft()
  121.     f=0
  122.    end
  123.   end
  124.  end
  125.  turtle.turnRight()
  126.  while r > 0 do
  127.   if r > 1 then
  128.    forward()
  129.   end
  130.   r=r-1
  131.   z=z+1
  132.  end
  133.  drop()
  134.  turtle.turnRight()
  135.  f=0
  136.  sleep(3300)
  137. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement