Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BigReactor active cooled fuel rod controller
- -- By BookerTheGeek
- -- Variables
- local reactor = peripheral.wrap("back")
- local run = true
- local maxSteam = "50000"
- local createdSteam = "0"
- local connectedTurbines = "4"
- local goalSteamCreationmin = "0"
- local goalSteamCreationMax = "0"
- local steamTurbineNeed = "2000"
- local controlRodLevel = "0"
- -- The Goods
- while run == true do
- -- Turn Reactor On if Off
- if reactor.getActive() ~= "true" then
- reactor.setActive(true)
- end
- -- How much Steam do we need per Tick
- goalSteamCreationMin = (connectedTurbines * steamTurbineNeed) * 1.0
- goalSteamCreationMax = (connectedTurbines * steamTurbineNeed) * 1.1
- -- How much steam are we producing
- createdSteam = reactor.getHotFluidProducedLastTick()
- -- Are we making steam?
- if createdSteam == 0 then reactor.setAllControlRodLevels(0) end
- -- Increase steam production
- if createdSteam <= goalSteamCreationMin then
- controlRodLevel = controlRodLevel - 1
- if controlRodLevel <= 0 then controlRodLevel = 0 end
- reactor.setAllControlRodLevels(controlRodLevel)
- end
- -- Decrease steam production
- if createdSteam >= goalSteamCreationMax then
- controlRodLevel = controlRodLevel + 1
- if controlRodLevel >= 100 then controlRodLevel = 100 end
- reactor.setAllControlRodLevels(controlRodLevel)
- end
- -- Output Information
- term.clear()
- term.setCursorPos(1,1)
- print("Steam Produced:", createdSteam, "mb/t" )
- print("Rod Level: ", controlRodLevel)
- -- Wait to run again
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement