Advertisement
Ubidibity

DraconicReactorMonitor

Jun 17th, 2021 (edited)
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- modified to work with draconic rf storage (trying to determine actual 'gain' from reactor)
  2. --local stabilizer = peripheral.wrap("right")
  3.  
  4. local storage = peripheral.find("draconic_rf_storage")
  5. local monitor = peripheral.wrap("bottom")
  6. local    core = peripheral.wrap("right")
  7.  
  8. term.redirect(monitor)
  9. local x=0
  10. local y=0
  11. local fieldStrengthPercent=0
  12. local lastFieldStrengthPercent
  13. local energySaturationPercent=0
  14. local lastEnergySaturationPercent=0 -- last energy saturation
  15. while true do
  16.  
  17. monitor.clear()
  18.  
  19. --for key,value in pairs(storage) do
  20. --print("key: "..key..", value: "..value)
  21. --end
  22.  
  23. --for _,method in pairs(storage) do
  24. y=x
  25. x=storage.getEnergyStored()
  26. --end
  27. local stab = core.getReactorInfo()
  28.  
  29. --for _, method in pairs(stabilizer) do
  30. --print(method)
  31. --end
  32. print("              status: "..stab.status)
  33. print("      generationRate: "..stab.generationRate.." RF/t")
  34. print("         temperature: "..stab.temperature)
  35. print("       fieldStrength: "..stab.fieldStrength)
  36. print("    maxFieldStrength: "..stab.maxFieldStrength)
  37. print("      fieldDrainRate: "..stab.fieldDrainRate)
  38. print("Fuel Conversion Rate: "..stab.fuelConversionRate.." nb/t")
  39. print("   maxFuelConversion: "..stab.maxFuelConversion)
  40. local fuelConversionPercent=stab.fuelConversion*100/stab.maxFuelConversion
  41. print("      fuelConversion: "..stab.fuelConversion.."("..fuelConversionPercent.."%)")
  42. lastEnergySaturationPercent=energySaturationPercent
  43. energySaturationPercent=stab.energySaturation*100/stab.maxEnergySaturation
  44. print("    energySaturation: "..stab.energySaturation.."("..energySaturationPercent.."%) "..energySaturationPercent-lastEnergySaturationPercent)
  45. print(" maxEnergySaturation: "..stab.maxEnergySaturation)
  46.  
  47. lastFieldStrengthPercent=fieldStrengthPercent
  48. fieldStrengthPercent=stab.fieldStrength*100/stab.maxFieldStrength
  49.  
  50. print(" Cont. fieldStrength: "..fieldStrengthPercent.."%".."("..fieldStrengthPercent-fieldStrengthPercent..")")
  51. print(" --- ")
  52. print(" Energy Core Storage: "..x)
  53. print("    Energy Core RF/t: "..((((x-y)/1000/1000)/2)*20).."MRF/t"..", "..(x*100/2140000000000).."%")
  54.  
  55. if (fieldStrengthPercent<51 or energySaturationPercent<51) then
  56. -- if it's < than some kill switch probably have it scram the reactor
  57.   redstone.setOutput("back", not redstone.getOutput("back"))
  58.   redstone.setOutput("top",false)
  59. end
  60. if (fieldStrengthPercent>51 and energySaturationPercent>51) then
  61.   redstone.setOutput("back",false)
  62.   redstone.setOutput("top",true) -- redstone.getOutput("top"))
  63. end
  64. sleep(2)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement