Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- in early development
- local tun_number=1
- local num_black_list=4;
- local num_white_list=4;
- local reportArray={}
- local depth=0;
- function reportFind(item)
- print(item," ",tun_number,",",depth)
- end
- function boreHoleScan()
- local lim=num_black_list+num_white_list
- local found=false;
- local i=0
- for i=lim,1,-1 do
- turtle.select(i)
- found=(turtle.compare() or turtle.compareUp() or turtle.compareDown())
- if (found) then
- if(i>num_black_list) then
- if(turtle.getItemSpace(i)>0) then turtle.digUp();turtle.digDown(); end
- reportFind(i)
- end
- break
- end
- if(not found and i<=1) then reportFind(0) end
- if(found) then turtle.select(1);return found end
- turtle.turnRight()
- for i=lim,1,-1 do
- turtle.select(i)
- found=(turtle.compare())
- if(found) then
- if(i>num_black_list) then
- if(turtle.getItemSpace(i)>0) then turtle.dig() end
- reportFind(i)
- end
- break
- end
- end
- if(not found and i<=1) then reportFind(0) end
- turtle.turnLeft()
- if(found) then turtle.select(1);return found end
- turtle.turnLeft()
- for i=lim,1,-1 do
- found=(turtle.compare())
- turtle.select(i)
- if(i>num_black_list) then
- if(turtle.getItemSpace(i)>0) then turtle.dig() end
- reportFind(i)
- end
- break
- end
- end
- if(not found and i<=1) then reportFind(0) end
- turtle.turnLeft()
- turtle.turnRight()
- turtle.select(1)
- return found
- end
- function checkInventory()
- local cnt;
- if(turtle.getItemCount(16)==0) then return end
- if(turtle.detectDown()) then turtle.digDown() end
- for i=0,num_black_list do
- cnt=turtle.getItemCount(i)
- if(cnt>1) then turtle.select(i);turtle.dropDown(cnt-1) end
- end
- for i=(num_black_list+num_white_list+1),16 do
- turtle.select(i);turtle.dropDown();
- end
- turtle.select(1)
- end
- function boreHoleMine(length,direction)
- for i=1,length do
- while(turtle.detect()) do turtle.dig() end
- turtle.forward();
- depth=depth+ direction;
- boreHoleScan()
- end
- end
- local num=0
- local len=0
- print("number of tunnels?")
- num=tonumber(read())
- print("length of tunnels?")
- len=tonumber(read())
- print("last black list item(1-16) ?")
- num_black_list=tonumber(read())
- num_white_list=0
- for i=num_black_list+1,16 do
- if(turtle.getItemCount(i)==0) then break else num_white_list=num_white_list+1; end
- end
- local dir=1
- num=num+num%2
- for i=1,num do
- boreHoleMine(len,dir)
- checkInventory()
- if(dir>0) then turtle.turnLeft() else turtle.turnRight(); end
- boreHoleMine(3,dir)
- if(dir>0) then turtle.turnLeft() else turtle.turnRight(); end
- tun_number=tun_number+1
- dir=dir*-1
- end
- --for i=1,reportArray.getn() do print (reportArray[i][0]," ", reportArray[i][1],",",reportArray[i][0]) end
Advertisement
Add Comment
Please, Sign In to add comment