tocacorp

Turtle Floor Placer - FTB

Nov 9th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. print("Auto floor maker")
  2. print("KleebCo Inc")
  3. print("Before hitting enter put")
  4. print("some floor materials in me")
  5. print()
  6. write("Dimensions:")
  7.  
  8. local slot=1
  9. turtle.select(slot)
  10.  
  11. local text=read()
  12.  
  13. local x
  14. local y
  15.  
  16. x,y=string.match(text,"(%d+) (%d+)")
  17.  
  18. x=tonumber(x)
  19. y=tonumber(y)
  20.  
  21. local myX=0
  22. local myY=0
  23.  
  24. print("Starting x:"..x.." y:"..y)
  25.  
  26. local turnFunc
  27. turnFunc=turtle.turnRight
  28.  
  29. function layBrick()
  30.  turtle.placeDown()
  31.  if turtle.getItemCount(slot) == 0 then
  32.   slot=slot+1
  33.   turtle.select(slot)
  34.  end
  35. end
  36.  
  37. while myY < y do
  38.  turnFunc()
  39.  if turnFunc == turtle.turnRight then
  40.   turnFunc = turtle.turnLeft
  41.  else
  42.   turnFunc = turtle.turnRight
  43.  end
  44.  while myX < x do
  45.   layBrick()
  46.   myX = myX + 1
  47.   if myX < x then
  48.    turtle.forward()
  49.   else
  50.    turnFunc()
  51.   end
  52.  end
  53.  myY = myY + 1
  54.  if myY < y then
  55.   turtle.forward()
  56.   myX = 0
  57.  end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment