Advertisement
dlord

enderquarry setup

May 11th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. -- Ender Quarry fence deployer
  2.  
  3. local args={...}
  4. local deploy = true
  5.  
  6. if #args > 0 and args[1] == "undeploy" then
  7.     deploy = false
  8. end
  9.  
  10. turtle.select(1)
  11.  
  12. local function forward()
  13.     while turtle.forward() == false do
  14.         if turtle.dig() == false then
  15.             turtle.attack()
  16.         end
  17.     end
  18. end
  19.  
  20. for i=1, 4 do
  21.     for j=1, 63 do
  22.         forward()
  23.         if turtle.detectDown() then
  24.             turtle.digDown()
  25.         end
  26.  
  27.         if deploy then
  28.             turtle.placeDown()
  29.         end
  30.  
  31.         local currentSlot = turtle.getSelectedSlot()
  32.         if turtle.getItemCount(currentSlot) == 0 then
  33.             turtle.select(currentSlot + 1)
  34.         end
  35.     end
  36.  
  37.     turtle.turnLeft()
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement