Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local args = {...}
  2. local fuelSlots = {15,16}
  3. local blockSlots = {1,2,3,4,5,6,7,8,9,10}
  4. local torchSlots = {11,12,13,14}
  5. local torchFreq = 5 --One pair every X
  6.  
  7. local placeBlockDown
  8.  
  9. local function refuel()
  10.   if(turtle.getFuelLevel() < 50) then
  11.     for key,value in pairs(fuelSlots) do
  12.       if(turtle.getItemCount(value) > 0) then
  13.         turtle.select(value)
  14.         turtle.refuel(5)
  15.         return true
  16.       end
  17.     end
  18.   end
  19.   return false
  20. end
  21.  
  22. local function forward(steps)
  23.   for i=1,steps do
  24.     refuel()
  25.     turtle.forward()
  26.   end
  27. end
  28.  
  29. local function turn180()
  30.   turtle.turnRight()
  31.   turtle.turnRight()
  32. end
  33.  
  34. local function placeDownMoveForward(times)
  35.   for i =1,times do
  36.     if(not placeBlockDown()) then
  37.       return false    
  38.     end
  39.     forward(1)
  40.   end
  41.   return true
  42. end
  43.  
  44. placeBlockDown = function()
  45.   for key,value in pairs(blockSlots) do
  46.     if(turtle.getItemCount(value) > 0) then
  47.       turtle.select(value)
  48.       turtle.placeDown()
  49.       return true
  50.     end
  51.   end
  52.   return false
  53. end
  54.  
  55. local function placeblockUp()
  56.   for key,value in pairs(blockSlots) do
  57.     if(turtle.getItemCount(value) > 0) then
  58.       turtle.select(value)
  59.       turtle.placeUp()
  60.       return true
  61.     end
  62.   end
  63.   return false
  64. end
  65.  
  66. local function moveUpPlaceDown(count)
  67.   for i =1,count do
  68.     turtle.up()
  69.     placeBlockDown()
  70.   end
  71. end
  72.  
  73. local function down(steps)
  74.   for i = 1,steps do
  75.     refuel()
  76.     turtle.down()
  77.   end
  78. end
  79.  
  80. local function makeSection(count)
  81.   for i = 1,count do
  82.     turtle.turnRight()
  83.     forward(2)
  84.     down(1)
  85.     turn180()
  86.     placeDownMoveForward(2)
  87.     turtle.up()
  88.     forward(2)
  89.     down(1)
  90.     placeDownMoveForward(2)
  91.     turn180()
  92.     forward(1)
  93.     moveUpPlaceDown(4)
  94.     forward(4)
  95.     down(4)
  96.     moveUpPlaceDown(4)
  97.     turn180()
  98.     placeDownMoveForward(4)
  99.     turn180()
  100.     forward(2)
  101.     turtle.turnLeft()
  102.     forward(1)
  103.     down(3)
  104.   end
  105. end
  106. refuel()
  107. makeSection(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement