Advertisement
1vannn

testTurd Sugar Cane

Jun 8th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. sleeptime = 60 -- 35 minutes
  2. local pasteID = "http://pastebin.com/raw.php?i=6EvtyJZx"
  3. debug = true
  4. pasteContent = http.get(pasteID)
  5. Paste = pasteContent.readAll()
  6. pasteContent.close()
  7. function update()
  8.         file = fs.open("startup","r")
  9.         contents = file.readAll()
  10.         file.close()
  11.         if (Paste ~= contents) then
  12.                 print("Updating program...")
  13.                 shell.run("delete","startup")
  14.                 wFile = fs.open("startup","w")
  15.                 wFile.write(Paste)
  16.                 wFile.close()
  17.                 sleep(1)
  18.                 os.reboot()
  19.         end
  20. end
  21. function checkFuel()
  22.         if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 20 then
  23.                 for i = 1, 16 do
  24.                   turtle.select( i )
  25.                   turtle.refuel()
  26.                 end
  27.                 if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 20 then
  28.                         print("I need food.")
  29.                         sleep(15)
  30.                         os.reboot()
  31.                 end
  32.         else
  33.             for i = 1, 16 do
  34.                   turtle.select( i )
  35.                   turtle.refuel()
  36.             end
  37.             print("My fuel level is well within boundary at "..turtle.getFuelLevel())
  38.         end
  39. end
  40. function checkBlock()
  41.     local success, data = turtle.inspect()
  42.  
  43.     if success then
  44.         if (data.name == "minecraft:reeds") then
  45.             print(data.name)
  46.             print("Found some reeds..")
  47.             turtle.dig()
  48.             turtle.forward()
  49.         end
  50.     else
  51.         turtle.forward()
  52.     end
  53. end
  54. update()
  55. checkFuel()
  56. checkBlock()
  57. checkBlock()
  58. checkBlock()
  59. checkBlock()
  60. checkBlock()
  61. turtle.turnRight()
  62. turtle.turnRight()
  63. checkBlock()
  64. checkBlock()
  65. checkBlock()
  66. checkBlock()
  67. checkBlock()
  68. turtle.turnLeft()
  69. turtle.turnLeft()
  70. turtle.dropDown()
  71. if (debug == false) then
  72.         sleep(sleeptime)
  73. else
  74.         sleep(10)
  75.         print("40 seconds remaining")
  76.         sleep(10)
  77.         print("30 seconds remaining")
  78.         sleep(10)
  79.         print("20 seconds remaining")
  80.         sleep(10)
  81.         print("10 seconds remaining")
  82. end
  83. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement