Advertisement
Guest User

boot_prior_1

a guest
Feb 27th, 2014
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.05 KB | None | 0 0
  1. -- supported: macerator,electric furnace,extractor,compressor,
  2. -- supported: ore washing,thermal centrifuge, metal former,canning,
  3. -- supported: recycler,powered furnace,pulverizer,sawmill, induction smelter
  4. -- supported: batbox,mfe,cesu,mfsu,capacitor bank
  5. -- supported: RC tanks, OpenBlock Tank, Dynamic Tank (Mekanism), raintank,
  6. -- supported: me controller
  7. -- MC 1.6.4
  8. -- bitowa paleta kolorå83¥B3w.
  9. local palette = {["white"] = 1, ["orange"] = 2, ["magenta"] = 4, ["lightBlue"] = 8, ["yellow"] = 16,
  10. ["lime"] = 32, ["pink"] = 64, ["gray"] = 128, ["lightGray"] = 256, ["cyan"] = 512, ["purple"] = 1024,
  11. ["blue"] = 2048, ["brown"] = 4096, ["green"] = 8192, ["red"] = 16384, ["black"] = 32768}
  12.  
  13. -- *** CONFIG **
  14. -- zmienne
  15. local version = "0.6.5"
  16. local activeMsg, inactiveMsg, pendingMsg = "USING", "IDLE", "PENDI"
  17. local textSize = 1
  18. local name_mfsu = "BatBox"
  19.  
  20. -- terminal bridge
  21.  
  22.     energEU = {
  23.         {
  24.         ["id"] = 1,
  25.         ["name"] = "     EU:"
  26.         }
  27.     }
  28.     energRF = {
  29.         {
  30.         ["id"] = 2,
  31.         ["name"] = "     RF:"
  32.         }
  33.     }
  34.     energMJ = {
  35.         {
  36.         ["id"] = 3,
  37.         ["name"] = "     MJ:",
  38.         }
  39.     }
  40. energ = {energEU,energRF,energMJ}
  41.     memoryAE = {
  42.         {
  43.         ["id"] = 4,
  44.         ["name"] = "     Memory:"
  45.         }
  46.     }
  47.     typeAE = {
  48.         {
  49.         ["id"] = 5,
  50.         ["name"] = "     Types:"
  51.         }
  52.     }
  53. AEs = {memoryAE,typeAE}
  54.     RCHeat = {
  55.         {
  56.         ["id"] = 6,
  57.         ["name"] = "  Reactor Heat:"
  58.         }
  59.     }
  60. RactAR = {RCHeat}
  61. tanksAR = {}
  62.  
  63. local bridge = peripheral.wrap("back") -- terminal glasses bridge setup!!
  64. local widthBR = 100
  65. local offset2 = 17
  66. bridge.clear()
  67.  
  68. -- Monitory
  69. local powerMon = "monitor_2" -- monitor for display power info
  70. local tankMon = "monitor_7" -- monitor for display tanks
  71. local AEMon = "monitor_5" -- monitor for display AE
  72. local machMon = "monitor_4" -- monitor for display machines
  73. local reactMon = "monitor_6" -- monitor for display reactor
  74. local mon = peripheral.wrap(powerMon)
  75. local mon2 = peripheral.wrap(tankMon)
  76. local mon3 = peripheral.wrap(AEMon)
  77. local mon4 = peripheral.wrap(machMon)
  78. local mon5 = peripheral.wrap(reactMon)
  79. mon.clear()
  80. mon2.clear()
  81. mon3.clear()
  82. mon4.clear()
  83. mon5.clear()
  84. mon.setTextScale(textSize)
  85. mon2.setTextScale(textSize)
  86. mon3.setTextScale(textSize)
  87. mon4.setTextScale(textSize)
  88. -- Maszyny --
  89.   -- IC2
  90. local name_comp = "COMPRESSOR"
  91. local name_furnace = "E.FURNACE"
  92. local name_ext = "EXTRCTOR"
  93. local name_mace = "MACERTOR"
  94. local name_recycler = "RECYCLR"
  95. local name_canning = "CAN_MCHINE"
  96. local name_washer = "ORWASHR"
  97. local name_centrifuge = "THR. CENTRI"
  98. local name_former = "METAL FOREM"
  99. local name_recycler = "RECYCLER"
  100.   -- GT
  101. local name_pbm = "PLATE BEND.M."
  102. local name_asseM = "ASSEMBL M."
  103. local name_ind_grin = "IND.GRINDER"
  104. local name_ind_BF = "BLAST.FURN."
  105.   -- TE
  106. local name_REC = "ENERGY CELL"
  107. local name_pow_furnance = "POW.FURNANCE"
  108. local name_pulverizer = "PULVERIZER"
  109. local name_sawmill = "SAWMILL"
  110. local name_ind_smel = "IND.SMELTER"
  111.  
  112. -- Kolory
  113. local hc = palette.lightBlue -- domyslny kolor nagå85?0šå83¥B3wka
  114. local tc = palette.white -- domyslny kolor textu
  115. local color_reading = palette.lime
  116. local color_inactive = palette.gray
  117. local color_active = palette.lime
  118. local color_machines = palette.orange
  119. local color_ores = palette.pink
  120. -- Pozycje tekstå83¥B3w
  121. local pwrX_Reading = 25
  122. local machineDisplayXPos = 14
  123. local offsetPos = 2
  124. local mStatusPos = 28
  125. local orePos = 36
  126. -- SPECIAL CHARACTERS
  127. local separator = " | "
  128. local spacer = " : "
  129. -- Inne ustawienia
  130. local waitTime = {9,13}
  131. local timer = {0,0,0,0,0,0,0,0,0,0,0}
  132. local supported_Power = {"mfsu","mfe","batbox", "redstone_energy_cell"} --brak
  133. local supported_Machines = {"macerator","electric_furnace", "extractor", "compressor", "orewashing","thermalcentrifuge", "metalformer", "canning", "recycler", "tile_thermalexpansion_machine_furnace_name", "tile_thermalexpansion_machine_pulverizer_name", "tile_thermalexpansion_machine_sawmill_name", "tile_thermalexpansion_machine_smelter_name"}
  134. local sleepTime = 3
  135. local numFormat = 1
  136. -- sloty maszyn --
  137. local ic2ItemUsed = 7
  138. local ic2ItemCreated = 1
  139. local gtItemInput = 2
  140. local gtItemInd = 0
  141. local teItemInput = 0
  142. local oreWashItemUsed = 9
  143. local thermCentrItemUsed = 9
  144. -- Load API ---
  145. if fs.exists("enu") then else shell.run("pastebin get Mpk9yubJ enu") end
  146.  
  147. os.loadAPI("enu")
  148. ---------------
  149. term.clear()
  150.  
  151. function upMachines(mnitPeri)
  152.     term.clear()
  153.     term.setCursorPos(1,1)
  154.     machines = peripheral.getNames()
  155.     table.sort(machines)
  156.     if mnitPeri then
  157.         for k, v in pairs(machines) do
  158.             print(tostring(k)..": "..tostring(v))
  159.         end
  160.     end
  161. end
  162. function procenty(capa, stor)
  163.     if capa and stor ~= 0 then
  164.         local proc = 100 / capa * stor
  165.         local a = math.floor(proc*1000 + 0.5)/ 1000
  166.         tempProc = string.format("%.2f",a)
  167.     else
  168.         tempProc = 0
  169.     end
  170.     return tempProc
  171. end
  172. function round(num, idp)
  173.   local mult = 10^(idp or 0)
  174.   return math.floor(num * mult + 0.5) / mult
  175. end
  176. function round1(num)
  177.      local a = math.floor(num*1000 + 0.5)/ 1000
  178.      return a,string.format("%.2f",a)
  179. end
  180. function advList(getPeriph) -- lista dostepnych funkcji dla perip.
  181.     uused = getPeriph["getAdvancedMethodsData"]()
  182.     for key, value in pairs(uused) do
  183.         print(value.name)
  184.         --sleep(1)
  185.     end
  186. end
  187. function writeCenter(text, xWidth)
  188.     local xspot = math.floor((xWidth/2)-(string.len(text)*1.4))
  189.     return xspot
  190. end
  191. function getInfoTankBridge()
  192.     tanksAR={}
  193.     for i=1, #machines do
  194.         if string.find(machines[i], "rcirontankvalvetile")
  195.             or string.find(machines[i], "rcsteeltankvalvetile")    
  196.             or string.find(machines[i], "openblocks_tank")
  197.             or string.find(machines[i], "tile_basicblock_dynamic_valve_name")
  198.             or string.find(machines[i], "factory2_1")
  199.             or string.find(machines[i], "water_tank") then
  200.             if peripheral.isPresent(machines[i]) then
  201.                 periph = peripheral.wrap(machines[i])
  202.                 fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)                         
  203.                 if fluidName == nil then
  204.                    
  205.                 elseif fluidName ~= nil then
  206.                     tester = {
  207.                         {
  208.                         ["id"] =machines[i],
  209.                         ["name"] = fluidName,
  210.                         }
  211.                     }
  212.                     table.insert(tanksAR,tester)
  213.                 end
  214.             end
  215.         end
  216.     end
  217.     return tanksAR
  218. end
  219. function disBridgeInfo(array1,posStart,BoxName,colBar,addtext) 
  220.     offset2 = 18
  221.     for i=1, #array1 do
  222.         for key,value in pairs(array1[i]) do
  223.             value["label"] = bridge.addText(5,5+offset2 + posStart,array1[i][1]["name"],0x33FF33)
  224.             value["label"].setScale(0.5)
  225.             value["proc"] = bridge.addText(45,5+offset2 + posStart,"FILL: 0.0%",0xC5360F)
  226.             value["proc"].setScale(0.5)
  227.             if addtext then
  228.                 value["textadd"] = bridge.addText(10,offset2 + posStart," ",0x33FF33)
  229.                 value["textadd"].setScale(0.5)
  230.             end
  231.             value["heatTitle"] = bridge.addText(5,10+offset2 + posStart,"0",0x66FFFF)
  232.             value["heatTitle"].setScale(0.8)
  233.             value["progressbar"] = bridge.addGradientBox(10,10+offset2 + posStart,100,7,0x000033,0.7,0x66ccff,0.7,1)
  234.             value["progressbar"].setZ(10)
  235. --       value["progressbar"].setColor2(0x66CCFF)
  236. --      value["progressbar"].setGradient(1)
  237.             value["progressbarmarker"] = bridge.addGradientBox(10,10+offset2 + posStart,1,7,colBar,0.7,0xFFFFFF,0.7,1)
  238.             value["progressbarmarker"].setZ(11)
  239. --          value["progressbarmarker"].setGradient(1)
  240. --          value["progressbarmarker"].setColor2(0xFFFFFF)
  241.             value["capTitle"] = bridge.addText(26,11+offset2 + posStart,"          0/0",0x33FF33)
  242.             value["capTitle"].setScale(0.5)
  243.             offset2 = offset2 + 18
  244.         end
  245.     end
  246.     boxName = bridge.addBox(2, 2+posStart, 111, offset2, 0x262626, 0.2)
  247.     boxName2 = bridge.addText(5,5+posStart,BoxName,0x66CCFF)
  248.     boxName2.setScale(0.7)
  249. end
  250. function ClearBridge(array1)
  251.     for i=1, #array1 do
  252. --      for key,value in pairs(array1[i]) do
  253. --          value["label"].delete()
  254. --          value["proc"].delete()
  255. --          value["heatTitle"].delete()
  256. --          value["progressbar"].delete()
  257. --          value["progressbarmarker"].delete()
  258. --          value["capTitle"].delete()
  259.      array1 = {}
  260. --      end
  261.     end
  262. --  boxName.delete()
  263. --  boxName2.delete()
  264.    boxName.setOpacity(0)
  265.    boxName2.setText(" ")
  266. end
  267. function upBridgeDis(arrayNames,arrayNumber,capa1,stor1,currBOX,colBr,addtext1,newtext)            
  268.     for i=#arrayNames,1,-1 do
  269.         for j=#arrayNames[i],1,-1 do
  270.             storage1 = arrayNames[i][j]
  271.             if storage1["id"] == arrayNumber then
  272.                 curStored = widthBR / capa1 * stor1
  273. --              storage1["progressbarmarker"].setColor(0xFFFFFF)
  274.                 storage1["progressbarmarker"].setWidth(curStored)
  275.                 if addtext1 then
  276.                     storage1["textadd"].setText(newtext)
  277.                 end
  278.                 curStoredE = round1(curStored)
  279.                 if curStoredE <= 29 then
  280.                     storage1["proc"].setColor(0xFF0000)
  281.                     storage1["proc"].setText("FILL: "..curStoredE.."%")
  282.                 elseif curStoredE >= 30 and curStoredE <= 79 then
  283.                     storage1["proc"].setColor(0xFFFF00)
  284.                     storage1["proc"].setText("FILL: "..curStoredE.."%")
  285.                 elseif curStoredE >= 80 and curStoredE <= 99 then
  286.                     storage1["proc"].setColor(0x009900)
  287.                     storage1["proc"].setText("FILL: "..curStoredE.."%")
  288.                 elseif curStoredE >= 100 then
  289.                     storage1["proc"].setColor(0x66CCFF)
  290.                     storage1["proc"].setText("FULL")
  291.                 end
  292.                 disSmalCAP= enu.dot(stor1).."/"..enu.dot(capa1)
  293.                 storage1["capTitle"].setX(writeCenter(disSmalCAP,100)+11)
  294.                 storage1["capTitle"].setText(disSmalCAP)
  295.                 storage1["heatTitle"].setText(tostring(currBOX))
  296.             end
  297.         end
  298.     end
  299. end
  300. function disTankBar(tankProc,monBar,x1PosBar,x2PosBar,yPosBar)
  301.     monBar.setCursorPos(x1PosBar,yPosBar)
  302.     lengBar = x2PosBar - x1PosBar
  303.     widthBar = lengBar / 100 * tankProc
  304.     monBar.write("|")
  305.     if tankProc <= 29 then
  306.         monBar.setBackgroundColor(colors.red)          
  307.     elseif tankProc >= 30 and tankProc <= 79 then
  308.         monBar.setBackgroundColor(colors.lime)         
  309.     elseif tankProc >= 80 and tankProc <= 99 then
  310.         monBar.setBackgroundColor(colors.green)        
  311.     elseif tankProc >= 100 then
  312.         monBar.setBackgroundColor(colors.blue)         
  313.     end
  314.  
  315.     for k = x1PosBar, x1PosBar + widthBar do
  316.         monBar.write(" ")
  317.     end
  318.    
  319.     monBar.setBackgroundColor(colors.black)
  320.     monBar.setCursorPos(x2PosBar + 2,yPosBar)
  321.     monBar.write("|")
  322. end
  323.  
  324. machines = peripheral.getNames()
  325. table.sort(machines)
  326.  
  327. -- MONITOR 1 x,y Pos
  328. local machinesInfoCol = 1
  329.  
  330. -- MONITOR 2 x,y Pos
  331. local tankPosStart = 1
  332.  
  333. -- *** FUNKCJE ***
  334. function pFormat(pName) -- formatowanie nazwy
  335.     if string.find(pName, "compressor") then pName = name_comp
  336.     elseif string.find(pName, "electric_furnace") then pName = name_furnace
  337.     elseif string.find(pName, "extractor") then pName = name_ext
  338.     elseif string.find(pName, "macerator") then pName = name_mace
  339.     elseif string.find(pName, "canning") then pName = name_canning
  340.     elseif string.find(pName, "recycler") then pName = name_recycler
  341.     elseif string.find(pName, "former") then pName = name_former
  342.     elseif string.find(pName, "orewashing") then pName = name_washer
  343.     elseif string.find(pName, "thermalcentrifuge") then pName = name_centrifuge
  344.     elseif string.find(pName, "batbox") then pName = name_mfsu
  345.     elseif string.find(pName, "cofh_thermalexpansion_energycell") then pName = name_REC
  346.     elseif string.find(pName, "tile_thermalexpansion_machine_furnace_name") then pName = name_pow_furnance
  347.     elseif string.find(pName, "tile_thermalexpansion_machine_pulverizer_name") then pName = name_pulverizer
  348.     elseif string.find(pName, "tile_thermalexpansion_machine_sawmill_name") then pName = name_sawmill
  349.     elseif string.find(pName, "tile_thermalexpansion_machine_smelter_name") then pName = name_ind_smel
  350.     end
  351.     return pName
  352. end
  353.  
  354. function disReactorIC2()
  355.     mon5.setCursorPos(offsetPos,2)
  356.     for i=1, #machines do
  357.         -- Tanks
  358.         if string.find(machines[i], "nuclear_reactor") then
  359.             NRperiph = peripheral.wrap(machines[i])
  360.             local heatNR = NRperiph["getHeat"]()
  361.             local heatMaxNR = NRperiph["getMaxHeat"]()
  362.             local euOutputNR = NRperiph["getEUOutput"]()*5
  363.             local ActiveNR = NRperiph["isActive"]()
  364.             local procHeat = procenty(heatMaxNR,heatNR)
  365.         --  advList(NRperiph)
  366.             if ActiveNR then powNR = 1 else powNR = 0 end
  367.        
  368.             upBridgeDis(RactAR,6,heatMaxNR,heatNR,powNR,0x990099,true, "EU Output:            "..euOutputNR)
  369.             enu.appendString(reactMon, tc, " Is Active          " .. separator, true, offsetPos, 4)
  370.             enu.appendString(reactMon, color_reading, ActiveNR, false, pwrX_Reading, 4)
  371.             enu.appendString(reactMon, tc, " Reactor Heat       " .. separator, true, offsetPos, 5)
  372.             enu.appendString(reactMon, color_reading, (enu.dot(heatNR)), false, pwrX_Reading, 5)
  373.            
  374.             enu.appendString(reactMon, tc, " Max Reactor Heat   " .. separator, true, offsetPos,6)
  375.             enu.appendString(reactMon, color_reading, (enu.dot(heatMaxNR)), false, pwrX_Reading,6)
  376.            
  377.             enu.appendString(reactMon, tc, " EU Output          " .. separator, true, offsetPos,8)
  378.             enu.appendString(reactMon, color_reading, (enu.dot(euOutputNR)), false, pwrX_Reading,8)
  379.            
  380.             enu.appendString(reactMon, tc, " Proc Heat          " .. separator, true, offsetPos, 10)
  381.             enu.appendString(reactMon, color_reading, procHeat.."%", false, pwrX_Reading, 10)
  382.             disTankBar(tonumber(procHeat),mon5,2,35,11)
  383.         end
  384.     end
  385. end
  386.  
  387. function dispAE()
  388.     mon3.setCursorPos(offsetPos,2)
  389.     local AEy = 14
  390.     for j=1, #machines do
  391.         -- AE
  392.         if string.find(machines[j], "appeng_me_tilecontroller") then   
  393.             AEperiph = peripheral.wrap(machines[j])
  394.                    
  395.             local storedAE = AEperiph["getUnusedBytes"]()
  396.             local capacityAE = AEperiph["getTotalBytes"]()
  397.             local itemCountAE = AEperiph["getStoredItemCount"]()
  398.             local itemSTypeAE = AEperiph["getStoredItemTypes"]()
  399.             local itemTTypeAE = AEperiph["getTotalItemTypes"]()
  400.            
  401.             local aeJobs =  AEperiph["getJobList"]()
  402.             upBridgeDis(AEs,4,capacityAE,storedAE,1,0x330000,true,"   Items:               "..enu.dot(itemCountAE))
  403.             enu.appendString(AEMon, tc, " Memory Stored      " .. separator, true, offsetPos, 3)
  404.             enu.appendString(AEMon, color_reading, (enu.dot(storedAE)), false, pwrX_Reading, 3)
  405.             enu.appendString(AEMon, tc, " Memory State       " .. separator, true, offsetPos, 4)
  406.             enu.appendString(AEMon, color_reading, procenty(capacityAE,storedAE).."%", false, pwrX_Reading, 4)
  407.             enu.appendString(AEMon, tc, " Memory Capacity    " .. separator, true, offsetPos, 5)
  408.             enu.appendString(AEMon, color_reading, (enu.dot(capacityAE)), false, pwrX_Reading,5 )
  409.                
  410.             enu.appendString(AEMon, tc, " Items              " .. separator, true, offsetPos, 7)
  411.             enu.appendString(AEMon, color_reading, (enu.dot(itemCountAE)), false, pwrX_Reading,7 )
  412.            
  413.             upBridgeDis(AEs,5,itemTTypeAE,itemSTypeAE,1,0x330000,false)
  414.             enu.appendString(AEMon, tc, " Stored Types       " .. separator, true, offsetPos, 9)
  415.             enu.appendString(AEMon, color_reading, (enu.dot(itemSTypeAE)), false, pwrX_Reading,9 )
  416.             enu.appendString(AEMon, tc, " Stored Types State " .. separator, true, offsetPos, 10)
  417.             enu.appendString(AEMon, color_reading, procenty(itemTTypeAE,itemSTypeAE).."%", false, pwrX_Reading,10)
  418.             enu.appendString(AEMon, tc, " Total Types        " .. separator, true, offsetPos, 11)
  419.             enu.appendString(AEMon, color_reading, (enu.dot(itemTTypeAE)), false, pwrX_Reading,11)
  420.  
  421.             enu.appendString(AEMon, tc, " Currently Crafting:" .. separator, true, offsetPos, 13)
  422.             for key, value in pairs(aeJobs) do
  423.                 enu.appendString(AEMon, palette.lightBlue,tostring(value.qty), false, 4,AEy )
  424.                 enu.appendString(AEMon, palette.lightBlue,"- "..value.name, false,12 ,AEy )
  425.                 AEy = AEy +1
  426.             end
  427.         end
  428.     end
  429.     for i=1,10,1 do
  430.         mon3.setCursorPos(1,AEy)
  431.         mon3.clearLine()
  432.         AEy = AEy + 1
  433.     end
  434. end
  435.  
  436. function dispTanks()
  437.     mon2.setCursorPos(offsetPos,2)
  438.     ClearBridge(tanksAR)
  439.     getInfoTankBridge()
  440.     disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  441.     for i=1, #machines do
  442.         -- Tanks
  443.         if string.find(machines[i], "rcirontankvalvetile")
  444.             or string.find(machines[i], "rcsteeltankvalvetile")    
  445.             or string.find(machines[i], "openblocks_tank")
  446.             or string.find(machines[i], "tile_basicblock_dynamic_valve_name")
  447.             or string.find(machines[i], "factory2_1")
  448.             or string.find(machines[i], "water_tank") then
  449.             -- print(machines[i])
  450.             if peripheral.isPresent(machines[i]) then
  451.                 periph = peripheral.wrap(machines[i])
  452.            
  453.                 fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)                         
  454.                
  455.                
  456.                 if fluidName == nil then
  457.                     -- brak fluidu nie wyswietli tanka
  458.                 elseif fluidName ~= nil then
  459.                    
  460.                     mon2.setTextColor(tc)
  461.                     tankProc1 = procenty(fluidCapacity,fluidAmount)
  462.                     x,y = mon2.getCursorPos()
  463.                     mon2.setCursorPos(offsetPos, (y+1))
  464.                     mon2.clearLine()
  465.                 --  mon2.write(" (" .. fluidName .. ") : " ..enu.dot(fluidAmount) .. " / " ..enu.dot(fluidCapacity) .. " mb (" ..procenty(fluidCapacity,fluidAmount).."%)"))
  466.                     mon2.write(" (" .. fluidName .. ") : (" ..tankProc1.."%)")
  467.                     disTankBar(tonumber(tankProc1),mon2,28,58,(y+1))
  468.                     mon2.setCursorPos(offsetPos, (y+2))
  469.                    
  470.                     upBridgeDis(tanksAR,machines[i],fluidCapacity,fluidAmount,"T",0xCC0000,false)
  471.                 end
  472.             end
  473.         end
  474.     end
  475.    
  476.     x,y = mon2.getCursorPos()
  477.     for i=1,10,1 do
  478.         y = y + 1
  479.         mon2.setCursorPos(1,y)
  480.         mon2.clearLine()
  481.     end
  482.     loaded = true
  483.    
  484. end
  485.  
  486. function dispPower()
  487.     local EUProc = 0
  488.     local RFProc = 0
  489.     local MJProc = 0
  490.     local couMJM = 0
  491.     local couRFM = 0
  492.     local couEUM = 0
  493.     local totalStorage = 0
  494.     local totalCapacity = 0
  495.     local totalStoredRF = 0
  496.     local totalCapacityRF = 0
  497.     local totalStoredMJ = 0
  498.     local totalCapacityMJ = 0
  499.  
  500.     for i=1, #machines do
  501.         if string.find(machines[i], "batbox") or  string.find(machines[i], "mfsu") or  string.find(machines[i], "mfe") or  string.find(machines[i], "cesu") then -- IC2 Power
  502.             periphEU = peripheral.wrap(machines[i])    
  503.             if peripheral.isPresent(machines[i]) then
  504.                 local storedEU = periphEU.getEUStored()
  505.                 local capacity = periphEU.getEUCapacity()
  506.                 if storedEU <= 100 then
  507.                     print(machines[i])
  508.                 end
  509.                 totalStorage =  totalStorage + storedEU
  510.                 totalStorage = math.floor(totalStorage)
  511.                 totalCapacity = capacity + totalCapacity
  512.                 EUProc = procenty(totalCapacity,totalStorage)
  513.                 couEUM = couEUM + 1
  514.             end
  515.         end
  516.         if string.find(machines[i], "cofh_thermalexpansion_energycell") then -- TE Power
  517.             periphRF = peripheral.wrap(machines[i])            
  518.             if peripheral.isPresent(machines[i]) then
  519.                 local storedRF = periphRF.getEnergyStored("all")
  520.                 local capacityRF = periphRF.getMaxEnergyStored("all")
  521.                 if storedRF<= 100 then
  522.                     print(machines[i])
  523.                 end
  524.            
  525.                 totalStoredRF = storedRF + totalStoredRF
  526.                 totalStoredRF = math.floor(totalStoredRF)
  527.                 totalCapacityRF = capacityRF + totalCapacityRF
  528.                 RFProc = procenty(totalCapacityRF,totalStoredRF)
  529.                 couRFM = couRFM +1
  530.             end
  531.        
  532.         end
  533.         if string.find(machines[i], "blockcapacitorbank") then
  534.             periphMJ = peripheral.wrap(machines[i])  
  535.             if peripheral.isPresent(machines[i]) then
  536.                 local storedMJ = periphMJ.getMJStored("all")
  537.                 local capacityMJ = periphMJ.getMaxEnergyStored("all")
  538.                 local maxMJInput = periphMJ.getMaxMJReceived("all")
  539.                 local MJ = periphMJ.getActivationEnergy("all")
  540.                 if storedMJ <= 100 then
  541.                     print(machines[i])
  542.                 end
  543.                 totalStoredMJ = storedMJ + totalStoredMJ
  544.                 totalStoredMJ = math.floor(totalStoredMJ)
  545.                 totalCapacityMJ = capacityMJ + totalCapacityMJ
  546.                 MJProc = procenty(totalCapacityMJ,totalStoredMJ)
  547.                 couMJM = couMJM +1
  548.             end
  549.         end
  550.     end
  551.     upBridgeDis(energ,1,totalCapacity,totalStorage,couEUM,0x3366FF,false)
  552.     enu.appendString(powerMon, palette.lime, "   * EU - "..EUProc.."%" , true, offsetPos, 3)
  553.     disTankBar(tonumber(EUProc),mon,23,37,3)
  554.     enu.appendString(powerMon, tc, " Stored EU          " .. separator, true, offsetPos, 5)
  555.     enu.appendString(powerMon, color_reading, (enu.dot(totalStorage)), false, pwrX_Reading, 5)     
  556.     enu.appendString(powerMon, tc, " Total EU Capacity  " .. separator, true, offsetPos, 6)
  557.     enu.appendString(powerMon, color_reading, (enu.dot(totalCapacity)), false, pwrX_Reading,6 )
  558.     enu.appendString(powerMon, tc, " Number of box      " .. separator, true, offsetPos, 7)
  559.     enu.appendString(powerMon, color_reading, (enu.dot(couEUM)), false, pwrX_Reading, 7)
  560.     -- RF
  561.     upBridgeDis(energ,2,totalCapacityRF,totalStoredRF,couRFM,0x3366FF,false)
  562.     enu.appendString(powerMon, palette.lime, "   * RF - "..RFProc.."%", true, offsetPos, 9)
  563.     disTankBar(tonumber(RFProc),mon,23,37,9)
  564.     enu.appendString(powerMon, tc, " Stored RF          " .. separator, true, offsetPos, 11)
  565.     enu.appendString(powerMon, color_reading, (enu.dot(totalStoredRF)), false, pwrX_Reading, 11)   
  566.     enu.appendString(powerMon, tc, " Total RF Capacity  " .. separator, true, offsetPos, 12)
  567.     enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityRF)), false, pwrX_Reading, 12)     
  568.     enu.appendString(powerMon, tc, " Energy Cells       " .. separator, true, offsetPos, 13)
  569.     enu.appendString(powerMon, color_reading, (enu.dot(couRFM)), false, pwrX_Reading, 13)  
  570.     -- MJ
  571.     upBridgeDis(energ,3,totalCapacityMJ,totalStoredMJ,couMJM,0x3366FF,false)
  572.     enu.appendString(powerMon, palette.lime, "   * MJ - "..MJProc.."%", true, offsetPos, 15)
  573.     disTankBar(tonumber(MJProc),mon,23,37,15)
  574.     enu.appendString(powerMon, tc, " Stored MJ          " .. separator, true, offsetPos, 17)
  575.     enu.appendString(powerMon, color_reading, (enu.dot(totalStoredMJ)), false, pwrX_Reading, 17)   
  576.     enu.appendString(powerMon, tc, " Total MJ Capacity  " .. separator, true, offsetPos, 18)
  577.     enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityMJ)), false, pwrX_Reading, 18)     
  578.     enu.appendString(powerMon, tc, " Capacitor Banks    " .. separator, true, offsetPos, 19)
  579.     enu.appendString(powerMon, color_reading, (enu.dot(couMJM)), false, pwrX_Reading, 19)
  580. end
  581.  
  582. function dispMach()
  583.     machineDispStart = 2 -- machineDisplayXPos
  584.     for i=1, #machines do
  585.         local m
  586.         for m=1, #supported_Machines do
  587.             if string.find(machines[i], supported_Machines[m]) then
  588.                 periphM = peripheral.wrap(machines[i])
  589.                 if peripheral.isPresent(machines[i]) then                  
  590.                     if string.find(machines[i], "thermalcentrifuge") then
  591.                         itemStackUsed = periphM.getStackInSlot(thermCentrItemUsed)
  592.                         energyTEProc = 150
  593.                     elseif string.find(machines[i], "orewashing") then
  594.                         itemStackUsed = periphM.getStackInSlot(oreWashItemUsed)
  595.                         energyTEProc = 150
  596.                     elseif string.find(machines[i], "tile_thermalexpansion_machine_furnace_name") or string.find(machines[i], "tile_thermalexpansion_machine_pulverizer_name") or string.find(machines[i], "tile_thermalexpansion_machine_sawmill_name") or string.find(machines[i], "tile_thermalexpansion_machine_smelter_name") then
  597.                         itemStackUsed = periphM.getStackInSlot(1)
  598.                         EnergyTE = periphM["getEnergy"]()
  599.                         EnergyMaxTE = periphM["getMaxEnergyStored"]("all")
  600.                         energyTEProc = procenty(EnergyMaxTE,EnergyTE)
  601.                         --print(energyTEProc)
  602.                     elseif string.find(machines[i], "electric_furnace") or string.find(machines[i], "macerator") or string.find(machines[i], "extractor") or string.find(machines[i], "compressor")or string.find(machines[i], "metalformer")or string.find(machines[i], "canning") or string.find(machines[i], "recycler") then
  603.                         itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)                        
  604.                         energyTEProc = 150
  605.                     else
  606.                         itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)
  607.                         energyTEProc = 150
  608.                     end
  609.                     if tonumber(energyTEProc) <= 3 then
  610.                         powACT = "NO ENERGY"
  611.                         colM = palette.red
  612.                     elseif tonumber(energyTEProc) >= 2 and tonumber(energyTEProc) < 120 then
  613.                         powACT = " POWERED"
  614.                         colM = palette.yellow
  615.                     elseif  tonumber(energyTEProc) == 150 then
  616.                         powACT = " NO INFO"
  617.                         colM = color_inactive
  618.                     end
  619.                
  620.                     machineDispStart = machineDispStart + 1    
  621.                     if itemStackUsed ~= nil then
  622.                         itemName = enu.itemRename(itemStackUsed.name)
  623.                     --  timer[2] = os.clock()
  624.                         enu.appendString(machMon, color_ores, itemName, true, orePos, machineDispStart)
  625.                         str = (pFormat(peripheral.getType(machines[i])))                       
  626.                         enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  627.                         enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  628.                         enu.appendString(machMon, color_active, activeMsg, false, mStatusPos, machineDispStart)                    
  629.  
  630.                     elseif itemStackUsed == nil then       
  631.                         enu.appendString(machMon, color_inactive, inactiveMsg, true, mStatusPos, machineDispStart)
  632.                         str = (pFormat(peripheral.getType(machines[i])))
  633.                         enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  634.                         enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  635.                     else
  636.                    
  637.                     end
  638.                 end            
  639.             end
  640.         end
  641.     end
  642.     for i=1,10,1 do
  643.         machineDispStart = machineDispStart + 1
  644.         mon4.setCursorPos(1,machineDispStart)
  645.         mon4.clearLine()
  646.     end
  647. end
  648. enu.cString(offsetPos, 1, hc, tankMon, "-- TANK INFO --")
  649. enu.cString(offsetPos, 1, hc, AEMon, "-- AE INFO --")
  650. enu.cString(offsetPos, 1, hc, powerMon, "-- POWER INFO--")
  651. enu.cString(offsetPos, machinesInfoCol, hc, machMon, "-- MACHINES INFO --")
  652. enu.cString(offsetPos, 1, hc, reactMon, "-- Reactor INFO --")
  653.  
  654. disBridgeInfo(energ,0,"- Power Info -",0xCC0000,false)
  655. disBridgeInfo(AEs,74,"- AE Info -",0xCC0000,true)
  656. disBridgeInfo(RactAR,130,"- Reactor Info -",0xCC0000,true)
  657. getInfoTankBridge()
  658. disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  659. -- Start
  660. while true do
  661.     upMachines(false)
  662.  
  663.     disReactorIC2()
  664.     dispAE()
  665.     dispTanks()
  666.     dispPower()
  667.     dispMach()
  668.     sleep(1.5)
  669. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement