Advertisement
MagmaLP

miniumstone-reperatur

Oct 28th, 2023 (edited)
918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. sleep(2)
  2. print("Start")
  3.  
  4. os.loadAPI("ocs/apis/sensor")
  5. sen = sensor.wrap("left")
  6.  
  7. Shard_Of_Minium_Amount = 0
  8. Reboot_Couter = 0
  9.  
  10. s = sen.getTargets()
  11. function getS()
  12.     for v, k  in pairs(s) do
  13.         if k.Name == "ME Wireless Access Point" then  
  14.             target = v
  15.         end
  16.     end
  17.     return target
  18. end
  19.  
  20. rs.setOutput("top", true)
  21. sleep(0.5)
  22. rs.setOutput("top", false)
  23. turtle.select(1)
  24. turtle.drop()
  25. for i = 3,16 do
  26.     a = turtle.getItemCount(i)
  27.     if a > 0 then
  28.         turtle.select(i)
  29.         turtle.drop()
  30.     end
  31. end
  32.  
  33. while true do
  34.     os.pullEvent = os.pullEventRaw
  35.     f = getS()
  36.     s1 = sen.getTargetDetails(target)
  37.     for v, k in pairs(s1.Items) do
  38.         --sleep(0.1)
  39.  
  40.     ---ME Inventar Abfrage----
  41.  
  42.         if k.Name == "Shard of Minium" then
  43.             Shard_Of_Minium_Amount = k.Size
  44.         end
  45.     end
  46.    
  47.     c = turtle.getItemCount(1)
  48.     if Shard_Of_Minium_Amount >= 4 and c == 1 then
  49.         for i = 3,16 do
  50.             a = turtle.getItemCount(i)
  51.             if a > 0 then
  52.                 turtle.select(i)
  53.                 turtle.drop()
  54.             end
  55.         end
  56.         rs.setOutput("bottom", true)
  57.         sleep(0.5)
  58.         rs.setOutput("bottom", false)
  59.         sleep(0.5)
  60.         turtle.craft()
  61.         turtle.select(1)
  62.         turtle.drop()
  63.         for i = 3,16 do
  64.             a = turtle.getItemCount(i)
  65.             if a > 0 then
  66.                 turtle.select(i)
  67.                 turtle.drop()
  68.             end
  69.         end
  70.         os.reboot()
  71.     else
  72.         sleep(1)
  73.         Reboot_Couter = Reboot_Couter + 1
  74.         if Reboot_Couter == 30 then
  75.             os.reboot()
  76.         end
  77.     end
  78. end
  79.  
  80.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement