Last active
March 19, 2023 06:00
-
-
Save bookerthegeek/5a3a83bd5623ff9a2ef04cfdf4c2a0bf to your computer and use it in GitHub Desktop.
Big Reactor Minimalist ComputerCraft Control Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- BigReactor passive cooled fuel rod controller | |
-- By BookerTheGeek | |
-- Variables | |
local reactor = peripheral.wrap("back") | |
local run = true | |
local maxEnergy = "10000000" | |
-- The Goods | |
while run == true do | |
-- Turn Reactor On if Off | |
if reactor.getActive() ~= "true" then reactor.setActive(true) end | |
-- Figure out Energy stored as a % | |
storedEnergy = reactor.getEnergyStored() | |
percentFull = math.ceil(((storedEnergy / maxEnergy)*100)+10) | |
if percentFull >= 100 then percentFull = 100 end | |
-- Account for Cooldown | |
if percentFull >= 100 then percentFull = 100 end | |
-- Control the Control Rods | |
reactor.setAllControlRodLevels(percentFull) | |
-- Output Information | |
term.clear() | |
term.setCursorPos(1,1) | |
print("RF:", storedEnergy ) | |
print("Rod % ", percentFull) | |
-- Wait to run again | |
sleep(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment