CheeseLiker

Network Ingot Fluid Transfer - Computer Craft 1.99.1

Jan 2nd, 2024 (edited)
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- Ingot Fluid Transfer by CheeseLiker - Computer Craft 1.99.1 --
  2. -- For transferring an ingot of liquid at a time over network cables and modems. Written to be used for smeltery automation.
  3. -- Does not currently prevent sending less than an ingot if output tank has less than an ingot of space left. (If you use an output tank with a max capacity that's a multiple of an ingot (144) you don't need to worry about this)
  4.  
  5. -- SETTINGS ========================
  6.  
  7. -- Modem name of the input tank; e.g. a smeltery drain
  8. local inputTankName = "tconstruct:drain_0"
  9. -- Comma separated list of modem names of the output tanks; e.g. the smeltery casting tables
  10. local outputTanks = {"tconstruct:table_0", "tconstruct:table_1"}
  11.  
  12. -- END SETTINGS =====================
  13.  
  14.  
  15. local inputTank = peripheral.wrap(inputTankName)
  16.  
  17. while true do
  18.     local tanks = inputTank.tanks()
  19.     if tanks then
  20.         for _, liquid in pairs(tanks) do
  21.             if liquid.amount >= 144 then
  22.                 for _, tank in pairs(outputTanks) do
  23.                     if inputTank.pushFluid(tank, 144, liquid.name) == 144 then
  24.                         break
  25.                     end
  26.                 end
  27.             end
  28.         end
  29.     end
  30.     sleep(1)
  31. end
  32.  
Advertisement
Add Comment
Please, Sign In to add comment