Advertisement
dvarik

Untitled

Jan 23rd, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. local fuel_power = 504
  2. local fuel_heatgen = 75
  3. local reactor_heatmultiplier = 6.34
  4. local reactor_coolingrate = 2400
  5. local reactor_heatmaxlevel = 900000
  6. local reactor_currenttemperature = 0
  7. local reactor_active = 1
  8. local heat_count = fuel_heatgen * reactor_heatmultiplier - reactor_coolingrate
  9. if heat_count < 0 then
  10. heat_count = 0
  11. end
  12.  
  13. power_cube = peripheral.wrap("top")
  14. local power = power_cube.getEnergy() * 4
  15. local Max_power = power_cube.getMaxEnergy() * 4
  16.  
  17. local function power_status()
  18. if power < 1000000 then
  19. reactor_active = 1
  20. else if power > 45000000 then
  21. reactor_active = 0
  22. end
  23. end
  24. return reactor_active
  25. end
  26.  
  27. local function heat_status()
  28. if reactor_heatmaxlevel/2 < reactor_currenttemperature then
  29. reactor_active = 0
  30. else
  31. reactor_active = 1
  32. end
  33. return reactor_active
  34. end
  35.  
  36. local function nuclear_control()
  37. while true do
  38. if power_status()+heat_status() = 0 then
  39. redstone.setOutput("right", true)
  40. else
  41. redstone.setOutput("right", false)
  42. if heat_status() > 0 then
  43. sleep(reactor_currenttemperature/reactor_coolingrate + 1)
  44. reactor_currenttemperature = 0
  45. else
  46. while power_status() > 0 do
  47. sleep(10)
  48. end
  49. end
  50. end
  51.  
  52. reactor_currenttemperature = reactor_currenttemperature + heat_count * 100
  53. sleep(5)
  54.  
  55. print("Power: "..string.sub(power/1000000,0,4).." MRF || Temperature: "..reactor_currenttemperature.." C*")
  56.  
  57. return nil
  58. end
  59.  
  60. nuclear_control()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement