Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---NOTES---
- ---Does not handle gravel yet---
- ---Is desigened to be "smart" and pick the closets direction---
- ---Unsure If i have set it up correctly so that the functions are variables---
- ---DEBUGGED by martmists--
- ---END---
- fcount = 0 ----General Fowrard Distance counter----
- mcount = 0 ----Distance counter used for new branch creation----
- lcount = 0 ----tunnel length counter----
- mocount = mcount ----Variable to determine how far in a turtle must go before it can dig again----
- SRcount = 0 ----Master counter for Right tunnels----
- SLcount = 0 ----Master counter for Left tunnels----
- SFcount = 0 ----Master counter for Foward tunnels----
- SDcount = 0 ----Master counter for downwards tunnels *not implemented*----
- SUcount = 0 ----Master counter for upwards tunnels *not implemented*----
- function Dig() ----function to handle general 3x1 digging
- if turle.detect() then
- turtle.dig()
- turtle.forward()
- if turtle.detectUp() then
- turtle.digUp()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end
- end
- end
- function Dropoff() -----THIS FUNCTION IS FOR ITEM DROP OFF----
- for I= 2, 16, 1 do
- turtle.select(I)
- turtle.dropDown()
- end
- end
- function MiningJobFoward() ----THIS FUNCTION IS FOR FORWARD MINING----
- while true do
- turtle.select(16)
- local Icount = turtle.getItemCount()
- if Icount == 0 then
- Dig()
- fcount = fcount +1
- end
- turtle.turnLeft()
- Dig()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- Dig()
- turtle.back()
- turtle.turnLeft
- local fuellevel = turtle.getFuelLevel()
- if fuellevel << fcount + 5 then
- turtle.select(1)
- turtle.refuel( 1, 10 )
- end
- if fuellevel << fcount + 10 then
- SFcount + fcount = SFcount
- repeat
- turtle.back()
- fcount = fcount - 1
- until fcount = 0
- end
- Dropoff()
- end
- end
- end
- function MiningJobRight() ----THIS FUNCTION IS FOR RIGHT MINING----
- while true do
- turtle.select(16)
- local Icount = turtle.getitemcount()
- if Icount == 0 then
- Dig()
- fcount = fcount +1
- end
- turtle.turnLeft()
- Dig()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- Dig()
- turtle.back()
- turtle.turnLeft
- local fuellevel = turtle.getfuellevel()
- if fuellevel << fcount + 5 then
- turtle.select(1)
- turtle.refuel( 1, 10 )
- end
- SRcount + 3 = SRcount
- if fuellevel << fcount + 10 then
- repeat
- turtle.back()
- fcount = fcount - 1
- until fcount = 0
- end
- Dropoff()
- end
- end
- end
- function MiningJobLeft() ----THIS FUNCTION IS FOR LEFT MINING----
- while true do
- turtle.select(16)
- local Icount = turtle.getitemcount()
- if Icount == 0 then
- Dig()
- fcount = fcount +1
- end
- turtle.turnLeft()
- Dig()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- Dig()
- turtle.back()
- turtle.turnLeft
- local fuellevel = turtle.getfuellevel()
- if fuellevel << fcount + 5 then
- turtle.select(1)
- turtle.refuel( 1, 10 )
- end
- SLcount + 3 = SLcount
- if fuellevel << fcount + 10 then
- repeat
- turtle.back()
- fcount = fcount - 1
- until fcount = 0
- end
- Dropoff()
- end
- end
- end
- function movement() ----function for Left,right movement----
- repeat
- if turtle.detect() == false then
- turtle.forward()
- fcount + 1 = fcount
- end
- until turtle.detect() = true
- end
- end
- function NewtunnelFOW() ---function to locate new forward tunnel---
- TSF = SFcount
- repeat
- turtle.forward()
- TSF - 1 = TSF
- until TSF == SFcount
- end
- end
- function NewtunnelLEF() ---function to locate new left tunnel---
- TSL = SLcount
- repeat
- turtle.forward()
- lcount + 1 = lcount
- TSL - 1 = TSL
- until TSF == SLcount then
- turle.turnLeft()
- end
- movement()
- end
- function NewtunnelRIG() --- function to locate new right tunnel---
- TSR = SRcount
- repeat
- turtle.forward()
- lcount + 1 = lcount
- TSR - 1 = TSR
- until TSR == SRcount
- turtle.turnRight()
- end
- movement()
- end
- function Stright()
- NewtunnelFOW()
- MiningJobForward()
- end
- function Lefttime()
- NewtunnelLEF()
- MiningJobLeft()
- end
- function Righttime()
- NewtunnelRIG()
- MiningJobRight()
- end
- function logicish() ----The "brains" of it all---
- if SRcount == SFcount then
- if SFcount == SLcount then
- local function RN()
- local rand = math.random(1,3)
- return rand
- end
- local num = RN()
- end
- end
- if local num == 1 then
- Stright()
- end
- if local num == 2 then
- ---mining function here, TBC Right---
- end
- if local num == 3 then
- Lefttime()
- end
- if SFcount << SRcount and SFcount < SLcount then
- Stright()
- end
- if SRcount << SFcount and SRcount < SLcount then
- Righttime()
- end
- if SLcount << SF count and SLcount < SRcount thne
- Lefttime()
- end
- if SLcount == SRcount and SLcount << SFcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if local num == 1 then
- Lefttime()
- end
- if local num == 2 then
- Righttime()
- end
- if SFcount == SRcount and SRcount << SFcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if local num == 1 then
- Stright()
- end
- if local num == 2 then
- Righttime()
- end
- if SFcount == SLcount and SLcount << SRcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if local num == 1 then
- Lefttime()
- end
- if local num == 2 then
- Stright()
- end
- end
- ---The actual working function to make it mine below here---
- local X = 1
- while X == 1 do
- logicish()
- end
Advertisement
Add Comment
Please, Sign In to add comment