luckdemon

oreVein1.0

Nov 2nd, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. local args = {...}
  4. local idet = peripheral.wrap("right")
  5. oreF = 0
  6. oreB = 0
  7. oreT = 0
  8.  
  9.  
  10. function oreList()
  11.     t = { 0,1,2,3,4,5,12,13,17,20,24,49,87,88 }
  12.     end
  13.  
  14. function table.contains(table, element)
  15.   for _, value in pairs(table) do
  16.     if value == element then
  17.       return true
  18.     end
  19.   end
  20.   return false
  21. end
  22. --[[
  23. function oreVein()
  24.     while p == true do
  25.     blockFront = idet.IDetect()
  26.     blockTop = idet.IDetectUp()
  27.     blockBottom = ider.IDetectDown()
  28.    
  29.     if not table.contains(t,blockFront) then
  30.     turtle.dig()
  31.     turtle.forward()
  32.     oreVein()
  33.     elseif not table.contains(t,blockTop) then
  34.     turtle.digUp()
  35.     turtle.up()
  36.     oreVein()
  37.     elseif not table.contains(t,blockTop) then
  38.     turtle.digDown()
  39.     turtle.down()
  40.     oreVein()
  41.     end
  42.     end
  43. end
  44. --]]
  45. function orecheck()
  46.     blockFront = idet.IDetect()
  47.     blockTop = idet.IDetectUp()
  48.     blockBottom = idet.IDetectDown()
  49.     if not table.contains(t,blockFront) and oreF not == 1 then
  50.     turtle.dig()
  51.     oreF = 1
  52.     print("mined front")
  53.     orecheck()
  54.     elseif not table.contains(t,blockTop) then
  55.     turtle.digUp()
  56.     oreT = 1
  57.     print("mined top")
  58.     orecheck()
  59.     elseif not table.contains(t,blockBottom) then
  60.     turtle.digDown()
  61.     oreB = 1
  62.     print("mined bottom")
  63.     orecheck()
  64.     elseif table.contains(t,blockFront) then
  65.     end
  66. end
  67.  
  68. oreList()
  69. orecheck()
  70. print(oreF)
  71. print(oreB)
  72. print(oreT)
Advertisement
Add Comment
Please, Sign In to add comment