Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local keyboard = require("keyboard")
- local term = require("term")
- local comp = require("comp")
- local gpu = component.gpu
- term.clear()
- print("Enter desired RPM for all turbines:")
- RPM = io.read()
- term.clear()
- print("Turbine program running. Hold LEFT CTRL to exit")
- local t = comp.getTurbines()
- local w,h = gpu.maxResolution()
- gpu.setResolution(w/2, h/2)
- while true do
- local totalEnergyOutput = 0
- gpu.fill(1, 1, 160, 50, " ")
- gpu.setForeground(0x00ff00)
- t = comp.getTurbines()
- comp.enableAllTurbines(t)
- local tableFlow = comp.turbinePID(RPM)
- local c = tableLength(t)
- for k,v in pairs(t) do
- comp.toTurbine(t, k).setFluidFlowRateMax(tableFlow[k])
- gpu.set(1, k, "Turbine "..k.." energy output: "..tostring(round(comp.toTurbine(t, k).getEnergyProducedLastTick(), 1)).." RF/t at "..tostring(round(comp.toTurbine(t, k).getRotorSpeed(), 0)).." RPM")
- totalEnergyOutput = totalEnergyOutput + comp.toTurbine(t, k).getEnergyProducedLastTick()
- end
- gpu.setForeground(0xff0000)
- gpu.set(1, c+2, "Total energy output: "..tostring(round(totalEnergyOutput, 1)).." RF/t")
- if keyboard.isControlDown() then comp.cleanUp() term.clear() gpu.setForeground(0xffffff) gpu.setResolution(w, h) os.exit() end
- os.sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement