Skip to content

Instantly share code, notes, and snippets.

@bookerthegeek
Last active March 19, 2023 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bookerthegeek/5a3a83bd5623ff9a2ef04cfdf4c2a0bf to your computer and use it in GitHub Desktop.
Save bookerthegeek/5a3a83bd5623ff9a2ef04cfdf4c2a0bf to your computer and use it in GitHub Desktop.
Big Reactor Minimalist ComputerCraft Control Program
-- 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