Kagee

hildenae - woodlite

Jan 17th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. -- Wood Lite
  2. -- Modfied from original AutoWood from
  3. -- SethBling by einarjh, then again
  4. -- modified by hildenae
  5. -- Original: a3pRQxZ2, ZYuqX2bS
  6.  
  7. fuel=1
  8. -- where to pick fuel
  9. sapling=2
  10. -- where to pick saplings for planting
  11. bonemeal=3
  12. -- where to pick bonemeal
  13. -- if 0, will not use bonemeal
  14. -- then slot 3 can have storage
  15. storageStart=4
  16. -- first storageslot
  17. storageStop=16
  18. -- last storageslot
  19. fuelCount=10
  20. -- how much fuel to pick when refilling
  21.  
  22. local function checkFuel()
  23.   if turtle.getFuelLevel() < 20 then
  24.     turtle.select(fuel)
  25.     turtle.refuel(fuelCount)
  26.   end
  27. end
  28.  
  29. local function column()
  30.   local height = 0
  31.   while turtle.digUp() do
  32.     turtle.dig()
  33.     checkFuel()
  34.     turtle.up()
  35.     height = height + 1
  36.   end
  37.   turtle.dig()
  38.   checkFuel()
  39.   return height
  40. end
  41.  
  42. local function columnDown(height)
  43.   for i=1,height do
  44.     checkFuel()
  45.     turtle.dig()
  46.     turtle.digDown()
  47.     turtle.down()
  48.   end
  49.   turtle.dig()
  50. end
  51.  
  52. local function digmove()
  53.   checkFuel()
  54.   turtle.dig()
  55.   turtle.forward()
  56. end
  57.  
  58. local function fell()
  59.   digmove()
  60.   local height = column()
  61.   turtle.turnRight()
  62.   digmove()
  63.   turtle.turnLeft()
  64.   columnDown(height)
  65. end
  66.  
  67. local function useBoneMeal()
  68.   if bonemeal > 0 then
  69.     turtle.select(bonemeal)
  70.     turtle.place()
  71.   end
  72. end
  73.  
  74. local waitForBlock()
  75.   useBoneMeal()
  76.   turtle.select(sapling)
  77.   while turtle.compare()
  78.     write ("Sapling (slot ")
  79.     write(sapling)
  80.     print(") has not grown")
  81.     print("Sleeping (60)")
  82.     checkFuel()
  83.     os.sleep(60)
  84.   end
  85. end
  86.  
  87. local dropInventory()
  88.   for slot=storageStart,storageStop do
  89.     turtle.select(slot)
  90.     turtle.drop()
  91.   end
  92. end
  93.  
  94. local function replant()
  95.   turtle.select(sapling)
  96.   turtle.suck()
  97.   turtle.place()
  98.   turtle.turnLeft()
  99.   turtle.suck()
  100.   turtle.forward()
  101.   turtle.suck()
  102.   turtle.turnRight()
  103.   turtle.suck()
  104.   turtle.place()
  105.   turtle.turnRight()
  106.   turtle.suck()
  107.   turtle.place()
  108.   turtle.turnRight()
  109.   turtle.suck()
  110.   turtle.forward()
  111.   turtle.suck()
  112.   dropInventory()
  113.   turtle.turnLeft()
  114.   turtle.turnLeft()
  115.   turtle.select(sapling)
  116.   turtle.place()
  117.   waitForBlock()
  118. end
  119.  
  120. while true do
  121.   fell()
  122.   replant()
  123. end
Advertisement
Add Comment
Please, Sign In to add comment