Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turningRight = true -- If the first direction the turtle needs to turn is right, leave this true. Change to false if you need to turn left first.
- blocksBetweenLanterns = 15 -- Number of blocks between placing torches
- blocksSinceLastLantern = 0
- while true do
- -- Place a block below and 2 blocks above
- turtle.placeDown()
- turtle.up()
- turtle.placeUp()
- turtle.down()
- -- Figure out if we need to place a lantern
- blocksSinceLastLantern = blocksSinceLastLantern + 1
- if blocksSinceLastLantern > blocksBetweenLanterns then
- if turtle.getItemCount(9) == 0 then
- print("Out of Lanterns")
- print("Place some in slot 9")
- print("and press ENTER to continue")
- read()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(9)
- turtle.place()
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- blocksSinceLastLantern = 0
- end
- -- If we can't move forward, start the process of moving unto the next row
- if turtle.forward() == false then
- -- Check which direction we need to turn
- if turningRight == true then
- -- Turn Right
- turtle.turnRight()
- if turtle.forward() == false then
- clearToContinue = false
- while clearToContinue == false do
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- if turtle.forward() == true then
- clearToContinue = true
- end
- end
- end
- turtle.turnLeft()
- turningRight = false
- else
- -- Turn Left
- turtle.turnLeft()
- if turtle.forward() == false then
- clearToContinue = false
- while clearToContinue == false do
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- if turtle.forward() == true then
- clearToContinue = true
- end
- end
- end
- turtle.turnRight()
- turningRight = true
- end
- -- Move forward until we hit the wall of the new row
- while turtle.detect() == false do
- turtle.forward()
- end
- -- Turn around
- turtle.turnRight()
- turtle.turnRight()
- end
- -- Check to make sure the inventory has materials
- inventoryEmpty = true
- for i=1,9 do
- if turtle.getItemCount(i) > 0 then
- inventoryEmpty = false
- break
- end
- end
- -- Pause if we ran out of stuff
- if inventoryEmpty == true then
- print("Need More Blocks!")
- print("Press Enter To Continue...")
- read()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement