Advertisement
Guest User

startup

a guest
Aug 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. --Sly's reactor--
  2.  
  3. --peripherals
  4. local m = {27,28,26}
  5. local monitors = {}
  6. for i=1,3 do
  7.     monitors[i] = peripheral.wrap("monitor_"..m[i])
  8. end
  9.  
  10. local t = {6,3,7,9,4,2,5,8}
  11. local turbines = {}
  12. for i=1,8 do
  13.     turbines[i] = peripheral.wrap("BigReactors-Turbine_"..t[i])
  14. end
  15.  
  16. function drawGauge(i,m,pos)
  17.     local tur = turbines[i]
  18.     local mon = monitors[m]
  19.     local RPM = tur.getRotorSpeed()
  20.     local energyLastTick = tur.getEnergyProducedLastTick()
  21.     local flowRate = tur.getFluidFlowRate()
  22.     local coils = tur.getInductorEngaged()
  23.    
  24.     local RPMp = math.ceil(((RPM/2000) * 30) - 0.5)
  25.     for y = 0,31 do
  26.   mon.setCursorPos(10,36-y)
  27.   mon.setBackgroundColor(colors.white)
  28.   mon.write(" ")
  29.   if y==0 or y == 31 or y<=RPMp then
  30.         mon.setBackgroundColor(colors.white)
  31.   else
  32.     mon.setBackgroundColor(Cols[c[y]])
  33.   end
  34.      mon.write(string.rep(" ",8))
  35.   mon.setBackgroundColor(colors.white)
  36.   mon.write(" ")
  37.   mon.setBackgroundColor(colors.black)
  38.  
  39.    
  40.  
  41.     end
  42.    
  43. end
  44.  
  45. while true do
  46.  monitors[1].setBackgroundColor(colors.black)
  47.  monitors[1].clear()
  48.     drawGauge(5,1,{1,1})
  49.  sleep(0.5)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement