SHARE
TWEET

SteamEnergyManager

natie3 Nov 17th, 2019 (edited) 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modem = peripheral.wrap("left")
  2. top_energy_cell = peripheral.wrap("thermalexpansion:storage_cell_0")
  3. mfsu = peripheral.wrap("back")
  4.  
  5. rf_output = false
  6.  
  7. function euPercentage()
  8.   return math.floor(100 * (mfsu.getEUStored() or 0) / mfsu.getEUCapacity())
  9. end
  10.  
  11. function rfPercentage()
  12.   return math.floor(100 * (top_energy_cell.getEnergyStored() or 0) / top_energy_cell.getRFCapacity())
  13. end
  14.  
  15. function set(value)
  16.   print(value)
  17.   rf_output = value
  18.   rs.setOutput("right", rf_output)
  19. end
  20.  
  21. set(false)
  22.  
  23. while true do
  24.   euP = euPercentage()
  25.   rfP = rfPercentage()
  26.   if euP < 50 and rf_output then
  27.     set(false)
  28.   elseif euP == 100 and (not rf_output) then
  29.     set(true)
  30.   end
  31.   modem.transmit(3,4,"" .. rfP)
  32.  
  33.   os.sleep(10)
  34. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top