--[[ Made by HDGamer14 alpha 0.2 To Do - fix gravel/sand probs (this should fix player and monsters also) - deal with people/monsters when moving - feature to leave the diamonds for you to break with fourtan pick --]] local dist,dist1,row,row1,torchs,debug,auto_refuel,direction,home_dist,home_distRow,home,miner,torchRow,torchDist debug = false auto_refuel = false function mine() turtle.digUp() turtle.dig() turtle.digDown() end function unload() turtle.turnRight() print ("Unloading items...") for n=1,15 do turtle.select(n) turtle.drop() end turtle.select(1) turtle.turnLeft() end function go_back() print("Resuming mining . . .") if home_distRow == 0 then turtle.turnLeft() else for i=1,home_distRow do turtle.back() end turtle.turnLeft() end for i=1,home_dist do turtle.forward() end if direction == true then else turtle.turnLeft() turtle.forward() turtle.turnLeft() end turtle.suck() turtle.suckDown() end function fuel() if turtle.getFuelLevel() < home then print ("Out of fuel!") if auto_refuel == true then turtle.select(1) for f=1,14 do turtle.select(f) turtle.refuel(2) end turtle.select(1) if turtle.getFuelLevel() < home then go_home() fuel_me() go_back() end else go_home() fuel_me() go_back() end else end end function fuel_me() print ("Waiting for fuel . . .") turtle.select(1) repeat turtle.refuel(2) sleep(1) until turtle.getFuelLevel() > 180 end function go_home() if debug == true then print("Go_home") else end home_distRow = row - row1 if direction == true then home_dist = dist - dist1 else turtle.turnLeft() turtle.forward() turtle.turnLeft() home_dist = dist1 end for i=1,home_dist do turtle.back() end turtle.turnRight() if home_distRow == 0 then unload() else for j=1,home_distRow do turtle.forward() end unload() end end function new_row() if row1 == 1 then turtle.digUp() turtle.digDown() print("Finised mineing") else if debug == true then print("New_row") print("Row = "..row1) else end if direction == true then turtle.turnLeft() mine() turtle.forward() turtle.turnLeft() direction = false else turtle.turnRight() mine() turtle.forward() turtle.turnRight() direction = true end dist1 = dist row1 = row1 - 1 home = home + 1 if torchs == true then torchDist = 0 torchRow = torchRow + 1 if torchRow == 4 then torchRow = 0 end end end end function cycle() if debug == true then print ("Cycle") print ("Dist befor "..dist1) --sleep(0) end if dist1 == 0 then new_row() else mine() dist1 = dist1 - 1 if direction == true then home = home + 1 else home = home - 1 end if torchs == true then if torchRow == 0 then torchDist = torchDist + 1 if torchDist == 5 then turtle.select(16) turtle.placeDown(1) turtle.select(1) torchDist = 0 else end end end turtle.forward() fuel() if turtle.getItemCount(14) > 0 then go_home() go_back() end end if debug == true then print("TorchRow "..torchRow) print("TorchDist "..torchDist) print("Dist after "..dist1) print("") else end end --Get info shell.run("clear") print("How far you you like me to go?") dist=read() print("How many rows over would you like me to go?") row=read() print("Would you like me to use torches? (yes/no)") torchs=read() if torchs == "yes" then print("Place torhes in slot 16") torchs = true else torchs = false end if debug == true then print("") print ("I'm mineing "..dist.." blocks deep!") print ("I'm mineing "..row.." Row(s) over!") if torchs == true then print ("I will use torches!") else print ("I will not use torches!") end end sleep (5) dist1 = dist row1 = row home = 5 direction = true miner = dist * row miner = miner + row torchRow = 0 torchDist = 0 -- Start Program repeat cycle() miner = miner - 1 until miner == 0 go_home() turtle.turnRight() turtle.select(16) turtle.drop() turtle.select(1) print("All Done :D")