-- -- Control passive cooled Big Reactor (http://big-reactors.com/). -- -- Calculate the control rod level (in %) by stored energy of internal -- recator cell. -- -- Parameters: -- rodLvl - Level of control rods in % -- cellEnergy - stored energy of internal energy cell in RF -- -- Find the first connected big reactor and return the wrapped handle. -- If no reactor was found loop the program. -- Return: -- Handle of first connected reactor found. -- print("10 seconds to begin..") os.sleep(10) -- Delay Script untill Reactor is detected function getReactorHandle() local pList = peripheral.getNames() local i, name for i, name in pairs(pList) do if peripheral.getType(name) == "BigReactors-Reactor" then return peripheral.wrap(name) end end return false end while not getReactorHandle() do print("Not connected: Wait for 5s") print("Hold CTRL-T to Terminate") os.sleep(5) -- Wait for 5s end reactor = getReactorHandle() -- Endless loop: Recalculate rod level, set rod level -- and wait for 5 secounds. while 1 do while reactor.getActive() do cellEnergy = reactor.getEnergyStored() rodLvl=(math.floor(cellEnergy/100000)) reactor.setAllControlRodLevels(rodLvl) print(100 - rodLvl,"%") os.sleep(5) -- Wait for 5s end print("Reactor Paused : Please Reset") os.sleep(5) -- Wait for 5s end -- -- EOF --