AdslHouba

Botania Livingwood/rock auto (sans deplacement)

Mar 15th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. -- Robot producteur de ressource botania (sans mouvement)
  2. -- Video : https://youtu.be/o6xE2RX5Sks
  3.  
  4. function verif()
  5.     ok, donne = turtle.inspectDown()
  6.     if ok then
  7.         if donne.name=="Botania:livingrock" then
  8.             return false
  9.         elseif donne.name=="Botania:livingwood" then
  10.             return false
  11.         else
  12.             return true
  13.         end
  14.     else
  15.         perma=false
  16.         return false
  17.     end
  18. end
  19.  
  20. -- Affichage info
  21. function info(text)
  22.     term.clear()
  23.     term.setCursorPos(1,1)
  24.     print(text)
  25. end
  26.  
  27. function pose()
  28.     info("Pose du block")
  29.     turtle.select(1)
  30.     turtle.suckUp(1)
  31.     if turtle.getItemCount(1) == 0 then
  32.         info("Plus de ressource")
  33.         return false
  34.     else       
  35.         turtle.placeDown()
  36.         return true
  37.     end
  38. end
  39.  
  40. local perma=true
  41. -- function recolte
  42. function go()
  43.     while perma do     
  44.         info("Attente du bloc de vif bois ou vif roche")
  45.         while verif() do
  46.             os.sleep(3)
  47.         end
  48.    
  49.         info("Recuperation du block")
  50.         turtle.select(2)
  51.         turtle.digDown()
  52.         turtle.drop()
  53.    
  54.         perma=pose()
  55.        
  56.     end
  57. end
  58.  
  59.  
  60. -- si pas vide on passee en normal
  61. ok, donne = turtle.inspectDown()
  62. if ok then
  63.     go()
  64. else
  65.     perma=pose()
  66.     go()
  67. end
Add Comment
Please, Sign In to add comment