Advertisement
gongitompie

Untitled

Sep 1st, 2023
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. transposer = peripheral.wrap("back")
  2. fluidInterface = peripheral.wrap("top")
  3. monitor = peripheral.wrap("right")
  4.  
  5. if monitor ~= nil then
  6. monitor.setTextScale(0.5)
  7. end
  8.  
  9. itemToFluidMap = {
  10. ["Redstone Energy Fluxduct (Empty)"] = {
  11. ["targetFluid"] = "redstone",
  12. ["millibucketsNeeded"] = 200
  13. },
  14. ["Cryo-Stabilized Fluxduct (Empty)"] = {
  15. ["targetFluid"] = "cryotheum",
  16. ["millibucketsNeeded"] = 500
  17. }
  18. }
  19.  
  20. iteration = 0
  21.  
  22. function printDivider()
  23. local width, height = term.getSize()
  24. print(string.rep("-", width))
  25. end
  26.  
  27. while true do
  28. term.clear()
  29. term.setCursorPos(1,1)
  30.  
  31. print("Iteration: " .. iteration)
  32.  
  33. local currentTransposerItem = transposer.getItem(1)
  34.  
  35. if currentTransposerItem ~= nil then
  36. -- print("Item found in Liquid Transposer!")
  37. local currentTransposerItemName = currentTransposerItem.getMetadata().displayName
  38. print(currentTransposerItemName .. " found!")
  39. printDivider()
  40.  
  41. local targetFluidData = itemToFluidMap[currentTransposerItemName]
  42. -- print(targetFluidData)
  43. if targetFluidData ~= nil then
  44. local targetFluid = targetFluidData["targetFluid"]
  45. local targetFluidTankIndex = nil
  46.  
  47. for tankIndex, fluidData in pairs(fluidInterface.getTanks()) do
  48. if targetFluid == fluidData.name then
  49. targetFluidTankIndex = tankIndex
  50. print("Found targetFluid: " .. targetFluid .. " in tank " .. targetFluidTankIndex)
  51. printDivider()
  52.  
  53. --print(textutils.serialise(fluidData))
  54. end
  55. end
  56.  
  57. if targetFluidTankIndex ~= nil then
  58. transposer.pullFluid(peripheral.getName(fluidInterface), targetFluidData.millibucketsNeeded, targetFluid)
  59. else
  60. print("Target Fluid " .. targetFluid .. " not found!")
  61. printDivider()
  62. end
  63. else
  64. print("Target Fluid not set!")
  65. printDivider()
  66. end
  67. sleep(2)
  68. else
  69. print("No item found in Fluid Transposer. Waiting...")
  70. sleep(60)
  71. end
  72. iteration = iteration + 1
  73. --print(targetFluid)
  74. end
  75.  
  76. textutils.pagedPrint("Any key to continue")
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement