Orcinuss

NodeSpawn

Jun 14th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. local chest = peripheral.wrap("front")
  2. local node = peripheral.wrap("back")
  3. local size = chest.getInventorySize()
  4. local jetpack = false
  5. local payment = false
  6. local shardPayment = {}
  7. local shardSlot = {}
  8. local jetpackSlot = 0
  9.  
  10. for x = 1,6 do
  11.     shardPayment[x] = false
  12.     shardSlot[x] = 0
  13. end
  14.  
  15. local function getJetpack()
  16.     for x = 1,size do
  17.         local slot = chest.getStackInSlot(x)
  18.         if slot.id == "simplyjetpacks:jetpacks" then
  19.             if slot.dmg == 2 or slot.dmg == 3 or slot.dmg == 4 or slot.dmg == 5 then -- Check Regular
  20.                 jetpackSlot = x
  21.                 return true
  22.                 break
  23.             elseif slot.dmg == 102 or slot.dmg == 103 or slot.dmg == 104 or slot.dmg == 105 then -- Check Armored
  24.                 jetpackSlot = x
  25.                 return true
  26.                 break
  27.             end
  28.         elseif slot.id == "simplyjetpacks:jetpacksEIO" then
  29.             if slot.dmg == 2 or slot.dmg == 3 or slot.dmg == 4 or slot.dmg == 5 then -- Check Regular
  30.                 jetpackSlot = x
  31.                 return true
  32.                 break
  33.             elseif slot.dmg == 102 or slot.dmg == 103 or slot.dmg == 104 or slot.dmg == 105 then -- Armored
  34.                 jetpackSlot = x
  35.                 return true
  36.                 break
  37.             end
  38.         elseif slot.id == "IC2:itemArmorJetpackElectric" then
  39.                 jetpackSlot = x
  40.                 return true
  41.                 break
  42.         elseif slot.id == "GraviSuite:advNanoChestPlate" or slot.id == "GraviSuite:advJetpack" then
  43.                 jetpackSlot = x
  44.                 return true
  45.                 break
  46.         else
  47.             return false
  48.         end
  49.     end
  50. end
  51.  
  52. local function getPayment()
  53.     for shard = 1,6 do
  54.         for x = 1,size do
  55.             local slot = chest.getStackInSlot(x)
  56.             if slot.id == "Thaumcraft:ItemShard" then
  57.                 if slot.dmg == shard - 1 then
  58.                     shardPaymet[shard] = true
  59.                     shardSlot[shard] = x
  60.                 end
  61.             end
  62.             if shardPayment[1] and shardPayment[2] and shardPayment[3] and shardPayment[4] and shardPayment[5] and shardPayment[6]then
  63.                 return true
  64.                 break
  65.             else
  66.                 return false
  67.             end
  68.         end
  69.     end
  70. end
  71.  
  72. while true do
  73.     if redstone.getInput("right") then
  74.         jetpack = getJetpack()
  75.         if jetpack then
  76.             payment = getPayment()
  77.             if payment then
  78.                 for x = 1,6 do
  79.                     chest.pushItem(DOWN,x,1)
  80.                 end
  81.             end
  82.             chest.pullItem(EAST,1,1)
  83.         end
  84.     end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment