Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ****************************************************** --
- -- ****************************************************** --
- -- ** - MineNet ControlPanel - ** --
- -- ** Version: 0.1 ** --
- -- ** ** --
- -- ** Written by JustinVDM ** --
- -- ** ** --
- -- ****************************************************** --
- -- ****************************************************** --
- -- ************ Some info about this program ************ --
- -- ** ** --
- -- ** For this program to work you will need ** --
- -- ** You will need TouchPoint API Written by: Lyqyd ** --
- -- ** ** --
- -- ** This program is still a work in progress! ** --
- -- ** ** --
- -- ****************************************************** --
- --Loads API
- os.loadAPI("touch")
- --Calls The reactor
- local reactor = peripheral.wrap("BigReactors-Reactor_0")
- --Defines the pages
- local page1 = touch.new("top")
- local page2 = touch.new("top")
- local page3 = touch.new("top")
- local page4 = touch.new("top")
- --Variable that stores the pages
- local t
- --Reactor variables
- local maxPower = 0
- local powerStored = reactor.getEnergyStored
- local fuelStored = reactor.getFuelAmount
- local temp = reactor.getTemperature
- --Just some function that wil allow switching between pages
- function mainMenu()
- t = page1
- t:draw()
- end
- function infoMenu()
- t = page2
- t:draw()
- end
- function reactorControls()
- t = page3
- t:draw()
- end
- function infoReactor()
- t = page4
- t:draw()
- end
- --Function that wil turn reactor on and off
- function toggleReactor()
- if reactor.getActive == true then
- page3:toggleButton("Turn On/Off")
- else reactor.setActive = true
- end
- end
- --This function allows the lights to be turned on
- function lightB()
- page1:toggleButton("Lights")
- rs.setOutput("right", not rs.getOutput("right"))
- end
- function callButton(name)
- if t.buttonList[name].func ~= nil then
- t.buttonList[name].func()
- end
- end
- --Adds the buttons
- do
- page1:add("Main Menu", nil, 7,1,23,5, colors.black, colors.black)
- page1:add("Lights", lightB, 7,6,24,8)
- page1:add("Reactor Controls", reactorControls, 7,10,24,12)
- page1:add("Info", infoMenu, 7,14,24,16)
- page2:add("Info Menu", nil, 7,1,24,5, colors.black, colors.black)
- page2:add("Reactor Info", infoReactor, 7,6,24,8)
- page2:add("Back", mainMenu, 7,10,24,12)
- page3:add("Reactor Controls", nil, 7,1,24,5, colors.black, colors.black)
- page3:add("Turn On/Off", toggleReactor, 7,6,24,8)
- page3:add("Back", mainMenu, 7,10,24,12)
- end
- mainMenu()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- callButton(p1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement