SHARE
TWEET

startup

a guest Jun 16th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. peripheral.wrap("right").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.  --Fuel Rod Control Functions
  36. function fuelrodup()
  37.  reactor.setAllControlRodLevels(reactor.getControlRodLevel(1)+10)
  38. end
  39. function fuelroddown()
  40.  reactor.setAllControlRodLevels(reactor.getControlRodLevel(1)-10)
  41.  control:rename(("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"), ("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"))
  42. end
  43.  --Control Page Buttons
  44. control:add("Reactor Controls", nil, 1, 1, 29, 1, colors.blue, colors.blue)
  45. control:add("Reactor Statistics", statsscreen, 10, 12, 29, 12, colors.lime, colors.lime)
  46. control:add("Reactor On/Off", reactoractive, 1, 2, 20, 2, colors.red, colors.green)
  47. control:add(("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"), nil, 1, 3, 20, 3, colors.black, colors.black)
  48. control:add("^", fuelrodup, 21, 3, 21, 3, colors.red, colors.lime)
  49. control:add("v", fuelroddown, 22, 3, 22, 3, colors.red, colors.lime)
  50. --Draw the screen
  51. statsscreen()
  52. while true do
  53.   page:draw()
  54.   local event, p1 = page:handleEvents(os.pullEvent())
  55.   if event == "button_click" then
  56.     page.buttonList[p1].func()
  57.   end
  58. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top