Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print("Usage: putvuller <maxBlocks>")
- return
- end
- maxMoves = tonumber(tArgs[1])
- moves = 0
- print("Putvuller activated for #" .. maxMoves .. " blocks")
- curSlot = 1
- turtle.select(curSlot)
- stop = false
- function checkSlot()
- if turtle.getItemCount(curSlot) < 1 then
- curSlot = curSlot + 1
- if curSlot > 9 then
- stop = true
- return
- end
- turtle.select(curSlot)
- checkSlot()
- end
- end
- function buildAndMove()
- local worked = turtle.place()
- if worked then
- moves = moves + 1
- end
- output = turtle.back()
- return output
- end
- function determineNextMove()
- if canMove() then
- return true
- end
- turtle.turnLeft()
- if canMove() then
- return true
- end
- turtle.turnRight()
- turtle.turnRight()
- if canMove() then
- return true
- end
- stop = true
- return false
- end
- function canMove()
- local succ = turtle.back()
- if succ then
- turtle.forward()
- return true
- end
- return false
- end
- while not stop and moves < maxMoves do
- checkSlot()
- if determineNextMove() then
- buildAndMove()
- end
- end
- print("Gedaan met putvullen...")
Add Comment
Please, Sign In to add comment