Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- full = false
- Fuel = true
- cposi = 0
- pposi = 0
- function forward()
- moved = turtle.forward()
- while not(moved) do
- sleep(1)
- turtle.dig()
- moved=turtle.forward()
- end
- end
- function checkInv()
- if turtle.getItemCount(15) ~= 0 then
- full = true
- end
- end
- function checkFuel()
- CFuel = turtle.getFuelLevel()
- if not(branch) then
- if CFuel <= cposi then
- Fuel = false
- end
- if CFuel <= cposi + 5 then
- Fuel = false
- end
- else
- if CFuel <= cposi or CFuel <= 5+cposi or CFuel <= 42+cposi then
- Fuel =false
- end
- end
- end
- function gohome()
- while cposi ~= 0 do
- forward()
- cposi = cposi-1
- end
- end
- function gomine()
- while cposi ~= pposi do
- forward()
- cposi = cposi+1
- end
- end
- function home()
- turtle.turnLeft()
- turtle.turnLeft()
- gohome()
- turtle.turnLeft()
- turtle.turnLeft()
- for i=2,15 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- full = false
- if turtle.getItemCount(16) > 64 then
- turtle.select(16)
- turtle.suckUp()
- turtle.select(2)
- turtle.dropUp()
- turtle.select(1)
- end
- while turtle.getFuelLevel() < 2*pposi do
- q=turtle.getItemCount(1)
- q= q -1
- turtle.select(2)
- turtle.refuel(q)
- turtle.select(1)
- print("refueling...")
- sleep(15)
- end
- Fuel = true
- gomine()
- end
- function mineM()
- turtle.select(1)
- checkInv()
- checkFuel()
- if full == true or Fuel==false then
- home()
- end
- t=0
- while t < cposi do
- t=t+8
- end
- if t == cposi and not(t==0) then
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- end
- forward()
- cposi= cposi+1
- pposi= pposi+1
- checkInv()
- if full then
- home()
- end
- turtle.digUp()
- checkInv()
- if full then
- home()
- end
- turtle.digDown()
- checkInv()
- if full then
- home()
- end
- turtle.turnLeft()
- forward()
- checkInv()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- home()
- turtle.turnLeft()
- forward()
- end
- turtle.digDown()
- checkInv()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- home()
- turtle.turnLeft()
- forward()
- end
- turtle.digUp()
- checkInv()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- home()
- turtle.turnLeft()
- forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- forward()
- forward()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- home()
- turtle.turnRight()
- forward()
- end
- turtle.digUp()
- checkInv()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- home()
- turtle.turnRight()
- forward()
- end
- turtle.digDown()
- checkInv()
- if full then
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- home()
- turtle.turnRight()
- forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- end
- tArgs={...}
- q = tArgs[1]
- target= q*4
- while pposi~= target do
- mineM()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement