subzero22

computercraft Big Reactor program

Mar 1st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("monitor_0")
  2. pr = peripheral.wrap("back")
  3. mon.setTextColor(colors.white)
  4.  
  5. if pr.getConnected() == false then
  6.   term.clear()
  7.   term.setCursorPos(8,5)
  8.   print("Sorry but this computer couldn")
  9.   term.setCursorPos(8,6)
  10.   print("connect to the reactor.")
  11. else
  12.  
  13. while true do
  14.   term.clear()
  15.   mon.clear()
  16.   term.setCursorPos(1,1)
  17.   mon.setCursorPos(1,1)
  18.    if pr.getActive() == true then
  19.      onoff = "ON"
  20.    else
  21.      onoff = "OFF"
  22.    end
  23.  
  24.   print("Reactor Status: "..onoff)
  25.   mon.write("Reactor Status: "..onoff)
  26.   st = pr.getEnergyStored()
  27.  
  28.   term.setCursorPos(14,10)
  29.   mon.setCursorPos(10,9)
  30.   print("RF Stored: ".. st)
  31.   mon.write("RF Stored: "..st)
  32.  
  33.    if st <= 1000000 then
  34.      pr.setActive(true)
  35.    elseif st >= 9950000 then
  36.      pr.setActive(false)
  37.    end  
  38.  
  39.   tc = pr.getCasingTemperature()
  40.   term.setCursorPos(25,1)
  41.   mon.setCursorPos(1,4)
  42.   print("Casing Temp: ".. tc)
  43.   mon.write("Casing Temp: "..tc)
  44.  
  45.   tf = pr.getFuelTemperature()
  46.   term.setCursorPos(25,2)
  47.   mon.setCursorPos(1,5)
  48.   print("Fuel Temp: ".. tf)
  49.   mon.write("Fuel Temp: "..tf)
  50.  
  51.   fa = pr.getFuelAmount()
  52.   fm = pr.getFuelAmountMax()
  53.   term.setCursorPos(1,2)
  54.   mon.setCursorPos(1,2)
  55.   print("Fuel lvl: ".. fa .."/".. fm)
  56.   mon.write("Fuel lvl: "..fa.."/"..fm)
  57.   gr = pr.getEnergyProducedLastTick()
  58.    if gr == 0 then
  59.    else
  60.     term.setCursorPos(10,13)
  61.     mon.setCursorPos(6,11)
  62.     print("Generating ".. gr .." RF/Tick")
  63.     mon.write("Generating "..gr.." RF/TICK")
  64.    end
  65.  
  66.   ra = pr.getFuelReactivity()
  67.   term.setCursorPos(25,3)
  68.   print("Reactive Lvl: ".. ra .."%")  
  69.   mon.setCursorPos(1,6)
  70.   mon.write("Reactive Lvl: ".. ra .."%")
  71.   sleep(1)
  72. end
  73. end
Add Comment
Please, Sign In to add comment