Advertisement
Guest User

startup

a guest
Jun 17th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. -- modified to work with draconic rf storage (trying to determine actual 'gain' from reactor)
  2.  
  3. --local stabilizer = peripheral.wrap("right")
  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 cf=0
  12. local lcf=0 -- last containment field strength
  13. local es=0
  14. local les=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. local energySaturationPercent=stab.energySaturation*100/stab.maxEnergySaturation
  43. print("    energySaturation: "..stab.energySaturation.."("..energySaturationPercent.."%)")
  44. print(" maxEnergySaturation: "..stab.maxEnergySaturation)
  45. local fieldStrengthPercent=stab.fieldStrength*100/stab.maxFieldStrength
  46. print(" Cont. fieldStrength: "..fieldStrengthPercent.."%")
  47. print(" --- ")
  48. print(" Energy Core Storage: "..x)
  49. print("    Energy Core RF/t: "..((((x-y)/1000/1000)/2)*20).."MRF/t"..", "..(x*100/2140000000000).."%")
  50.  
  51. if (fieldStrengthPercent<51 or energySaturationPercent<51) then
  52. -- if it's < than some kill switch probably have it scram the reactor
  53.   redstone.setOutput("back", not redstone.getOutput("back"))
  54.   redstone.setOutput("top",false)
  55. end
  56. if (fieldStrengthPercent>51 and energySaturationPercent>51) then
  57.   redstone.setOutput("back",false)
  58.   redstone.setOutput("top",true) -- redstone.getOutput("top"))
  59. end
  60. sleep(2)
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement