Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Author: Truthowl
- -- Makes turtle use a mining well and redstone energy cell to mine.
- -- Requires an Engineering Turtle, Mining Turtle, Ender Chest,
- -- Mining well, and a Thermal Expansion Energy Cell.
- -- The Engineering Turtle was crafted with a Thermal Expansion Hammer.
- -- Not sure if crafting with something else will work or not.
- --
- -- I made my mining turtle a chunk loading turtle as well.
- -- That's not needed, but then you have to remain close or drop
- -- your own chunk loader if you want to leave the area.
- -- With this, you can even set your mynwell turtle to begin underground.
- -- He/she will clear the workzone before placing the needed equipment.
- -- Also, the turtle will backup 1 block to begin mining from
- -- where you place him/her. So drop it from 2 blocks back or drop it
- -- and move out of the way.
- -- NOTE: Do not shut down your game while your mynwell turtle is running
- -- They will stop and need to be restarted if you do.
- --
- -- You need to label both the mining and engineering turtles. I know,
- -- that's obvious but thought I'd mention it anyway.
- -- Okay the turtle's need the following programs.
- --
- -- Engineering Turtle --
- -- collectit - GYCsY7rr
- -- startup - XdE0B0vd
- -- ---------------------
- -- Mining Turtle --
- -- mynwell - f8ad3Vtz (This program)
- -- older mynwell - xUtqQ73B
- -- ---------------------
- -- If you choose not to use the 'myfuel' program then you need to
- -- comment it out from the programs. It simply reports remaining fuel.
- -- However, you need both the startup and collectit programs for
- -- the engineering turtle.
- function instructions()
- print("Place a Redstone Energy Cell in slot 1")
- print("Place an ender chest in slot 2")
- print("Place a Mining well in slot 3")
- print("Place an Engineering turtle in slot 4")
- end
- function getDim()
- print("Current fuel level = " .. turtle.getFuelLevel())
- print("How far should I mine before returning?")
- l = tonumber(read())
- print("How wide should my mining be?")
- w = tonumber(read())
- term.write("Left(1) or Right(2)?")
- mydir = read()
- return {l, w, mydir}
- end
- function clearWorkZone()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- while not turtle.up() do
- turtle.digUp()
- end
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- function forward()
- while not turtle.forward() do
- turtle.dig()
- turtle.suck()
- turtle.attack()
- turtle.suck()
- sleep(0.5)
- end
- end
- function deploy()
- while turtle.getItemCount(1) ~= 0 do
- turtle.select(1)
- turtle.place()
- end
- turtle.down()
- while turtle.getItemCount(2) ~= 0 do
- turtle.select(2)
- turtle.placeUp()
- end
- while turtle.getItemCount(4) ~= 0 do
- turtle.select(4)
- turtle.transferTo(16)
- end
- while turtle.getItemCount(3) ~= 0 do
- turtle.select(3)
- while not turtle.place() do
- turtle.dig()
- sleep(0.5)
- end
- end
- sleep(0.5)
- end
- function retrieve()
- if turtle.getItemCount(1) > 0 then
- print("Error, sleeping for 10,000")
- sleeping(10000)
- end
- while turtle.getItemCount(2) == 0 do
- turtle.select(1)
- turtle.digUp()
- turtle.transferTo(2)
- end
- while turtle.getItemCount(3) == 0 do
- turtle.select(1)
- turtle.dig()
- turtle.transferTo(3)
- end
- while turtle.getItemCount(16) ~= 0 do
- turtle.select(16)
- turtle.place()
- end
- local engineer = peripheral.wrap("front")
- while turtle.getItemCount(1) == 0 do
- engineer.turnOn()
- turtle.select(1)
- while not turtle.suck() do
- sleep(3)
- end
- end
- while turtle.dig() == false do
- sleep(0.1)
- end
- end
- function scanMe()
- turtle.select(1)
- for i=1, 15 do
- if turtle.getItemCount(i) > 0 then
- return false
- end
- end
- return true
- end
- function unload()
- turtle.select(1)
- while scanMe() == false do
- for i=1,15 do
- turtle.select(i)
- if turtle.getItemCount(i) > 0 then
- if turtle.getFuelLevel() < 1000 then
- turtle.refuel()
- end
- turtle.dropUp()
- sleep(0.1)
- end
- end
- end
- end
- function mineLength(l)
- for i=1, l do
- clearWorkZone()
- deploy()
- sleep(6)
- unload()
- retrieve()
- forward()
- end
- print("I have this much fuel left")
- print(tostring(turtle.getFuelLevel()))
- end
- function turn(d,x)
- if d == "1" then
- turtle.turnLeft()
- clearWorkZone()
- deploy()
- sleep(6)
- unload()
- retrieve()
- forward()
- turtle.turnLeft()
- elseif d == "2" then
- turtle.turnRight()
- clearWorkZone()
- deploy()
- sleep(6)
- unload()
- retrieve()
- forward()
- turtle.turnRight()
- else
- print("You were supposed to type a direction(1/2).")
- print ("But you typed " .. d .. " instead")
- end
- x = x + 1
- return x
- end
- function myFuel()
- print("My current fuel is: " .. tostring(turtle.getFuelLevel()))
- end
- -- Main
- local myt
- -- x = starting point by width
- local x = 1
- instructions()
- myt = getDim()
- local ll = tonumber(myt[1])
- local ww = tonumber(myt[2])
- local dd = myt[3]
- local bb --this will be opposite dd
- local recharge = turtle.getFuelLevel() - 960
- print ("Length will be = " .. ll)
- print ("Width will be = " .. ww)
- if dd == "1" then
- bb = "2"
- elseif dd == "2" then
- bb = "1"
- else
- print("You were supposed to type a direction(1/2).")
- print ("But you typed " .. dd .. " instead")
- end
- while not turtle.back() do
- sleep(1)
- end
- mineLength(1)
- if ww > x then
- while x <= ww do
- if turtle.getFuelLevel() <= recharge then
- print("Waiting so you can change out the energy block")
- waiting = read()
- recharge = turtle.getFuelLevel() - 960
- end
- mineLength(ll)
- if x == ww then
- myFuel()
- return
- else
- x = turn(dd,x)
- end
- mineLength(ll)
- if x >= ww then
- myFuel()
- return
- else
- x = turn(bb,x)
- end
- end
- else
- mineLength(ll)
- end
- print ("All Finished!")
- myFuel()
Advertisement
Add Comment
Please, Sign In to add comment