Advertisement
Guest User

[CC] Draco Core

a guest
Jul 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. --Programm by Sinistre_Vince
  2.  
  3. --LAN-Verbindung
  4. local kern = peripheral.wrap('draconic_rf_storage_3')
  5. local mon = peripheral.wrap('monitor_231')
  6.  
  7. --Energie/ticks
  8. local prevEnergie = 0
  9. local refreshrate = 1
  10.  
  11. --Energieueberwachung
  12. while true do
  13.    
  14.     --Tageszeit
  15.     local time = os.time()
  16.     local formatTime = textutils.formatTime(time, true)
  17.    
  18.     --Draconic Kern
  19.     energie = kern.getEnergyStored()
  20.     energieMax = kern. getMaxEnergyStored()
  21.    
  22.     local energieG = energie / 1000000000
  23.     local energieGMaxG = energieMax / 1000000000
  24.    
  25.     --Energieverbauch
  26.     verbrauch = (energie - prevEnergie) / (refreshrate * 20)
  27.     diff = math.floor(verbrauch * 100) / 100
  28.    
  29.     local prozent = math.floor(energie / energieMax * 100)
  30.    
  31.     function rfT()
  32.         mon.write(diff)
  33.         mon.setCursorPos(10,8)
  34.         mon.write('RF/t')
  35.     end
  36.    
  37.     --Monitor
  38.     mon.clear()
  39.     mon.setTextScale(1)
  40.     mon.setCursorPos(5,1)
  41.     mon.setTextColor(colors.purple)
  42.     mon.write('Draconium Energiekern')
  43.    
  44.     mon.setTextColor(colors.white)
  45.     mon.setCursorPos(1,3)
  46.     mon.write('RF-Speicher')
  47.    
  48.     mon.setCursorPos(1,4)
  49.     mon.write('max. '..energieGMaxG..'   Bio. RF')
  50.     mon.setCursorPos(22,4)
  51.     mon.write('100%')
  52.    
  53.     mon.setCursorPos(6,5)
  54.     mon.write(energieG)
  55.     mon.setCursorPos(12,5)
  56.     mon.write(' Bio. RF')
  57.     mon.setCursorPos(22,5)
  58.     mon.write(prozent..'%')
  59.    
  60.     mon.setCursorPos(1,7)
  61.     mon.write('In- /Output')
  62.     mon.setCursorPos(22,7)
  63.     mon.write('Uhrzeit')
  64.    
  65.     mon.setCursorPos(1,8)
  66.     if diff < 0 then
  67.         mon.setTextColor(colors.red)
  68.         rfT()
  69.     end
  70.    
  71.     if diff == 0 then
  72.         mon.setTextColor(colors.yellow)
  73.         rfT()
  74.     end
  75.    
  76.     if diff > 0 then
  77.         mon.setTextColor(colors.green)
  78.         mon.write('+'..diff)
  79.         mon.setCursorPos(10,8)
  80.         mon.write('RF/t')
  81.     end
  82.    
  83.     mon.setTextColor(colors.white)
  84.     mon.setCursorPos(22,8)
  85.     mon.write(formatTime)
  86.    
  87.     prevEnergie = energie
  88.    
  89.     sleep(refreshrate)
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement