Advertisement
1vannn

testTurd

May 31st, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.68 KB | None | 0 0
  1. sleeptime = 60 * 40 -- 35 minutes
  2. maxFarm = 2
  3. local pasteID = "http://pastebin.com/raw.php?i=mPkBiaLL"
  4. debug = true
  5. pasteContent = http.get(pasteID)
  6. Paste = pasteContent.readAll()
  7. pasteContent.close()
  8. function update()
  9.         file = fs.open("startup","r")
  10.         contents = file.readAll()
  11.         file.close()
  12.         if (Paste ~= contents) then
  13.                 print("Updating program...")
  14.                 shell.run("delete","startup")
  15.                 wFile = fs.open("startup","w")
  16.                 wFile.write(Paste)
  17.                 wFile.close()
  18.                 sleep(1)
  19.                 os.reboot()
  20.         end
  21. end
  22. function checkFuel()
  23.         if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 150 then
  24.                 for i = 1, 16 do
  25.                   turtle.select( i )
  26.                   turtle.refuel()
  27.                 end
  28.                 if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 150 then
  29.                         print("I need food.")
  30.                         sleep(15)
  31.                         os.reboot()
  32.                 end
  33.         else
  34.                 print("My fuel level is well within boundary at "..turtle.getFuelLevel())
  35.         end
  36. end
  37. function checkBlock()
  38.         local success, data = turtle.inspectDown()
  39.  
  40.         if success then
  41.                 if (data.name == "minecraft:wheat") then
  42.                         print(data.name)
  43.                         print("Found some wheat")
  44.                         if (data.metadata == 7) then
  45.                                 turtle.select(1)
  46.                                 turtle.digDown()
  47.                                 turtle.select(2)
  48.                                 turtle.placeDown()
  49.                         else
  50.                                 print("It ain't good yet!")
  51.                         end
  52.                 end
  53.         else
  54.             print(data.name)
  55.             print("not wheat")
  56.             turtle.select(2)
  57.             local data = turtle.getItemDetail()
  58.             if data then
  59.                 if (data.name == "minecraft:wheat_seeds") then
  60.                     turtle.placeDown()
  61.                     print("Placed some of them seeds")
  62.                 else
  63.                     print("I ain't got no seeds ya fool!")
  64.                 end
  65.             else
  66.                     print("I ain't got no seeds ya fool!")
  67.             end
  68.             turtle.select(1)
  69.         end
  70. end
  71. function doDaFarm()
  72.         turtle.turnRight()
  73.         turtle.forward()
  74.         checkBlock()
  75.         turtle.turnLeft()
  76.         turtle.turnLeft()
  77.         turtle.forward()
  78.         turtle.forward()
  79.         checkBlock()
  80.         turtle.turnRight()
  81.         turtle.turnRight()
  82.         turtle.forward()
  83.         turtle.turnLeft()
  84. end
  85. turtle.select(1)
  86. update()
  87. checkFuel()
  88. for i=0,maxFarm do
  89.    turtle.forward()
  90.    doDaFarm()
  91.    i=i+1
  92. end
  93. turtle.turnRight()
  94. turtle.turnRight()
  95. for i=0,maxFarm do
  96.    turtle.forward()
  97.    i=i+1
  98. end
  99. turtle.select(1)
  100. local data = turtle.getItemDetail()
  101.             if data then
  102.                 if (data.name == "minecraft:wheat_seeds") then
  103.                     turtle.drop()
  104.                 else
  105.                     print("I ain't got no wheat.. or I'm broken.")
  106.                 end
  107.             else
  108.                 print("I ain't got no wheat.. or I'm broken.")
  109.             end
  110. turtle.turnRight()
  111. turtle.turnRight()
  112. turtle.select(1)
  113. if (debug == false) then
  114.         sleep(sleeptime)
  115. else
  116.         sleep(10)
  117.         print("40 seconds remaining")
  118.         sleep(10)
  119.         print("30 seconds remaining")
  120.         sleep(10)
  121.         print("20 seconds remaining")
  122.         sleep(10)
  123.         print("10 seconds remaining")
  124. end
  125. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement