View difference between Paste ID: zWrYnwtW and gK798MXT
SHOW: | | - or go back to the newest paste.
1
----------------------------------------------------------
2-
-- Big Reactor Power Management                         --
2+
-- Extreme Reactor Power Management                         --         --
3-
--                                                      --
3+
4-
-- Minecraft FTB Infinity Evolved Episode 50            --
4+
5-
-- https://www.youtube.com/watch?v=BT5e9N3vHVU          --
5+
6-
--                                                      --
6+
7-
-- YouTube Channel http://youtube.com/hypnotizd         --
7+
8
local lastTick = 0
9
local status = "Discharging"
10
11
local function setLastTick()
12
  lastTick = reactor.getEnergyProducedLastTick()
13
end
14
15
local function setStored()
16
  stored = reactor.getEnergyStored()
17
end
18
19
local function checkPower()
20
  setStored()
21
  setLastTick()
22
23
  if (stored > 8000000) then
24
    reactor.setAllControlRodLevels(100)
25
    status = "Discharging"
26
  elseif (stored <= 2000000) then
27
    reactor.setAllControlRodLevels(0)
28
    status = "Charging"
29
  end
30
end
31
32
local function displayStatus()
33
  local pct = stored/10000000
34
  term.clear()
35
  term.setCursorPos(1,1)
36
  local usage = (stored - prevStored)/20
37
38
  print(" Current Energy: "..math.floor(stored))
39
  print("Energy Produced: "..math.floor(lastTick).." RF/t")
40
  print("          Usage: "..math.floor(usage).." RF/t")
41
  print("         Status: "..status)
42
end
43
44
while true do
45
  checkPower()
46
  displayStatus()
47
  prevStored = stored
48
  os.sleep(1)
49
end