Advertisement
TheSpicePhantom

TE&MEK Upgrades

Jan 5th, 2021
1,090
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local mode = {"mekanism", "thermalexpansion"}
  2.  
  3. local tiers = {}
  4. tiers.thermalexpansion = {"Hardened", "Electrum", "Signalum", "Resonant"}
  5. tiers.mekanism = {"Basic", "Advanced", "Elite", "Ultimate"}
  6. local machines = {}
  7. machines.thermalexpansion = {"thermalexpansion:cell", "thermalexpansion:machine", "thermalexpansion:dynamo", "thermalexpansion:strongbox", "thermalexpansion:cache", "thermalexpansion:tank"}
  8. machines.mekanism = {"mekanism:machineblock", "mekanism:gastank"}
  9. local upgradeables = {}
  10. upgradeables.mekanism = {"mekanism:tierinstaller"}
  11. upgradeables.thermalexpansion = {"thermalfoundation:upgrade"}
  12.  
  13. function checkInventoryAndUpgrade()
  14.   term.clear()
  15.   term.setCursorPos(1,1)
  16.   if turtle.getItemCount(16) == 0 then
  17.     for i = 1,15 do
  18.       local current = turtle.getItemDetail(i)
  19.       if current ~= nil then
  20.         print("'"..current.name.."' in Slot "..i)
  21.         for k,v in pairs(machines) do
  22.           for a,b in pairs(v) do
  23.             if current.name == b then
  24.               turtle.select(i)
  25.               turtle.placeDown()
  26.               turtle.select(1)
  27.             end
  28.           end
  29.         end
  30.         sleep(0.5)
  31.         for k,v in pairs(upgradeables) do
  32.           for a,b in pairs(v) do
  33.             if current.name == b then
  34.               turtle.select(i)
  35.               turtle.placeDown()
  36.               turtle.select(1)
  37.             end
  38.           end
  39.         end
  40.       end
  41.     end
  42.   end
  43. end
  44.  
  45. while true do
  46.   checkInventoryAndUpgrade()
  47.   sleep(0.5)
  48.   turtle.select(16)
  49.   if turtle.getItemCount(16) == 0 then
  50.     turtle.digDown()
  51.   end
  52. end
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement