Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---LUA MINECRAFT
- function digF()
- -- if not refuel() then
- -- print( "Not enough Fuel" )
- -- returnSupplies()
- -- end
- while not turtle.forward() do
- if turtle.detect() then
- if turtle.dig() then
- -- if not collect() then
- -- print("full must return")
- -- end
- else
- return false
- end
- elseif turtle.attack() then
- -- if not collect() then
- -- print("full must return")
- -- end
- else
- sleep( 0.5 )
- end
- end
- end
- function digD()
- -- if not refuel() then
- -- print( "Not enough Fuel" )
- -- returnSupplies()
- -- end
- while not turtle.down() do
- if turtle.detectDown() then
- if turtle.digDown() then
- -- if not collect() then
- -- print("full must return")
- -- end
- else
- return false
- end
- elseif turtle.attack() then
- -- if not collect() then
- -- print("full must return")
- -- end
- else
- sleep( 0.5 )
- end
- end
- end
- --Dig Forward
- -- sleep?
- function dropAll()
- -- be sure to be facing chest
- -- check if chest infront
- local success, data = turtle.inspect()
- if success then
- print("Block name: ", data.name)
- print("Block metadata: ", data.metadata)
- end
- if string.sub(data.name, -5) == "chest" then
- for n=1,16 do
- if turtle.getItemCount(n) > 0 then
- turtle.select(n)
- turtle.drop()
- end
- end
- else
- print("no Chest")
- end
- end
- function layeredQuarry()
- print("Starting Layered Quarry")
- --get x level
- print("Input x level:")
- local i = read("*")
- print('You chose, ', i, '!\n')
- -- workout how big first square is at this layer
- -- Get Width and Lenfth (W)
- w = i + 1
- w_orig = i
- d = i
- -- define start point check if chest?
- --Check Fuel
- -- Refule if needed
- turtle.refuel()
- -- Ask to go left or right
- print("Swing Left (l) or Right (r) ?:")
- local lr = read("*")
- print('You chose, ', lr, '!\n')
- firstRun = true
- repeat
- --First layer
- repeat
- print("Moving ",w," spaces.\n")
- for n=1,w do
- digF()
- end
- if lr == "l" then
- turtle.turnLeft()
- elseif lr == "r" then
- turtle.turnRight()
- else
- print("error 4")
- end
- for n=1,w-1 do
- digF()
- end
- if lr == "l" then
- turtle.turnLeft()
- elseif lr == "r" then
- turtle.turnRight()
- else
- print("error 4")
- end
- for n=1,w-1 do
- digF()
- end
- if lr == "l" then
- turtle.turnLeft()
- elseif lr == "r" then
- turtle.turnRight()
- else
- print("error 4")
- end
- for n=1,w-2 do
- digF()
- end
- if lr == "l" then
- turtle.turnLeft()
- elseif lr == "r" then
- turtle.turnRight()
- else
- print("error 4")
- end
- print("Finished section ",w," Moves.\n")
- if w == 1 then
- w = 0
- else
- w = w - 2
- end
- until w == 0
- print("1st Layer completed")
- --Back to base
- if (w_orig % 2 == 0) then
- -- if I is even, half right, hlf down
- turtle.turnRight()
- for n=1, (w_orig * 0.5) do
- digF()
- end
- turtle.turnRight()
- for n=1, (w_orig * 0.5) do
- digF()
- end
- turtle.turnRight()
- turtle.turnRight()
- else
- -- iff odd, one accross right, then half right, then half down
- turtle.turnRight()
- digF()
- -- Need to adjust up / down for return --------------------------------------------------------------------
- for n=1, (w_orig * 0.5) do
- digF()
- end
- turtle.turnRight()
- for n=1, (w_orig * 0.5) do
- digF()
- end
- digF()
- --
- dropAll()
- --
- turtle.turnRight()
- turtle.turnRight()
- end
- --move and dig down
- print("checkp 1")
- -- digF()
- if lr == "l" then
- turtle.turnLeft()
- elseif lr == "r" then
- turtle.turnRight()
- else
- print("error 4")
- end
- digF()
- if lr == "l" then
- turtle.turnRight()
- elseif lr == "r" then
- turtle.turnLeft()
- else
- print("error 4")
- end
- digD()
- digF()
- d = d - 1
- --d = 3 -- remove
- w = w_orig - 1
- w_orig = w_orig - 1
- until d == 5
- print("completed")
- end
- print("MezMiner Starting......")
- print("Fuel: ")
- print(turtle.getFuelLevel())
- print("")
- print("")
- x, y, z = 0,0,0
- print("")
- print("Select option: ")
- print("1. Layered Quarry")
- print("2. Straight Down")
- print("3. Stairway Down")
- local i = read("*n")
- print('You chose, ', i, '!\n')
- if i == "1" then
- layeredQuarry()
- elseif i == "2" then
- --[ Executes when the boolean expression 2 is true --]
- print("Lets Strigh Downnnn")
- elseif i == "3" then
- print("Lets Stairwa")
- --[ Executes when the boolean expression 3 is true --]
- else
- print("No Option?")
- --[ executes when the none of the above condition is true --]
- end
- --Get task (Mine, Strip, down, )
- --Check If correct type of turtle?
- --Check Fuel?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement