Advertisement
raphael76280

Untitled

Aug 9th, 2015
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- mouvement
  2. while true do
  3. local blockFront, blockF = turtle.inspect()
  4. local blockBottom, blockB = turtle.inspectDown()
  5. local command = false
  6. local wireless = peripheral.wrap("left")
  7. wireless.open(69)
  8. wireless.open(70)
  9.  
  10. local foodName
  11. local foodQuan
  12. local foodHave
  13. local echStats
  14.  
  15. -- fuel
  16. if (turtle.getFuelLevel() < 40) then
  17. turtle.select(1)
  18. turtle.refuel(1)
  19. print("refuel ! ")
  20. end
  21.  
  22. -- mouvement bloc de face
  23. if blockFront then
  24. if (blockF.name == "minecraft:sandstone") then
  25. turtle.up()
  26. turtle.forward()
  27. end
  28.  
  29. if (blockF.name == "chisel:limestone") then
  30. turtle.down()
  31. end
  32.  
  33. if (blockF.name == "minecraft:glass") then
  34. turtle.turnRight()
  35. end
  36.  
  37. if (blockF.name == "minecraft:sand") then
  38. turtle.turnLeft()
  39. end
  40.  
  41. if (blockF.name == "minecraft:planks") then
  42.   if (command == false) then
  43.         local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  44.        
  45.                 if (senderChannel == 69) then
  46.                         foodName = message
  47.                         command = true
  48.                         print("a eu commande ")
  49.                         print(message)
  50.                 end
  51.                 if (senderChannel == 70) then
  52.                         foodQuan = message
  53.                         command = true
  54.                 end
  55.                
  56.   end
  57.         if (foodHave == true) then
  58.                 turtle.select(2)
  59.                 turtle.dropUp()
  60.                 foodHave = false
  61.         end
  62.  
  63.         turtle.turnLeft()
  64.         turtle.turnLeft()
  65. end
  66. -- fin block de devant
  67. end
  68.  
  69.  
  70. -- mouvement bloc de dessou
  71. if blockBottom then
  72. if (blockB.name == "minecraft:stone") then
  73. turtle.forward()
  74. end
  75.  
  76. if (blockB.name == "minecraft:sandstone") then
  77. turtle.forward()
  78. end
  79.  
  80. if (blockB.name == "chisel:marble") then
  81.   turtle.turnLeft()
  82.   sleep(1)
  83. print(command)
  84.   if ( command == true) then
  85.      print("chest")
  86.      turtle.select(2)
  87.      turtle.suck(1)
  88.      echStats = turtle.getItemDetail()
  89.         if (echStats.name == foodName) then
  90.              turtle.suck(foodQuan - 1)
  91.              foodHave = true
  92.              command = false
  93.            end
  94.         end
  95.                 turtle.turnRight()
  96.                 turtle.forward()
  97. end
  98.  
  99. --fin block de dessou
  100. end
  101.  
  102.  
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement