Advertisement
Guest User

startup.lua

a guest
Apr 6th, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. --WaitTime is configurable
  2. waitTime = 60
  3.  
  4. turnLeft = true
  5.  
  6. local function harvest()
  7.     for i=1,9 do
  8.         for j=1,9 do
  9.             isBlockDown, blockDown = turtle.inspectDown()
  10.        
  11.             if isBlockDown and blockDown.name == "botania:flower" then
  12.                 turtle.digDown()
  13.                 turtle.suckDown()
  14.             end
  15.        
  16.             turtle.forward()
  17.         end
  18.        
  19.         if turnLeft and i ~= 9 then
  20.             turnLeft = false
  21.             turtle.turnLeft()
  22.             turtle.forward()
  23.             turtle.turnLeft()
  24.         elseif i~= 9 then
  25.             turnLeft = true
  26.             turtle.turnRight()
  27.             turtle.forward()
  28.             turtle.turnRight()
  29.         end
  30.     end
  31. end
  32.  
  33. local function main()
  34.     os.setComputerLabel("Fuel: "..turtle.getFuelLevel())
  35.  
  36.     if turtle.getFuelLevel() < 81 then
  37.         turtle.select(1)
  38.         turtle.refuel()
  39.        
  40.         if turtle.getFuelLevel() < 81 then
  41.             os.setComputerLabel("Put Fuel in Slot 1")
  42.         end
  43.     end
  44.  
  45.     harvest()
  46.    
  47.     turtle.turnLeft()
  48.     turtle.turnLeft()
  49.    
  50.     turnLeft = true
  51.    
  52.     isBlockDown, blockDown = turtle.inspectDown()
  53.    
  54.     if isBlockDown and blockDown.name == "minecraft:chest" then
  55.         for k=1,16 do
  56.             turtle.select(k)
  57.             turtle.dropDown()
  58.         end
  59.        
  60.         for i=1,waitTime do
  61.             os.setComputerLabel("Waiting "..waitTime-i.." seconds")
  62.             sleep(1)
  63.         end
  64.     end
  65. end
  66.  
  67. while true do
  68.     main()
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement