Diamssword

Tunnel with storage

Dec 3rd, 2020 (edited)
698
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --créer un tunnel de 3*3 et torche tout les 10 blocs.
  2. --Slot 1 : IE crate, Slot 2 : fuel, slot 3 : torches
  3.  
  4. l = 10
  5. t = 0
  6. print("Slot 1 : IE crate, Slot 2 : fuel, slot 3 : torches")
  7. print("longueur ?")
  8. r = tonumber(read())
  9.  
  10.  function store() do
  11.     if(turtle.getItemCount(1) ==1) then
  12.         turtle.select(1)
  13.         turtle.placeDown()
  14.         for i=4,16 do
  15.            
  16.             turtle.select(i)
  17.             detail =turtle.getItemDetail()
  18.             if(detail ~= nil and detail.name== "minecraft:cobblestone") then
  19.             turtle.drop()
  20.             else
  21.             turtle.dropDown()
  22.             end
  23.         end
  24.         turtle.select(1)
  25.         turtle.digDown()
  26.     end
  27.  end
  28.  end
  29. while(r>0) do
  30. if(turtle.getFuelLevel() == 0) then
  31. turtle.select(2)
  32. turtle.refuel(1)
  33. end
  34. print("longueur restante : "..r)
  35. turtle.dig()
  36. turtle.digUp()
  37. turtle.digDown()
  38. if(l >= 10) then
  39. store()
  40. turtle.select(3)
  41. turtle.placeDown()
  42. l = 0
  43. end
  44. while(turtle.forward() == false) do
  45. turtle.dig()
  46. end
  47. turtle.turnLeft()
  48. turtle.dig()
  49. while(turtle.forward() == false) do
  50. turtle.dig()
  51. end
  52. turtle.digUp()
  53. turtle.digDown()
  54. turtle.turnLeft()
  55. turtle.turnLeft()
  56. while(turtle.forward()==false) do
  57. turtle.dig()
  58. end
  59. turtle.dig()
  60. while(turtle.forward() == false) do
  61. turtle.dig()
  62. end
  63. turtle.digUp()
  64. turtle.digDown()
  65. turtle.turnLeft()
  66. turtle.turnLeft()
  67. while(turtle.forward() == false) do
  68. turtle.dig()
  69. end
  70.  
  71. turtle.turnRight()
  72. l = l + 1
  73. r = r - 1
  74. if(turtle.getFuelLevel() == 0) then
  75. f = 1
  76. while(f==1) do
  77. turtle.select(2)
  78. term.clear()
  79. term.setCursorPos(1,1)
  80. print("Rechargez du fuel dans le slot 1")
  81. turtle.refuel()
  82. sleep(0.5)
  83. if(turtle.getFuelLevel() > 0) then
  84. f = 0
  85. end
  86. end
  87. end
  88. end
  89. print("fini!")
RAW Paste Data