Advertisement
Sokia

Blood Altar

Mar 26th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.11 KB | None | 0 0
  1. local AltarSide = "back"
  2. local InputChestSide = "left"
  3. local OutputChestSide = "west"
  4. local VoronkaSide="south"
  5.  
  6. local altar = peripheral.wrap(AltarSide)
  7. local chest = peripheral.wrap(InputChestSide)
  8. local mas={0,0}
  9. local tank = altar.getTankInfo()
  10. local lp = tank[1]['contents']['amount']
  11. local Craft = {
  12. -- Slate 1 lvl
  13. {input="Thaumcraft:blockCosmeticSolid",
  14. output="AWWayofTime:blankSlate", Blood=1000},
  15. -- Slate 2 lvl
  16. {input="AWWayofTime:blankSlate",
  17. output="AWWayofTime:reinforcedSlate", Blood=2000},
  18. -- Slate 3 lvl
  19. {input="AWWayofTime:reinforcedSlate",
  20. output="AWWayofTime:imbuedSlate", Blood=5000},
  21. -- Slate 4 lvl
  22. {input="AWWayofTime:imbuedSlate",
  23. output="AWWayofTime:demonicSlate", Blood=15000},
  24. -- Slate 5 lvl
  25. {input="AWWayofTime:demonicSlate",
  26. output="AWWayofTime:bloodMagicBaseItems", Blood=30000}
  27.  --
  28.  }
  29.  
  30.  function CheckChestItem()
  31. while true do
  32.    for i=1, chest.getInventorySize() do
  33.     if chest.getStackInSlot(i)~=nil then
  34.       for j=1, 5 do
  35.         if chest.getStackInSlot(i).id==Craft[j].input then
  36.              mas={i,j}
  37.             print("1"..mas[2])
  38.             return mas
  39.         end end end end
  40.     end
  41.   end
  42.  
  43. function CheckCraft(j)
  44. while true do
  45. if altar.getStackInSlot(1)~=nil then
  46. if altar.getStackInSlot(1).id==Craft[j].output then
  47.  altar.pushItem(OutputChestSide, 1)
  48. craft="false"
  49. save_config(craft,mas[2])
  50. break
  51. end
  52. end
  53. sleep(0.2)
  54. end
  55. end
  56.  
  57. function CheckChest(i,j)
  58. while  true do
  59. local tank = altar.getTankInfo()
  60. local lp = tank[1]['contents']['amount']
  61.  if lp>=Craft[j].Blood then
  62. chest.pushItem(VoronkaSide, i, 1)
  63. craft="true"
  64. save_config(craft,mas[2])
  65. break
  66. end
  67. end
  68. sleep(0.1)
  69. end
  70.  
  71.  
  72. function save_config(craft,j)
  73.   sw = fs.open("config.txt", "w")  
  74.   sw.writeLine(craft)
  75.   sw.writeLine(j)
  76.   sw.close()
  77. end
  78.  
  79.  
  80.  
  81.  if fs.exists("config.txt") == false then
  82. save_config("false",0)
  83. else
  84.  sr = fs.open("config.txt", "r")
  85.   craft = sr.readLine()
  86.   mas[2]=tonumber(sr.readLine())
  87.   sr.close()
  88. end
  89.  
  90. while  true do
  91. if craft=="false" then
  92. mas=CheckChestItem()
  93. if mas[2]~=0 then
  94. CheckChest(mas[1],mas[2])
  95. end
  96. end
  97. CheckCraft(mas[2])
  98. sleep(0.1)
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement