Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function landfill()
- --turtle.select(1)
- for a=1,width do
- for b=1,length do
- if turtle.detectDown() then
- turtle.forward()
- else
- checkslots()
- turtle.placeDown()
- turtle.forward()
- end
- end
- checkslots()
- if a % 2 == 0 then
- --turn left
- turtle.turnLeft()
- turtle.placeDown()
- turtle.forward()
- turtle.placeDown()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.placeDown()
- turtle.forward()
- turtle.placeDown()
- turtle.turnRight()
- end
- end
- end
- function wait()
- print("ran out of material, waiting...")
- repeat
- local event,key = os.pullEvent("key")
- until key == keys.enter
- end
- function checkslots()
- for i=1,16 do
- if turtle.getItemCount(i)==0 then
- return
- else
- turtle.select(i)
- end
- end
- if turtle.getItemCount(turtle.getSelectedSlot()) == 0 then
- wait()
- end
- end
- print("Welcome to the land filling program.")
- print("How far to go?")
- length = tonumber(read())
- print("Ok, I will go that far: ", length)
- print("How wide right?")
- width = tonumber(read())
- print("Ok, I will go that wide right: ", width)
- print("Ready? y/n")
- ready = read()
- if (ready == "y") then
- print("Alright, starting...")
- landfill()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement