Advertisement
theinsekt

mineMaterials

Feb 25th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. args={...}
  2.  
  3. os.loadAPI("theinsekt/mineVein")
  4. os.loadAPI("theinsekt/mine2")
  5.  
  6. if #args~=2 then
  7.   print("Usage: mineMaterials <dir> <limit>")
  8.   return
  9. end
  10. local slots=mineVein.slotsA()
  11.  
  12. local dir=args[1]
  13. local limit=tonumber(args[2])
  14.  
  15. local noReturn="Blocked when trying to return."
  16. local noMaterial="No material in first inventory slot, so trying to mine material in direction."
  17.  
  18. if #slots==0 then
  19.   print(noMaterial)
  20.   if mine2.digLoop(dir,1)~=1 then
  21.     print("Blocked!")
  22.     print("finished")
  23.     return
  24.   end
  25.   slots=mineVein.slotsA()
  26.   if #slots==0 then
  27.     print("Found no material in direction.")
  28.     if mine2.digLoop(dir,-1)~=-1 then
  29.       print(noReturn)
  30.     else
  31.       print("finished")
  32.     end
  33.     return
  34.   end
  35.   if mineVein.mineVeinR(slots, true,limit) then
  36.     if mine2.digLoop(dir,-1)==-1 then
  37.       print("finished")
  38.       return
  39.     end
  40.   end
  41.   print(noReturn)
  42.   return
  43. end
  44.  
  45.  
  46.  
  47. if mineVein.mineVein(dir,slots,true,limit) then
  48.   print("finished")
  49. else
  50.   print(noReturn)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement