Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "robot"
- Z = 0
- MINING_FLOOR = -64
- ROBOT = Robot.new(0,0,Z)
- DISTANCE_DOWN = 0 - Z - MINING_FLOOR
- ROBOT.checkInventory()
- if turtle.getFuelLevel() < 1 and not ROBOT.refuel() then
- print("No fuel")
- end
- ROBOT.downMany(DISTANCE_DOWN)
- ROBOT.forwardMany(64, true)
- X,Y,Z,O = ROBOT.getLocation()
- while turtle.getFuelLevel() < (math.abs(X) + math.abs(Y) + math.abs(Z) + BUFFER) do
- ROBOT.left()
- ROBOT.forwardOne(true)
- ROBOT.left()
- local StepsForward = math.abs(ROBOT.getForwardCoordinate())
- ROBOT.forwardMany(StepsForward, true)
- BUFFER = 100
- X,Y,Z,O = ROBOT.getLocation()
- end
- if X < 0 then
- ROBOT.turnTo(1)
- ROBOT.forwardMany(math.abs(X))
- end
- if X > 0 then
- ROBOT.turnTo(3)
- ROBOT.forwardMany(math.abs(X))
- end
- if Y < 0 then
- ROBOT.turnTo(2)
- ROBOT.forwardMany(math.abs(Y))
- end
- if Y > 0 then
- ROBOT.turnTo(4)
- ROBOT.forwardMany(math.abs(Y))
- end
- X,Y,Z,O = ROBOT.getLocation()
- if X ~= 0 then
- print("Not at X=0")
- end
- if Y ~= 0 then
- print("Not at Y=0")
- end
- ROBOT.upMany(math.abs(Z))
Advertisement
Add Comment
Please, Sign In to add comment