Advertisement
Guest User

startup

a guest
Jun 16th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. --Setup
  2. local mon = peripheral.wrap("monitor_0")
  3. local reactor = peripheral.wrap("BigReactors-Reactor_0")
  4. os.loadAPI("touchpoint")
  5. local stats = touchpoint.new("monitor_0")
  6. local control = touchpoint.new("monitor_0")
  7. local page
  8. mon.clear()
  9.  
  10. --Heading 1st Page
  11. stats:add("Reactor Statistics", nil, 1, 1, 29, 1, colors.blue, colors.blue)
  12.  
  13. --button setup
  14. function controlscreen()
  15.   page = control
  16. end
  17. function statsscreen()
  18.  page = stats
  19. end
  20.  
  21. stats:add("Reactor Controls", controlscreen, 12, 12, 29, 12, colors.lime, colors.lime)
  22.  
  23. --Reactor Statistics
  24.  
  25.   stats:add(("Active: "..tostring(reactor.getActive())), nil, 1, 2, 15, 2, colors.black, colors.black)
  26.   stats:add(("RF/t: "..tostring(reactor.getEnergyProducedLastTick())), nil, 1, 3, 11, 3, colors.black, colors.black)
  27.   stats:add(("Energy In Reactor: "..tostring(reactor.getEnergyStored())), nil, 1, 4, 28, 4, colors.black, colors.black)
  28.   stats:add(("Fuel Remaining: "..tostring(reactor.getFuelAmount()).."mb"), nil, 1, 5, 28, 5, colors.black, colors.black)
  29.   stats:add(("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"), nil, 1, 6, 22, 6, colors.black, colors.black)
  30.  
  31. --End of statistics page, Start of Control page
  32. function reactoractive()
  33.   reactor.setActive(not reactor.getActive())
  34.  end
  35. control:add("Reactor Controls", nil, 1, 1, 29, 1, colors.blue, colors.blue)
  36. control:add("Reactor Statistics", statsscreen, 10, 12, 29, 12, colors.lime, colors.lime)
  37. control:add("Reactor On/Off", reactoractive, 1, 2, 1, 2, colors.red, colors.green)
  38. control:add(("Control Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"), nil, 1, 3, 20, 3, colors.black, colors.black)
  39. --Draw the screen
  40. statsscreen()
  41. while true do
  42.   page:draw()
  43.   local event, p1 = page:handleEvents(os.pullEvent())
  44.   if event == "button_click" then
  45.     page.buttonList[p1].func()
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement