Niseg

wall cover placer

Apr 8th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local slot =1
  2. local function mD()
  3. if turtle.detectDown() then turtle.digDown() end
  4. turtle.down()
  5. end
  6. local function mU()
  7. if turtle.detectUp() then turtle.digUp() end
  8. turtle.up()
  9. end
  10.  
  11. local function placeCover()
  12. if turtle.detect() then turtle.dig() end
  13. turtle.place()
  14. if turtle.getItemCount(slot)==0 then slot=slot+1; turtle.select(slot) end
  15.  
  16. end
  17.  
  18.  
  19. local height=0
  20. local width=0
  21. local movingUp=true;
  22. print("height?")
  23. height=tonumber(read())
  24. print("width?")
  25. width=tonumber(read())
  26. turtle.select(slot);
  27. for j=1,width do
  28.  
  29. for i=2,height do
  30.  
  31. placeCover()
  32. if movingUp then mU() else mD() end
  33. end
  34. movingUp=not movingUp
  35. placeCover()
  36. turtle.turnLeft()
  37. if turtle.detect() then turtle.dig() end
  38. turtle.forward()
  39. turtle.turnRight()
  40. end
Advertisement
Add Comment
Please, Sign In to add comment