Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------
- -- Big Reactor Power Management --
- -- --
- -- Minecraft FTB Infinity Evolved Episode 50 --
- -- https://www.youtube.com/watch?v=BT5e9N3vHVU --
- -- --
- -- YouTube Channel http://youtube.com/hypnotizd --
- ----------------------------------------------------------
- local reactor = peripheral.wrap("back")
- local stored = 0
- local prevStored = 0
- local lastTick = 0
- local status = "Discharging"
- local function setLastTick()
- lastTick = reactor.getEnergyProducedLastTick()
- end
- local function setStored()
- stored = reactor.getEnergyStored()
- end
- local function checkPower()
- setStored()
- setLastTick()
- if (stored > 8000000) then
- reactor.setAllControlRodLevels(100)
- status = "Discharging"
- elseif (stored <= 2000000) then
- reactor.setAllControlRodLevels(0)
- status = "Charging"
- end
- end
- local function displayStatus()
- local pct = stored/10000000
- term.clear()
- term.setCursorPos(1,1)
- local usage = (stored - prevStored)/20
- print(" Current Energy: "..math.floor(stored))
- print("Energy Produced: "..math.floor(lastTick).." RF/t")
- print(" Usage: "..math.floor(usage).." RF/t")
- print(" Status: "..status)
- end
- while true do
- checkPower()
- displayStatus()
- prevStored = stored
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement