Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fuel_power = 504
- local fuel_heatgen = 75
- local reactor_heatmultiplier = 6.34
- local reactor_coolingrate = 2400
- local reactor_heatmaxlevel = 900000
- local reactor_currenttemperature = 0
- local reactor_active = 1
- local heat_count = fuel_heatgen * reactor_heatmultiplier - reactor_coolingrate
- if heat_count < 0 then
- heat_count = 0
- end
- power_cube = peripheral.wrap("top")
- local power = power_cube.getEnergy() * 4
- local Max_power = power_cube.getMaxEnergy() * 4
- local function power_status()
- if power < 1000000 then
- reactor_active = 1
- else if power > 45000000 then
- reactor_active = 0
- end
- end
- return reactor_active
- end
- local function heat_status()
- if reactor_heatmaxlevel/2 < reactor_currenttemperature then
- reactor_active = 0
- else
- reactor_active = 1
- end
- return reactor_active
- end
- local function nuclear_control()
- while true do
- if power_status()+heat_status() = 0 then
- redstone.setOutput("right", true)
- else
- redstone.setOutput("right", false)
- if heat_status() > 0 then
- sleep(reactor_currenttemperature/reactor_coolingrate + 1)
- reactor_currenttemperature = 0
- else
- while power_status() > 0 do
- sleep(10)
- end
- end
- end
- reactor_currenttemperature = reactor_currenttemperature + heat_count * 100
- sleep(5)
- print("Power: "..string.sub(power/1000000,0,4).." MRF || Temperature: "..reactor_currenttemperature.." C*")
- return nil
- end
- nuclear_control()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement