Guest User

test

a guest
Jun 14th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. monitor = peripheral.wrap("monitor_25")
  2. t1 = peripheral.wrap("BigReactors-Turbine_18")
  3. r = peripheral.wrap("back")
  4.  
  5. local function mRefresh()
  6.   monitor.setBackgroundColor(colors.gray)
  7.   monitor.setTextColor(colors.lime)
  8.   monitor.setCursorPos(1,1)
  9.   monitor.setTextScale(2)
  10.   monitor.clear()
  11. end
  12.  
  13. local function drawMain() --Defines Main GUI
  14.  
  15.   --Main Heading
  16.   monitor.setCursorPos(1,1)
  17.   monitor.setBackgroundColor(colors.gray)
  18.   monitor.clear()
  19.   monitor.setTextScale(2)
  20.   monitor.setTextColor(colors.yellow)
  21.   monitor.write(" HD & IPJ's KickAss Reactor Control")
  22.   monitor.setCursorPos(1,2)
  23.   monitor.write("- - - - - - - - - - - - - - - - - - -")
  24.  
  25.   -- Windows  
  26.   -- ReactorWindow
  27.   local reactorWindow = window.create(monitor, 2, 3, 17, 7)              
  28.     reactorWindow.setBackgroundColor(colors.lightGray)
  29.     reactorWindow.setVisible(true)
  30.       --heading
  31.       monitor.setCursorPos(2,3)
  32.       monitor.setTextColor(colors.yellow)
  33.       monitor.setCursorPos(2,3)
  34.       monitor.write("Reactor")
  35.       monitor.setCursorPos(2,4)
  36.       monitor.write("- - - -")
  37. end
  38.  
  39. -- Reactor Functions                                        
  40. local function getSteam()
  41.   steam = r.getHotFluidProducedLastTick()
  42.   monitor.setCursorPos(2,5)
  43.   monitor.write("Steam: ")
  44.  
  45.  
  46.   if steam < 9500 then
  47.     monitor.setTextColor(colors.red)
  48.     monitor.write(steam)
  49.     monitor.setTextColor(colors.lime)
  50.   else
  51.     monitor.write(steam)
  52.   end
  53.  
  54.   monitor.write("mB/t")
  55.   os.sleep(1)
  56. end
  57.  
  58.  local function round(num, idp)
  59.   local mult = 10^(idp or 0)
  60.   return math.floor((num / 1782) * mult + 0.5 / mult)/10
  61.  end
  62.  
  63. local function getTurbineSpeed()
  64.   drawMain()
  65.   speed = t1.getRotorSpeed()
  66.  
  67.   monitor.setCursorPos(20,5)
  68.   monitor.write("Speed: ")
  69.   monitor.write(round(speed,3).."%")
  70.   getSteam()
  71. end
  72.  
  73. drawMain()
  74.  
  75. while true do
  76.   getTurbineSpeed()
  77. end
Advertisement
Add Comment
Please, Sign In to add comment