Advertisement
readix

import

Feb 22nd, 2021 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local tool = {}
  2. local t = turtle
  3.  
  4. function tool.needR(slotMax)
  5.     slot = t.getSelectedSlot()
  6.     if not slotMax then
  7.         slotMax = 16
  8.     end
  9.     t.select(1)
  10.     if turtle.getFuelLevel()<10 then
  11.         while not turtle.refuel(1) do
  12.             turtle.select((turtle.getSelectedSlot()%slotMax)+1)
  13.         end
  14.     end
  15.     t.select(slot)
  16.  
  17. end
  18.  
  19.  
  20. function tool.checkGravel()
  21.     _, tuple = t.inspectUp()
  22.     if not tuple then return end
  23.     while string.find(tuple.name, 'gravel') do
  24.         t.dig()
  25.         _, tuple = t.inspectUp()
  26.         if not tuple then break end
  27.     end
  28. end
  29.  
  30. function tool.fd(slotMax)
  31.     tool.needR(slotMax)
  32.     b, tuple = turtle.inspect()
  33.     if b then
  34.         if string.find(tuple['name'], 'lava') then
  35.             return
  36.         end
  37.     end
  38.     while not t.forward() do t.dig() end
  39. end
  40.  
  41. function tool.d()
  42.     tool.needR()
  43.     b, tuple = turtle.inspectDown()
  44.     if b then
  45.         if string.find(tuple['name'], 'lava') then
  46.             return
  47.         end
  48.     end
  49.     while not t.down() do t.digDown() end
  50. end
  51.  
  52. function tool.up()
  53.     tool.needR()
  54.     b, tuple = turtle.inspectUp()
  55.     if b then
  56.         if string.find(tuple['name'], 'lava') then
  57.             return
  58.         end
  59.     end
  60.     while not t.up() do t.digUp() end
  61. end
  62.  
  63.  
  64.  
  65.  
  66. return tool
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement