Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- monitor = peripheral.wrap("bottom")
- monitor.clear()
- reactor = peripheral.wrap("BigReactors-Reactor_4")
- turbine = peripheral.wrap("BigReactors-Turbine_3")
- reactor.setActive(false)
- turbine.setActive(false)
- function fillTable()
- button.setTable("Turbine", toggleTurbine, 8, 16, 3, 5)
- button.setTable("Reactor", toggleReactor, 24, 32, 3, 5)
- button.setTable("+", increaseSteam, 8, 12, 6, 8)
- button.setTable("-", decreaseSteam, 12, 16, 6, 8)
- button.screen()
- end
- function toggleReactor()
- button.toggleButton("Reactor")
- reactor.setActive(not reactor.getActive())
- end
- function toggleTurbine()
- button.toggleButton("Turbine")
- turbine.setActive(not turbine.getActive())
- end
- function increaseSteam()
- if turbine.getFluidFlowRateMax() <= 1990 then
- turbine.setFluidFlowRateMax(turbine.getFluidFlowRateMax() + 10)
- button.flash("+")
- end
- end
- function decreaseSteam()
- if turbine.getFluidFlowRateMax() >= 10 then
- turbine.setFluidFlowRateMax(turbine.getFluidFlowRateMax() - 10)
- button.flash("-")
- end
- end
- function getClick()
- event, side, x, y = os.pullEvent("monitor_touch")
- button.checkxy(x, y)
- end
- function dataReadout()
- monitor.setCursorPos(8,10)
- monitor.write("Rotor Speed:")
- monitor.setCursorPos(8,11)
- monitor.write(turbine.getRotorSpeed())
- monitor.setCursorPos(8,12)
- monitor.write("Fluid Flow Rate Max:")
- monitor.setCursorPos(8,13)
- monitor.write(turbine.getFluidFlowRateMax())
- end
- function manual()
- local timer=os.startTimer(1)
- while true do
- timer=os.startTimer(1)
- local event, par1, par2, par3 = os.pullEvent()
- if event=="timer" then
- dataReadout()
- elseif event=="monitor_touch" then
- button.checkxy(par2, par3)
- end
- end
- end
- fillTable()
- button.heading("Reactor and Turbine Control")
- manual()
Advertisement
Add Comment
Please, Sign In to add comment