Suterusu

CC-DragonSpawn

Nov 23rd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1.  
  2. inv_spawn = peripheral.wrap("ender_chest_2")
  3. inv_res = peripheral.wrap("ender_chest_1")
  4. output = peripheral.wrap("ender_chest_3")
  5.  
  6.  
  7. local function rs_seq()
  8.     inv_spawn.pushItem("north", diamond_pos, 4)
  9.     inv_spawn.pushItem("north", quartz_pos, 12)
  10.     inv_spawn.pushItem("north", glow_pos, 4)
  11.     inv_spawn.pushItem("north", charged_pos, 4)
  12.     inv_res.pushItem("north", res_pos, 1)
  13.     os.sleep(10)
  14.     rs.setOutput("left", true)
  15.     os.sleep(0.75)
  16.     rs.setOutput("left", false)
  17.     os.sleep(0.75)
  18.     rs.setOutput("left", true)
  19.     os.sleep(0.75)
  20.     rs.setOutput("left", false)
  21.  
  22.    
  23. end
  24.  
  25. local function scan_inventory()
  26.     inv_spawn.condenseItems()
  27.     inv_res.condenseItems()
  28.     diamond = false
  29.     diamond_pos = 0
  30.     quartz= false
  31.     quartz_pos = 0
  32.     glow = false
  33.     glow_pos = 0
  34.     charged = false
  35.     charged_pos = 0
  36.     res = false
  37.     res_pos = 0
  38.     for i = 1, inv_spawn.getInventorySize(), 1 do
  39.         if inv_spawn.getStackInSlot(i) then
  40.             print(inv_spawn.getStackInSlot(i).display_name)
  41.             if inv_spawn.getStackInSlot(i).display_name == "Block of Diamond" then
  42.                 diamond = true
  43.                 diamond_pos = i
  44.             end
  45.         end
  46.     end
  47.     for i = 1, inv_spawn.getInventorySize(), 1 do
  48.         if inv_spawn.getStackInSlot(i) then
  49.             print(inv_spawn.getStackInSlot(i).display_name)
  50.             if inv_spawn.getStackInSlot(i).display_name == "Pillar Quartz Block" then
  51.                 quartz = true
  52.                 quartz_pos = i
  53.             end
  54.         end
  55.     end
  56.     for i = 1, inv_spawn.getInventorySize(), 1 do
  57.         if inv_spawn.getStackInSlot(i) then
  58.             print(inv_spawn.getStackInSlot(i).display_name)
  59.             if inv_spawn.getStackInSlot(i).display_name == "Glowstone" then
  60.                 glow = true
  61.                 glow_pos = i
  62.             end
  63.         end
  64.     end
  65.     for i = 1, inv_spawn.getInventorySize(), 1 do
  66.         if inv_spawn.getStackInSlot(i) then
  67.             print(inv_spawn.getStackInSlot(i).display_name)
  68.             if inv_spawn.getStackInSlot(i).display_name == "Charged Draconium Block" then
  69.                 charged = true
  70.                 charged_pos = i
  71.             end
  72.         end
  73.     end
  74.     for i = 1, inv_res.getInventorySize(), 1 do
  75.         if inv_res.getStackInSlot(i) then
  76.             print(inv_spawn.getStackInSlot(i).display_name)
  77.             if inv_res.getStackInSlot(i).display_name == "Resurrection Stone" then
  78.                 res = true
  79.                 res_pos = i
  80.             end
  81.         end
  82.     end
  83.     print(diamond)
  84.     print(quartz)
  85.     print(glow)
  86.     print(charged)
  87.     print(res)
  88.     if diamond and quartz and glow and charged and res then
  89.         IS_CRAFTING = true
  90.         rs_seq()
  91.     end
  92. end
  93.  
  94.  
  95. local function check_for_finish()
  96.     for i = 1, output.getInventorySize(), 1 do
  97.         if output.getStackInSlot(i) then
  98.             if output.getStackInSlot(i).display_name == "Dragon Heart" then
  99.                 print("Found finished Dragon Heart.")
  100.                 output.pushItem("up", i, 1)
  101.                 IS_CRAFTING = false
  102.             end
  103.         end
  104.     end
  105. end
  106.  
  107. IS_CRAFTING = false
  108.  
  109. print("Startin script...")
  110.  
  111. while true do
  112.     print("Crafting status: " .. tostring(IS_CRAFTING))
  113.     if IS_CRAFTING then
  114.         print("Checking for finished Dragon Heart....")
  115.         check_for_finish()
  116.     else
  117.         print("Checking for available spawning materials...")
  118.         scan_inventory()   
  119.     end
  120.     os.sleep(10)
  121. end
Add Comment
Please, Sign In to add comment