View difference between Paste ID: WGFPF0F0 and ZtQPTFYC
SHOW: | | - or go back to the newest paste.
1
local reactor = peripheral.wrap("back")
2
local maxEnergy = 10000000.0
3
local temperatureThreshold = 750
4-
local lowerThreshold = 25.0
4+
5-
local upperThreshold = 90.0
5+
6
  return 100.0 * reactor.getEnergyStored() / maxEnergy
7-
local temperatureThreshold = 700
7+
8
9
function activate()
10
  reactor.setActive(true)
11
end
12
13-
function powerState()
13+
14-
  if computePercent() < lowerThreshold then
14+
15-
    return -1
15+
16-
  elseif computePercent() < upperThreshold then
16+
17-
    return 0
17+
18-
  else
18+
19-
    return 1
19+
while computePercent() < 90.0 do
20
  if reactor.getTemperature() > temperatureThreshold and reactor.getActive() then
21
    print(" ------------- [" .. reactor.getTemperature() .. " C, " .. computePercent() .. "%]")
22
    deactivate()
23
  elseif reactor.getTemperature() < temperatureThreshold - 40 and not reactor.getActive() then
24-
  print("Powering up reactor [" .. computePercent() .. "%] (" .. reactor.getTemperature() .. " C)")
24+
    print(" +++++++++++++ [" .. reactor.getTemperature() .. " C, " .. computePercent() .. "%]")
25
    activate()
26
  end
27
  sleep(0.15)
28
end