Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Made by HDGamer14
- alpha 0.3
- change log:
- 0.3.2:
- made sand/gravel issuses better
- 0.3.1:
- fixed torches for real (I fixed them then broke them O_o without knowing sorry ......)
- fixed issuse with rows sorry bout that also
- 0.3:
- fixed sand/player/gravel movent(I think)
- torches now work :D
- 0.2:
- Making new rows when not needed
- To Do:
- - 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()
- print("Row = "..row1)
- if row1 == 1 then
- turtle.digUp()
- turtle.digDown()
- print("Finised mineing")
- else
- if debug == true then
- print("New_row")
- print("Row = "..row1)
- 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")
- sleep(1)
- end
- if dist1 == 0 then
- new_row()
- else
- mine()
- if torchs == true then
- if torchRow == 0 then
- torchDist = torchDist + 1
- if torchDist == 5 then
- print("Placing torch")
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- torchDist = 0
- end
- end
- end
- if turtle.forward() == false then
- for i=1,5 do
- turtle.attack()
- mine()
- end
- turtle.forward()
- end
- dist1 = dist1 - 1
- if direction == true then
- home = home + 1
- else
- home = home - 1
- end
- 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("")
- end
- end
- --Get info
- shell.run("clear")
- print("How far you you like me to go?")
- dist=read()
- print("How many rows would you like me to mine?")
- row=read(number)
- 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")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement