Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("turtleChest.lua")
- os.loadAPI("setNorth.lua")
- os.loadAPI("turtleToCords.lua")
- os.loadAPI("userInput.lua")
- function userPrompt(length, width)
- total = length * width
- print(total .. " Buckets Needed")
- userInput.getUserInput("Press Anything to Continue")
- end
- -- Get the dimensions
- function input(newWidth, newLength, newDepth)
- width = newWidth
- length = newLength
- depth = newDepth
- end
- function bucketCheck(x, z, sdirection, bucket)
- bucket = bucket + 1
- if bucket == 16 then
- toRefuel(x, z, sdirection)
- bucket = 0
- end
- return bucket
- end
- function toRefuel(x, z, sdirection)
- cdirection = setNorth.getDirection()
- cx, cy, cz = gps.locate()
- turtleToCords.twoDMove(x, z, cx, cz)
- --face chests
- setNorth.lookNorth()
- sdirection = setNorth.oppDirection(sdirection)
- setNorth.setDirection(sdirection)
- turtle.forward()
- --look at chest on right and middle chests to deposit
- turtle.turnRight()
- turtleChest.insertAll()
- turtle.turnLeft()
- turtleChest.insertAll()
- --look at chest on left and take buckets
- turtle.turnLeft()
- turtle.suck(16)
- turtle.turnLeft()
- turtle.forward()
- --move back to previous position when was working and faces same direction
- turtleToCords.twoDMove(cx, cz,x, z)
- setNorth.lookNorth()
- setNorth.setDirection(cdirection)
- end
- function toStart(x, z, sdirection)
- --get current direction of turtle mid work
- cdirection = setNorth.getDirection()
- cx, cy, cz = gps.locate()
- turtleToCords.twoDMove(x, z, cx, cz)
- setNorth.lookNorth()
- sdirection = setNorth.oppDirection(sdirection)
- setNorth.setDirection(sdirection)
- turtle.forward()
- turtle.turnRight()
- turtleChest.insertAll(1)
- turtle.turnLeft()
- turtleChest.insertAll(1)
- turtle.turnLeft()
- turtle.suck(16)
- turtle.turnLeft()
- end
- function collectLevel(length, width)
- width = width - 1
- bucket = 0
- turtle.forward()
- sdirection = setNorth.getDirection()
- x, y, z = gps.locate()
- for i = 1, length do
- for j = 1, width do
- turtle.placeDown()
- bucket = bucketCheck(x, z, sdirection, bucket)
- turtle.forward()
- end
- if i < length then
- if i % 2 == 1 then
- turtle.placeDown()
- bucket = bucketCheck(x, z, sdirection, bucket)
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.placeDown()
- bucket = bucketCheck(x, z, sdirection, bucket)
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- turtle.placeDown()
- toStart(x, z, sdirection)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement