ccraftersanonmoose

flux-compressor.lua

Mar 29th, 2025 (edited)
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. -- Script to stop the flux compressor from exploading
  2. -- planning to control this behavior via redstone integrator
  3. -- should turn off compressor when it reaches critical
  4. -- should also turn the compressor back on when pressure reaches 11 bar
  5. -- compressor is being used in this case to power a spawner
  6. -- can be successfully modified to power a compression chamber
  7. -- also tested with de-pressurizing a compression chanber via a vacuum pump
  8. -- in the case the max pressure allowed was 5 bar and the minimum was 3 bar
  9.  
  10.  
  11. ----------
  12. -- wrap peripherals, change names as needed
  13. local flux = peripheral.wrap("pneumaticcraft:flux_compressor_0")
  14. local relay = peripheral.wrap("redstoneIntegrator_0")
  15.  
  16. -- monitor pressure & shut off when near critical
  17. -- cardinal directions tend to work best here
  18. local function fluxcontrol()
  19.     if flux.getPressure() >=19 then
  20.         relay.setOutput("south", false)
  21.     elseif flux.getPressure() <= 11 then
  22.         relay.setOutput("south", true)
  23.  
  24.     end
  25. end
  26.  
  27.  
  28. while true do
  29.     fluxcontrol()
  30.     sleep(0.3)
  31. end
Advertisement
Add Comment
Please, Sign In to add comment