Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- placeItem(TOARCH_SLOT): place() TOARCH_SLOT's item
- -- placeItem(CHEST_SLOT, turtle.placeUp): use placeUp()
- function placeItem(slot, place_func)
- print("placeItem")
- local place_func = place_func or turtle.place
- turtle.select(slot)
- local status, error_msg = place_func()
- turtle.select(1)
- return status, error_msg
- end
- TOARCH_SLOT = 1
- function placeToarch(i)
- print("placeTorch")
- if i%5==0 and turtle.getItemCount(TOARCH_SLOT)>0 and turtle.down() then
- turtle.turnRight(); turtle.turnRight()
- print('place a toarch: ', placeItem(TOARCH_SLOT))
- turtle.turnRight(); turtle.turnRight()
- turtle.up()
- end
- end
- args={...}
- distance=args[1] - 1
- --??????????20??????????????
- fuel=distance * 5 + 20
- if turtle.getFuelLevel() <= fuel then
- print("")
- print("Fuel level is low.")
- print("Set fuel in slot 1.")
- turtle.select(1)
- while turtle.getFuelLevel() <= fuel do
- turtle.refuel()
- sleep(1)
- end
- print("")
- print("Fuel is enough!")
- end
- turtle.select(1)
- print("Mining start.")
- for i = 0,distance do
- placeToarch(i)
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- turtle.digUp()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- turtle.digUp()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- remain = distance - i
- print("Remaining: ",remain," m")
- if turtle.getSelectedSlot() == 16 then
- turtle.turnRight()
- turtle.turnRight()
- for i=0,distance do
- turtle.forward()
- end
- for i=2,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=0,distance do
- turtle.forward()
- end
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=0,distance do
- turtle.forward()
- end
- for i=2,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- print("Mining has ended!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement