Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arg = {...}
- length = arg[1]
- width = arg[2]
- dir = arg[3]
- cSlot = 1
- slots = 16
- turtle.select(13)
- turtle.refuel()
- turtle.select(1)
- if (length == nil or width == nil) then
- print ("Usage: flat <length> <width> <1=up else down>")
- return
- end
- function empty()
- if (turtle.getItemCount(slots) == 0) then
- print(string.format("I am empty. Please load more materials in slot %d to continue.", slots))
- while (turtle.getItemCount(slots) == 0) do
- sleep(1)
- end
- end
- if (turtle.getItemCount(cSlot) == 0) then
- cSlot = cSlot + 1
- turtle.select(cSlot)
- end
- end
- for i=0,(width - 1),1 do
- for j=1,(length - 1),1 do
- empty()
- turtle.forward()
- if (dir==1) then turtle.placeUp()
- else
- turtle.placeDown()
- end
- end
- if (i % 2 == 0) then
- if (i ~= width - 1) then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- empty()
- turtle.placeDown()
- end
- else
- if (i ~= width - 1) then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- empty()
- if (dir==1) then turtle.placeUp()
- else
- turtle.placeDown()
- end
- end
- end
- if (j ~= length - 1) then
- empty()
- if(dir==1) then turtle.placeUp()
- else
- turtle.placeDown()
- end
- end
- end
- print("\nSurface complete.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement