Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: quarry size <length>" )
- print( "Place blocks in slots 1 - 14, place landmarks in 16" )
- return
- end
- -- Set length with user input
- local length = tonumber( tArgs[1] )
- if length < 1 then
- print( "Side length must be positive" )
- return
- end
- local curSlot = 1
- function putblockdown()
- if not (turtle.detectDown()) then
- while turtle.getItemCount(curSlot) == 0 and curSlot < 16 do
- curSlot = curSlot + 1
- end
- turtle.select(curSlot)
- turtle.placeDown()
- end
- end
- -- Place Landmark in front
- function placelmf()
- if not (turtle.detect()) then
- putblockdown()
- turtle.back()
- turtle.select(16)
- turtle.place()
- end
- end
- -- Place Landmark left and right
- function placelmb()
- if not (turtle.detect()) then
- turtle.turnRight()
- turtle.forward()
- putblockdown()
- turtle.back()
- turtle.select(16)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- putblockdown()
- turtle.back()
- turtle.select(16)
- turtle.place()
- turtle.turnRight()
- end
- end
- function backhome()
- x = length
- while x > 0 do
- -- putblockdown()
- turtle.back()
- x = x - 1
- end
- end
- -- Move forward <length> times
- local i = 0
- while i < length do
- turtle.forward()
- i = i + 1
- end
- placelmf()
- backhome()
- turtle.turnLeft()
- local i = 0
- while i < length do
- putblockdown()
- turtle.forward()
- i = i + 1
- end
- placelmb()
- backhome()
- turtle.turnLeft()
- turtle.forward()
- local i = 0
- while i < length do
- turtle.forward()
- i = i + 1
- end
- placelmf()
- backhome()
- -- That's all, folks!
- print("Quarry setup")
- return
Add Comment
Please, Sign In to add comment