Advertisement
Guest User

start

a guest
Sep 21st, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.85 KB | None | 0 0
  1. mon = peripheral.wrap("monitor_6")
  2. tank = peripheral.wrap("rcsteeltankvalvetile_2")
  3. ECell = peripheral.wrap("cofh_thermalexpansion_energycell_1")
  4. AESystem = peripheral.wrap("appeng_me_tilecontroller_0")
  5.  
  6. zbiornik = false
  7. system = false
  8. energyc = false
  9. lava = false
  10.  
  11. function systems()
  12.     while system do
  13.       drukkolorowy(AESystem.getStoredItemTypes()-1 .. " ", 24, 5, 32)
  14.       drukkolorowy(AESystem.getUnusedBytes() .. " ", 24, 9, 32)
  15.       drukkolorowy(AESystem.getStoredItemCount() .. " ", 24, 11, 32)
  16.       break
  17.     end
  18.     while energyc do
  19.       mon.setBackgroundColor(colors.black)
  20.       drukkolorowy(ECell.getMaxEnergyStored("all")*100/100 .. " ", 24, 3, 32)
  21.       drukkolorowy(ECell.getEnergyStored("all")*100/100 .. " ", 24, 5, 32)
  22.       break
  23.     end
  24.     while lava do
  25.       drukkolorowy(tankinf[1]["amount"]/1000 .. " ", 16, 5, 32)
  26.       drukkolorowy(tankinf[1]["capacity"]/1000 .. " B", 16, 7, 32)
  27.       break
  28.     end
  29. end
  30.  
  31. function aesystem()
  32.   mon.clear()
  33.   menu(0, 2)
  34.   menu(0, 4)
  35.   menu(0, 6)
  36.   menu(0, 8)
  37.   menu(0, 10)
  38.   menu(0, 12)
  39.   menu(22, 0)
  40.   drukkolorowy("TOTAL ITEM TYPES", 3, 3, 8)
  41.   drukkolorowy("STORED ITEM TYPES", 3, 5, 8)
  42.   drukkolorowy("TOTAL BYTES", 3, 7, 8)
  43.   drukkolorowy("USED BYTES", 3, 9, 8)
  44.   drukkolorowy("STORED ITEM COUNT", 3, 11, 8)
  45.   powrot = true
  46.   system = true
  47.   wroc()
  48.   drukkolorowy(AESystem.getTotalBytes() .. " ", 24, 7, 32)
  49.   drukkolorowy(AESystem.getTotalItemTypes() .. " ", 24, 3, 32)
  50. end
  51.  
  52. function energys()
  53.   mon.clear()
  54.   drukkolorowy("MAX ENERGY STORED", 3, 3, 8)
  55.   drukkolorowy("ENERGY STORED", 3, 5, 8)
  56.   menu(0, 4)
  57.   menu(0, 6)
  58.   menu(0, 2)
  59.   menu(22, 0)
  60.   wroc()
  61.   powrot = true
  62.   energyc = true
  63.   drukkolorowy("RF", 34, 3, 32)
  64.   drukkolorowy("RF", 34, 5, 32)
  65. end
  66.  
  67. function wroc()
  68.   term.redirect(mon)
  69.   local back = window.create(term.current(), 1, 25, 13, 3)
  70.   back.setBackgroundColor(1)
  71.   back.setTextColor(colors.black)
  72.   back.clear()
  73.   mon.setCursorPos(5, 26.5)
  74.   mon.write("back")
  75.   mon.setBackgroundColor(colors.black)
  76. end
  77.  
  78. function tanks()
  79.   mon.clear()
  80.   --mon.setBackgroundColor(colors.black)
  81.   mon.setTextColor(8)
  82.   mon.setTextScale(1)
  83.   mon.setCursorPos(3, 3)
  84.   mon.write("TYPE")
  85.   mon.setCursorPos(3, 5)
  86.   mon.write("AMOUNT")
  87.   mon.setCursorPos(3, 7)
  88.   mon.write("CAPACITY")
  89.   powrot = true
  90.   lava = true
  91.   menu(14, 0)
  92.   menu(0, 4)
  93.   menu(0, 6)
  94.   menu(0, 8)
  95.   menu(0, 2)
  96.   wroc()
  97.   mon.setBackgroundColor(colors.black)
  98.   drukkolorowy(tankinf[1]["rawName"], 16, 3, 32)
  99.   mon.setTextScale(1)
  100.   drukkolorowy("B", 21, 5, 32)
  101. end
  102.  
  103. function menu(dlugosc, wysokosc)
  104.   mon.setTextColor(1)
  105.   for i = 1, 80 do
  106.     mon.setCursorPos(dlugosc, i)
  107.     mon.write("|")
  108.     mon.setCursorPos(i, wysokosc)
  109.     mon.write("-")
  110.   end
  111.   mon.setTextColor(2)
  112. end
  113.  
  114. function drukkolorowy(tekst1, x, y, color)
  115.   mon.setCursorPos(x, y)
  116.   mon.setTextColor(color)
  117.   mon.write(tekst1)
  118. end
  119.  
  120. function testowan()
  121.   while true do
  122.     systems()
  123.     tankinf = tank.getTankInfo("unknown")
  124.     sleep(0.05)
  125.   end
  126. end
  127.  
  128. function start1()
  129.   powrot = false
  130.   lava = false
  131.   energyc = false
  132.   system = false
  133.   mon.setBackgroundColor(colors.black)
  134.   mon.setTextScale(1)
  135.   mon.clear()
  136.   mon.clear()
  137.   mon.clear()
  138.   sleep(1)
  139.   mon.clear()
  140.   menu(14, 6)
  141.   menu(28, 12)
  142.   menu(42, 18)
  143.   menu(56, 24)
  144.   menu(70, 30)
  145.   drukkolorowy("AE SYSTEM", 3, 3, 2)
  146.   drukkolorowy("TANKS", 19, 3, 2)
  147.   drukkolorowy("ENERGY STORED", 29, 3, 2)
  148.   parallel.waitForAll(testowan, dotykz)
  149. end
  150.  
  151. function dotyk(xPos1, xPos2, yPos1, yPos2, funkcja)
  152.   event, button, xPos, yPos = os.pullEvent("monitor_touch")
  153.   if xPos > xPos1 and xPos < xPos2 and yPos > yPos1 and yPos < yPos2 then
  154.     funkcja()
  155.   end
  156. end
  157.  
  158. function dotykz()
  159.   while true do
  160.     dotyk(14, 28, 1, 6, tanks)
  161.     dotyk(28, 42, 1, 6, energys)
  162.     dotyk(0, 14, 1, 6, aesystem)
  163.     while powrot == true do
  164.       dotyk(1, 14, 24, 27, start1)
  165.     end
  166.   end
  167. end
  168.  
  169. start1()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement