Advertisement
feline-dis

Untitled

Jan 2nd, 2021 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local slotCount = 16
  2.  
  3. function init()
  4.     if lookForChest() == false then return end
  5.     getItems()
  6.     -- should have full inv of tiny dry rubber
  7.     turnAround()
  8.     turtle.craft()
  9.     turtle.select(1)
  10.     turtle.drop()
  11.     turnAround()
  12. end
  13.  
  14. function lookForChest()
  15.     local success, item = turtle.inspect()
  16.     local turns = 0
  17.     while item == nil or item.name ~= 'quark:custom_chest' do
  18.         if turns >= 4 then
  19.             print('no chest around turtle')
  20.             return false
  21.         end
  22.         turtle.turnLeft()
  23.         turns = turns + 1
  24.         if item.name ~= nil then
  25.             print(item.name)
  26.         end
  27.     end
  28.     return true
  29. end
  30.  
  31. function getItems()
  32.   while(checkForAllFullStacks() == false) do
  33.     turtle.suck()
  34.   end
  35. end
  36.  
  37. function turnAround()
  38.     turtle.turnLeft()
  39.     turtle.turnLeft()
  40. end
  41.  
  42. function checkForAllFullStacks()
  43.     local full = true
  44.     for slot = 1, slotCount, 1 do
  45.         local count = turtle.getItemCount(slot)
  46.  
  47.         if count < 64 then full = false end
  48.     end
  49.     return full
  50. end
  51.  
  52. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement