Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. activator=15
  2. wrench=16
  3. tool=1
  4. ran=2
  5. if turtle.getItemCount(1)==0 then
  6.   noItem=true
  7. end
  8.  
  9. function organize()
  10.   for i=1,16 do
  11.     turtle.select(i)
  12.     s1=turtle.getItemDetail()
  13.     if s1 and s1.name=="ThermalExpansion:Device" then
  14.       turtle.transferTo(15)
  15.     end
  16.     if s1 and s1.name=="BuildCraft|Core:wrenchItem"
  17.      then
  18.       turtle.transferTo(16)
  19.      end
  20.   end
  21. end
  22.    
  23.    
  24.  
  25. function Orient()    
  26. shell.run("go bk")
  27. turtle.select(activator)
  28. turtle.place()
  29. turtle.select(ran)
  30. while turtle.drop(1)==false do
  31.   turtle.select(wrench)
  32.   turtle.place()
  33.   turtle.select(ran)
  34. end
  35. turtle.select(tool)
  36. turtle.drop()
  37. turtle.select(ran)
  38. while turtle.suck(1)==false do
  39.   turtle.select(wrench)
  40.   turtle.place()
  41.   turtle.select(ran)
  42. end
  43. end
  44.  
  45. function use()
  46.   rs.setAnalogOutput("front",15)
  47.   sleep(1)
  48.   rs.setAnalogOutput("front",0)
  49. end
  50.  
  51. function restore()
  52.   if not noItem then
  53.   while turtle.suck()==false do
  54.     turtle.select(wrench)
  55.     turtle.place()
  56.     turtle.select(tool)
  57.   end
  58.   turtle.dig()
  59.   else
  60.   turtle.dig()
  61.   end
  62. end
  63.  
  64. function doIt()
  65.   Orient()
  66.   sleep(1)
  67.   use()
  68.   sleep(3)
  69.   restore()
  70.   shell.run("go fd")
  71. end
  72.  
  73.  
  74.  
  75. while true do
  76.   axe = 0
  77.   quicklime = 0
  78.   time = os.time()
  79.   if time > 2.000 then
  80.     shell.run("go up 2")
  81.     turtle.select(2)
  82.     turtle.placeDown()
  83.     for i = 1, 14 do
  84.       turtle.select(i)
  85.       item = turtle.getItemDetail()
  86.       if item then
  87.         if item.name == "minecraft:stone_axe" then
  88.           axe = i
  89.           print("Axe detected in slot ")
  90.         end
  91.         if item.name == "witchery:ingredient" and item.damage == 16 then
  92.           quicklime = i
  93.           print("Quicklime detected in slot ")
  94.         end
  95.       end
  96.     end
  97.     if axe == 0 or quicklime == 0 then
  98.       print("ALERT: Out of supplies. Daytime imminent...")
  99.     else
  100.     turtle.select(axe)
  101.     turtle.drop()
  102.     turtle.select(quicklime)
  103.     turtle.drop()
  104.     organize()
  105.         for i=2,2 and 15,16 do
  106.             turtle.select(i)
  107.         if turtle.getItemCount()<1 then
  108.           break
  109.         else
  110.                 doIt()
  111.         end
  112.         end
  113.     turtle.digDown()
  114.     shell.run("go down 2")
  115.     end
  116.   end
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement