Advertisement
Guest User

startup

a guest
May 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.72 KB | None | 0 0
  1. local mon = peripheral.wrap("left")
  2. local rec = peripheral.wrap("bottom")
  3. local max = 80
  4. local standard = 44
  5.  
  6. -- DNT
  7. local Cap = max/100
  8. local softCap = (max-20)/100
  9.  
  10. function alert()
  11.     if Deut <= 500 or Trit <= 500 then
  12.         rec.setInjectionRate(2)
  13.         rs.setOutput("top", true)
  14.         term.setTextColor(colors.red)
  15.     else
  16.         rs.setOutput("top", false)
  17.     end
  18. end
  19.    
  20.  
  21. while true do
  22.  Trit = rec.getTritium()
  23.     Deut = rec.getDeuterium()
  24.     energy = rec.getEnergy()
  25.  energyMax = rec.getMaxEnergy()
  26.    
  27.    
  28.     mon.clear()
  29.     term.redirect(mon)
  30.     --term.setBackgroundColor(colors.black)
  31.     paintutils.drawBox(2,2,12,18,colors.gray)
  32.     term.setCursorPos(4,7)
  33.     local posX, posY = term.getCursorPos()
  34.        
  35. -- Fuel
  36.     term.setBackgroundColor(colors.black)
  37.     term.setTextColor(colors.white)
  38.     mon.setCursorPos(4,2)
  39.     write(" Fuel ")
  40.     local DeutF= 10-((Deut*100/1000)/10)
  41.     local TritF= 10-((Trit*100/1000)/10)
  42.     paintutils.drawFilledBox(4,4,6,16, colors.purple)
  43.     paintutils.drawFilledBox(4,4,6,4+DeutF, colors.red)
  44.     paintutils.drawFilledBox(8,4,10,16, colors.lightBlue)
  45.     paintutils.drawFilledBox(8,4,10,4+TritF, colors.red)
  46.     term.setBackgroundColor(colors.black)
  47. -- Fuel end
  48.    
  49. -- Energy Capacity
  50.     paintutils.drawBox(14,2,38,6, colors.gray)
  51.     term.setCursorPos(16,2)
  52.     term.setBackgroundColor(colors.black)
  53.     write(" Energy level ")
  54.     local EnergyF     = (energy*100/energyMax)/10
  55.     local energyRF    = math.floor(energy/2500,0.5)
  56.     local energyMaxRF = energyMax/2500
  57.     paintutils.drawFilledBox(16,4,36,4, colors.red)
  58.     paintutils.drawFilledBox(16,4,16+EnergyF*2,4, colors.lime)
  59.     term.setCursorPos(17,3)
  60.     term.setBackgroundColor(colors.black)
  61.     write(energyRF.."/"..energyMaxRF.." KRF")
  62.     term.setBackgroundColor(colors.black)
  63. -- Energy Capacity end
  64.  
  65. -- Info
  66. -- Production
  67.     paintutils.drawBox(14,8,38,13, colors.gray)
  68.     term.setCursorPos(16,8)
  69.     term.setBackgroundColor(colors.black)
  70.     write(" Info ")
  71.     term.setCursorPos(16,10)
  72.     write("Production: ")
  73.     local RFpT = (math.floor(rec.getProducing()/25000, 0.5))/10
  74.     if RFpT < 1 then
  75.         RFpT = (math.floor(rec.getProducing()/250, 0.5))/10
  76.         write(RFpT)
  77.         term.setTextColor(colors.orange)
  78.         term.setCursorPos(32,10)
  79.         write(" KRF/T")
  80.     else
  81.         write(RFpT)
  82.         term.setTextColor(colors.yellow)
  83.         term.setCursorPos(32,10)
  84.         write(" MRF/T")
  85.     end
  86. -- Production end
  87.  
  88. -- Injection Rate
  89.     term.setCursorPos(16,11)
  90.     term.setTextColor(colors.white)
  91.     write("InjectionRate: ")
  92. -- Injection Rate end
  93. -- Info end
  94.     paintutils.drawBox(14,15,38,18, colors.gray)
  95.     term.setCursorPos(16,15)
  96.     term.setBackgroundColor(colors.black)
  97.     write(" Injection Control ")
  98.     paintutils.drawBox(15,16,19,17, colors.green)
  99.     term.setCursorPos(16,17)
  100.     write("+10")
  101.     paintutils.drawBox(20,16,23,17, colors.lime)
  102.     term.setCursorPos(21,17)
  103.     write("+1")
  104.     paintutils.drawBox(25,16,27,17, colors.cyan)
  105.     term.setCursorPos(26,17)
  106.     write("2")
  107.     paintutils.drawBox(29,16,33,17, colors.orange)
  108.     term.setCursorPos(30,17)
  109.     write("-1")
  110.     paintutils.drawBox(33,16,37,17, colors.red)
  111.     term.setCursorPos(34,17)
  112.     write("-10")
  113.    
  114. -- Injection Hard Cap
  115.    
  116.     if energy >= energyMax*softCap then
  117.         if energy >= energyMax*Cap then
  118.             rec.setInjectionRate(2)
  119.             term.setTextColor(colors.orange)
  120.         end
  121.     else
  122.         term.setTextColor(colors.green)
  123.         rec.setInjectionRate(standard)
  124.     end
  125. -- Injection Hard Cap end
  126.  
  127.    
  128. term.setBackgroundColor(colors.black)  
  129. alert()        
  130. term.setCursorPos(31,11)
  131. write(rec.getInjectionRate())
  132. sleep(0.5)
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement