Advertisement
peregrin5

Peregrin's Turbine Script

Aug 18th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. -- My Personal Big Reactors Temperature Control Script
  2.  
  3. local turbine = peripheral.wrap("BigReactors-Turbine_0")
  4. turbine.setActive(true)
  5.  
  6. -- Set Optimal RPM Speeds
  7. local optimalRPM = 1800
  8.  
  9. while turbine.getActive do
  10.   local flowRate = turbine.getFluidFlowRateMax()
  11.   local currentRPM = turbine.getRotorSpeed()
  12.   local highRPM = optimalRPM + 5
  13.   local lowRPM = optimalRPM - 5
  14.  
  15.   if currentRPM >= highRPM then
  16.     turbine.setFluidFlowMaxRate(flowRate - 1)
  17.   elseif currentRPM <= lowRPM and flowRate < 2000 then
  18.     turbine.setFluidFlowMaxRate(flowRate + 1)
  19.   end
  20.  
  21.   sleep(10)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement