Kagee

libstruct

May 1st, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs.delete("aware.current")
  2. os.loadAPI("aware")
  3. a=aware
  4. function block(endblock)
  5.     for i=1,endblock do
  6.         turtle.select(i)
  7.         if turtle.compareDown() then
  8.             turtle.digDown()
  9.             return i
  10.         end
  11.     end
  12.     -- destroy unknown blocks
  13.     turtle.digDown()
  14.     return 0
  15. end
  16.  
  17. function place(i)
  18.     if (i > 0) then
  19.         turtle.select(i)
  20.         if (not turtle.compareDown()) then
  21.             -- remove wrong block
  22.             turtle.digDown()
  23.             if (turtle.getItemCount(i) < 2 ) then
  24.                 print("Sleeping while waiting for refill in slot " .. i)
  25.                 while (turtle.getItemCount(i) < 2 ) do
  26.                     os.sleep(15)
  27.                 end
  28.             end
  29.             if (not turtle.placeDown()) then
  30.                 error("Unable to place")
  31.             end
  32.         end
  33.     end
  34. end
  35.  
  36. function ml()
  37.     a.l()
  38.     a.df()
  39.     a.r()
  40. end
  41.  
  42. function mr()
  43.     a.r()
  44.     a.df()
  45.     a.l()
  46. end
  47.  
  48. function t180()
  49.     a.r()
  50.     a.r()
  51. end
  52.  
  53. function save(table,name)
  54.     local file = fs.open(name,"w")
  55.     file.write(textutils.serialize(table))
  56.     file.close()
  57. end
  58.  
  59. function load(name)
  60.     local file = fs.open(name,"r")
  61.     local data = file.readAll()
  62.     file.close()
  63.     return textutils.unserialize(data)
  64. end
  65. function awarecleanup()
  66.     fs.delete("aware.current")
  67.     fs.delete("aware.start")
  68. end
Advertisement
Add Comment
Please, Sign In to add comment