-- Fission Reactor Controller -- Test script by ccraftersanonmoose ---------------------------------------- -- Version History -- Version 0.1 - 2/5/23 -- added buttons to activate and scram reactor -- Version 0.2 2/13/23 -- added monitoring of actual burn rate and temp -- adjusted temp to show absolute number in celsius -- would ike to add buttons to increment and decrement the burn rate -- version 0.2.1 2/16/23 -- added status monitoring -- added set burn rate monitoring -- trying to add buttons for burn rate ---------------------------------------- os.loadAPI("button") mon = peripheral.find("monitor") reactor = peripheral.find("fissionReactorLogicAdapter") mon.clear() function fillTable() button.setTable("Acivate", activateReactor, 10,20,3,5) button.setTable("SCRAM", scramReactor, 22,32,3,5) button.setTable("+", incrementBurnRate, 1,3,5,7) button.setTable("-", decrementBurnRate, 5,7,5,7) button.screen() end function getClick() event,side,x,y = os.pullEvent("monitor_touch") button.checkxy(x,y) end function activateReactor() button.flash("Activate") reactor.activate() end function scramReactor() button.flash("SCRAM") reactor.scram() end function incrementBurnRate() button.flash("+") reactor.setBurnRate(reactor.getBurnRate() + 1) end function decrementBurnRate() button.flash("+") reactor.setBurnRate(reactor.getBurnRate() - 1) end --function getInfo() --reactor.getActualBurnRate() --reactor.getCoolantFilledPercentage() --reactor.getFuelFilledPercentage() --reactor.getTemperature() --reactor.getStatus() --end function displayInfo() mon.setTextScale(1) if reactor.getStatus() == true then mon.setCursorPos(1,1) mon.write("Status:") mon.setCursorPos(1,2) mon.clearLine() mon.write("Active") else mon.setCursorPos(1,1) mon.write("Status:") mon.setCursorPos(1,2) mon.clearLine() mon.write("Disabled") end mon.setCursorPos(1,3) mon.write("Burn Rate") mon.setCursorPos(1,4) mon.write(reactor.getBurnRate()) mon.setCursorPos(1,8) mon.write("Current Burn Rate: ") mon.setCursorPos(1,10) mon.write(reactor.getActualBurnRate()) mon.setCursorPos(22,8) mon.write("Current Temp:") mon.setCursorPos(22,10) mon.write(math.floor(reactor.getTemperature() - 273.15), "C") end fillTable() button.heading("Reactor Controller") while true do displayInfo() getClick() end