SHARE
TWEET

startup

a guest Jun 23rd, 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.   activebool = reactor.getActive()
  25.   RFpertbool = reactor.getEnergyProducedLastTick()
  26.   energybool = reactor.getEnergyStored()
  27.   fuelbool = reactor.getFuelAmount()
  28.   rodlevelbool = reactor.getControlRodLevel(1)
  29.  
  30.   stats:add(("Active: "..tostring(activebool)), nil, 1, 2, 15, 2, colors.black, colors.black)
  31.   stats:add(("RF/t: "..tostring(RFpertbool)), nil, 1, 3, 11, 3, colors.black, colors.black)
  32.   stats:add(("Energy In Reactor: "..tostring(energybool)), nil, 1, 4, 28, 4, colors.black, colors.black)
  33.   stats:add(("Fuel Remaining: "..tostring(fuelbool).."mb"), nil, 1, 5, 28, 5, colors.black, colors.black)
  34.   stats:add(("Rod Insertion: "..tostring(rodlevelbool).."%"), nil, 1, 6, 22, 6, colors.black, colors.black)
  35.  
  36. --End of statistics page, Start of Control page
  37. function reactoractive()
  38.   reactor.setActive(not reactor.getActive())
  39.  end
  40.  --Fuel Rod Control Functions
  41. function fuelrodup()
  42. local oldLabel = "Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"
  43.  reactor.setAllControlRodLevels(reactor.getControlRodLevel(1)+10)
  44.  control:rename(oldLabel, ("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"))
  45.  --control:flash("Rod Insertion: "..tostring(previouslevelu+10).."%")
  46. end
  47. function fuelroddown()
  48.  local oldLabel = "Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"
  49.  reactor.setAllControlRodLevels(reactor.getControlRodLevel(1)-10)
  50.  control:rename(oldLabel, "Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%")
  51. end
  52.  --Control Page Buttons
  53. control:add("Reactor Controls", nil, 1, 1, 29, 1, colors.blue, colors.blue)
  54. control:add("Reactor Statistics", statsscreen, 10, 12, 29, 12, colors.lime, colors.lime)
  55. control:add("Reactor On/Off", reactoractive, 1, 2, 20, 2, colors.red, colors.green)
  56. control:add(("Rod Insertion: "..tostring(reactor.getControlRodLevel(1)).."%"), nil, 1, 3, 20, 3, colors.black, colors.black)
  57. control:add("^", fuelrodup, 21, 3, 21, 3, colors.red, colors.lime)
  58. control:add("v", fuelroddown, 23, 3, 23, 3, colors.red, colors.lime)
  59. --Draw the screen
  60. statsscreen()
  61. while true do
  62.   activebool = reactor.getActive()
  63.   energybool = reactor.getEnergyStored()
  64.   RFpertbool = reactor.getEnergyProducedLastTick()
  65.   fuelbool = reactor.getFuelAmount
  66.   rodlevelbool = reactor.getControlRodLevel(1)
  67.   if reactor.getEnergyStored() > 9500000 then
  68.     reactor.setActive(false)
  69.   end
  70.   page:draw()
  71.   local event, p1 = page:handleEvents(os.pullEvent())
  72.   if event == "button_click" then
  73.     page.buttonList[p1].func()
  74.   end
  75. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top