Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = { ... }
- local this, reactor, settings, status
- local minHotFluidAmount, maxHotFluidAmount
- local function setup()
- if #args ~= 1 then
- error("reactor name not specified", 1)
- end
- this = args[1]
- reactor = peripheral.wrap(args[1])
- if reactor == nil then
- error("'" .. args[1] .. "' could not be found")
- end
- if _G.joja == nil or _G.joja.settings == nil or _G.joja.settings.reactor == nil or _G.joja.status == nil then
- error("Please start the main program first!")
- end
- settings = _G.joja.settings.reactor
- status = _G.joja["status"]
- minHotFluidAmount = (reactor.getHotFluidAmountMax()/100)*settings["minSteamPercent"]
- maxHotFluidAmount = (reactor.getHotFluidAmountMax()/100)*settings["maxSteamPercent"]
- end
- local function control()
- if not reactor.getActive() then
- reactor.setActive(true)
- end
- if reactor.getHotFluidAmount() < minHotFluidAmount and reactor.getCasingTemperature() < settings["maxCasingHeat"] then
- reactor.setAllControlRodLevels(settings["controlRodLevel"])
- status[this] = "on"
- elseif reactor.getHotFluidAmount() > maxHotFluidAmount or reactor.getCasingTemperature() > settings["maxCasingHeat"] then
- reactor.setAllControlRodLevels(100)
- status[this] = "off"
- end
- end
- setup()
- while true do
- control()
- sleep(.25)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement