Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r1 = peripheral.wrap("BigReactors-Reactor_5")
- mon = peripheral.wrap("monitor_12")
- mon2 = peripheral.wrap("monitor_13")
- --Function For Power Bar
- POWER = function()
- while true do
- e = r1.getEnergyStored()
- p = math.floor(e / 10000000 * 100).."%"
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(2,10)
- mon.clearLine()
- mon.write(p)
- mon.setCursorPos(6,9)
- mon.setBackgroundColor(colors.red)
- mon.write(" ")
- mon.setCursorPos(6,10)
- mon.write(" ")
- mon.setCursorPos(6,11)
- mon.write(" ")
- mon.setBackgroundColors(colors.lime)
- if p < 10 then
- mon.
- mon.write
- mon.setBackgroundColor(colors.black)
- sleep(2)
- end
- end
- --Function For Reactor Control
- ONOFF = function()
- while true do
- if e >= 9500000 then
- r1.setActive(false)
- elseif e <= 1000000 then
- r1.setActive(true)
- end
- sleep(0)
- end
- end
- --Function For ReactorRod Control
- ROD = function()
- while true do
- if e >= 8000000 then
- r1.setAllControlRodLevels(90)
- elseif e <= 4000000 then
- r1.setAllControlRodLevels(0)
- end
- sleep(0)
- end
- end
- --Function For ReactorStats
- R1 = function()
- while true do
- mon.setCursorPos(1,1)
- mon.clearLine()
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- mon.write("REACTOR 1: ")
- if r1.getActive() then
- mon.setTextColor(colors.lime)
- mon.write("ONLINE")
- else
- mon.setTextColor(colors.red)
- mon.write("OFFLINE")
- end
- mon.setCursorPos(2,3)
- mon.clearLine()
- mon.setTextColor(colors.white)
- mon.write("RF/T: ")
- mon.setTextColor(colors.yellow)
- mon.write(math.floor(r1.getEnergyProducedLastTick()))
- mon.setCursorPos(2,4)
- mon.clearLine()
- mon.setTextColor(colors.white)
- mon.write("Total RF: ")
- mon.setTextColor(colors.yellow)
- mon.write(math.floor(r1.getEnergyStored()))
- mon.setCursorPos(2,5)
- mon.clearLine()
- mon.setTextColor(colors.white)
- mon.write("Fuel: ")
- mon.setTextColor(colors.yellow)
- mon.write(math.floor(r1.getFuelAmount()))
- sleep(2)
- end
- end
- --Function for TouchScreen
- button = function()
- while true do
- mon2.setBackgroundColor(colors.black)
- mon2.clear()
- mon2.setTextScale(1)
- mon2.setBackgroundColor(colors.green)
- mon2.setTextColor(colors.black)
- mon2.setCursorPos(2,2)
- mon2.write("Start")
- mon2.setBackgroundColor(colors.red)
- mon2.setCursorPos(2,4)
- mon2.write("Stop ")
- event, side, x, y = os.pullEvent("monitor_touch")
- if x > 1 and x < 7 and y == 2 then
- r1.setActive(true)
- elseif x > 1 and x < 7 and y == 4 then
- r1.setActive(false)
- end
- sleep(0)
- end
- end
- parallel.waitForAny (POWER, ONOFF, ROD, R1, button)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement