EnnekPL

kontroler 1.6.4 (terminal glasses)

Jan 27th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.90 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ów.
  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_6" -- 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_8" -- 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łówka
  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ów
  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.addBox(10,10+offset2 + posStart,100,7,0x000033,0.7)
  234. value["progressbar"].setZIndex(10)
  235. value["progressbar"].setGradient(1)
  236. value["progressbar"].setColor2(0x66ccff)
  237. value["progressbarmarker"] = bridge.addBox(10,10+offset2 + posStart,1,7,colBar,0.7)
  238. value["progressbarmarker"].setZIndex(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. end
  260. end
  261. boxName.delete()
  262. boxName2.delete()
  263. end
  264. function upBridgeDis(arrayNames,arrayNumber,capa1,stor1,currBOX,colBr,addtext1,newtext)
  265. for i=#arrayNames,1,-1 do
  266. for j=#arrayNames[i],1,-1 do
  267. storage1 = arrayNames[i][j]
  268. if storage1["id"] == arrayNumber then
  269. curStored = widthBR / capa1 * stor1
  270. storage1["progressbarmarker"].setColor(colBr)
  271. storage1["progressbarmarker"].setWidth(curStored)
  272. if addtext1 then
  273. storage1["textadd"].setText(newtext)
  274. end
  275. curStoredE = round1(curStored)
  276. if curStoredE <= 29 then
  277. storage1["proc"].setColor(0xFF0000)
  278. storage1["proc"].setText("FILL: "..curStoredE.."%")
  279. elseif curStoredE >= 30 and curStoredE <= 79 then
  280. storage1["proc"].setColor(0xFFFF00)
  281. storage1["proc"].setText("FILL: "..curStoredE.."%")
  282. elseif curStoredE >= 80 and curStoredE <= 99 then
  283. storage1["proc"].setColor(0x009900)
  284. storage1["proc"].setText("FILL: "..curStoredE.."%")
  285. elseif curStoredE >= 100 then
  286. storage1["proc"].setColor(0x66CCFF)
  287. storage1["proc"].setText("FULL")
  288. end
  289. disSmalCAP= enu.dot(stor1).."/"..enu.dot(capa1)
  290. storage1["capTitle"].setX(writeCenter(disSmalCAP,100)+11)
  291. storage1["capTitle"].setText(disSmalCAP)
  292. storage1["heatTitle"].setText(tostring(currBOX))
  293. end
  294. end
  295. end
  296. end
  297. function disTankBar(tankProc,monBar,x1PosBar,x2PosBar,yPosBar)
  298. monBar.setCursorPos(x1PosBar,yPosBar)
  299. lengBar = x2PosBar - x1PosBar
  300. widthBar = lengBar / 100 * tankProc
  301. monBar.write("|")
  302. if tankProc <= 29 then
  303. monBar.setBackgroundColor(colors.red)
  304. elseif tankProc >= 30 and tankProc <= 79 then
  305. monBar.setBackgroundColor(colors.lime)
  306. elseif tankProc >= 80 and tankProc <= 99 then
  307. monBar.setBackgroundColor(colors.green)
  308. elseif tankProc >= 100 then
  309. monBar.setBackgroundColor(colors.blue)
  310. end
  311.  
  312. for k = x1PosBar, x1PosBar + widthBar do
  313. monBar.write(" ")
  314. end
  315.  
  316. monBar.setBackgroundColor(colors.black)
  317. monBar.setCursorPos(x2PosBar + 2,yPosBar)
  318. monBar.write("|")
  319. end
  320.  
  321. machines = peripheral.getNames()
  322. table.sort(machines)
  323.  
  324. -- MONITOR 1 x,y Pos
  325. local machinesInfoCol = 1
  326.  
  327. -- MONITOR 2 x,y Pos
  328. local tankPosStart = 1
  329.  
  330. -- *** FUNKCJE ***
  331. function pFormat(pName) -- formatowanie nazwy
  332. if string.find(pName, "compressor") then pName = name_comp
  333. elseif string.find(pName, "electric_furnace") then pName = name_furnace
  334. elseif string.find(pName, "extractor") then pName = name_ext
  335. elseif string.find(pName, "macerator") then pName = name_mace
  336. elseif string.find(pName, "canning") then pName = name_canning
  337. elseif string.find(pName, "recycler") then pName = name_recycler
  338. elseif string.find(pName, "former") then pName = name_former
  339. elseif string.find(pName, "orewashing") then pName = name_washer
  340. elseif string.find(pName, "thermalcentrifuge") then pName = name_centrifuge
  341. elseif string.find(pName, "batbox") then pName = name_mfsu
  342. elseif string.find(pName, "cofh_thermalexpansion_energycell") then pName = name_REC
  343. elseif string.find(pName, "tile_thermalexpansion_machine_furnace_name") then pName = name_pow_furnance
  344. elseif string.find(pName, "tile_thermalexpansion_machine_pulverizer_name") then pName = name_pulverizer
  345. elseif string.find(pName, "tile_thermalexpansion_machine_sawmill_name") then pName = name_sawmill
  346. elseif string.find(pName, "tile_thermalexpansion_machine_smelter_name") then pName = name_ind_smel
  347. end
  348. return pName
  349. end
  350.  
  351. function disReactorIC2()
  352. mon5.setCursorPos(offsetPos,2)
  353. for i=1, #machines do
  354. -- Tanks
  355. if string.find(machines[i], "nuclear_reactor") then
  356. NRperiph = peripheral.wrap(machines[i])
  357. local heatNR = NRperiph["getHeat"]()
  358. local heatMaxNR = NRperiph["getMaxHeat"]()
  359. local euOutputNR = NRperiph["getEUOutput"]()
  360. local ActiveNR = NRperiph["isActive"]()
  361. local procHeat = procenty(heatMaxNR,heatNR)
  362. -- advList(NRperiph)
  363. if ActiveNR then powNR = 1 else powNR = 0 end
  364.  
  365. upBridgeDis(RactAR,6,heatMaxNR,heatNR,powNR,0x990099,true, "EU Output: "..euOutputNR)
  366. enu.appendString(reactMon, tc, " Is Active " .. separator, true, offsetPos, 4)
  367. enu.appendString(reactMon, color_reading, ActiveNR, false, pwrX_Reading, 4)
  368. enu.appendString(reactMon, tc, " Reactor Heat " .. separator, true, offsetPos, 5)
  369. enu.appendString(reactMon, color_reading, (enu.dot(heatNR)), false, pwrX_Reading, 5)
  370.  
  371. enu.appendString(reactMon, tc, " Max Reactor Heat " .. separator, true, offsetPos,6)
  372. enu.appendString(reactMon, color_reading, (enu.dot(heatMaxNR)), false, pwrX_Reading,6)
  373.  
  374. enu.appendString(reactMon, tc, " EU Output " .. separator, true, offsetPos,8)
  375. enu.appendString(reactMon, color_reading, (enu.dot(euOutputNR)), false, pwrX_Reading,8)
  376.  
  377. enu.appendString(reactMon, tc, " Proc Heat " .. separator, true, offsetPos, 10)
  378. enu.appendString(reactMon, color_reading, procHeat.."%", false, pwrX_Reading, 10)
  379. disTankBar(tonumber(procHeat),mon5,2,35,11)
  380. end
  381. end
  382. end
  383.  
  384. function dispAE()
  385. mon3.setCursorPos(offsetPos,2)
  386. local AEy = 14
  387. for j=1, #machines do
  388. -- AE
  389. if string.find(machines[j], "appeng_me_tilecontroller") then
  390. AEperiph = peripheral.wrap(machines[j])
  391.  
  392. local storedAE = AEperiph["getUnusedBytes"]()
  393. local capacityAE = AEperiph["getTotalBytes"]()
  394. local itemCountAE = AEperiph["getStoredItemCount"]()
  395. local itemSTypeAE = AEperiph["getStoredItemTypes"]()
  396. local itemTTypeAE = AEperiph["getTotalItemTypes"]()
  397.  
  398. local aeJobs = AEperiph["getJobList"]()
  399. upBridgeDis(AEs,4,capacityAE,storedAE,1,0x330000,true," Items: "..enu.dot(itemCountAE))
  400. enu.appendString(AEMon, tc, " Memory Stored " .. separator, true, offsetPos, 3)
  401. enu.appendString(AEMon, color_reading, (enu.dot(storedAE)), false, pwrX_Reading, 3)
  402. enu.appendString(AEMon, tc, " Memory State " .. separator, true, offsetPos, 4)
  403. enu.appendString(AEMon, color_reading, procenty(capacityAE,storedAE).."%", false, pwrX_Reading, 4)
  404. enu.appendString(AEMon, tc, " Memory Capacity " .. separator, true, offsetPos, 5)
  405. enu.appendString(AEMon, color_reading, (enu.dot(capacityAE)), false, pwrX_Reading,5 )
  406.  
  407. enu.appendString(AEMon, tc, " Items " .. separator, true, offsetPos, 7)
  408. enu.appendString(AEMon, color_reading, (enu.dot(itemCountAE)), false, pwrX_Reading,7 )
  409.  
  410. upBridgeDis(AEs,5,itemTTypeAE,itemSTypeAE,1,0x330000,false)
  411. enu.appendString(AEMon, tc, " Stored Types " .. separator, true, offsetPos, 9)
  412. enu.appendString(AEMon, color_reading, (enu.dot(itemSTypeAE)), false, pwrX_Reading,9 )
  413. enu.appendString(AEMon, tc, " Stored Types State " .. separator, true, offsetPos, 10)
  414. enu.appendString(AEMon, color_reading, procenty(itemTTypeAE,itemSTypeAE).."%", false, pwrX_Reading,10)
  415. enu.appendString(AEMon, tc, " Total Types " .. separator, true, offsetPos, 11)
  416. enu.appendString(AEMon, color_reading, (enu.dot(itemTTypeAE)), false, pwrX_Reading,11)
  417.  
  418. enu.appendString(AEMon, tc, " Currently Crafting:" .. separator, true, offsetPos, 13)
  419. for key, value in pairs(aeJobs) do
  420. enu.appendString(AEMon, palette.lightBlue,tostring(value.qty), false, 4,AEy )
  421. enu.appendString(AEMon, palette.lightBlue,"- "..value.name, false,12 ,AEy )
  422. AEy = AEy +1
  423. end
  424. end
  425. end
  426. for i=1,10,1 do
  427. mon3.setCursorPos(1,AEy)
  428. mon3.clearLine()
  429. AEy = AEy + 1
  430. end
  431. end
  432.  
  433. function dispTanks()
  434. mon2.setCursorPos(offsetPos,2)
  435. ClearBridge(tanksAR)
  436. getInfoTankBridge()
  437. disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  438. for i=1, #machines do
  439. -- Tanks
  440. if string.find(machines[i], "rcirontankvalvetile")
  441. or string.find(machines[i], "rcsteeltankvalvetile")
  442. or string.find(machines[i], "openblocks_tank")
  443. or string.find(machines[i], "tile_basicblock_dynamic_valve_name")
  444. or string.find(machines[i], "factory2_1")
  445. or string.find(machines[i], "water_tank") then
  446. -- print(machines[i])
  447. if peripheral.isPresent(machines[i]) then
  448. periph = peripheral.wrap(machines[i])
  449.  
  450. fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)
  451.  
  452.  
  453. if fluidName == nil then
  454. -- brak fluidu nie wyswietli tanka
  455. elseif fluidName ~= nil then
  456.  
  457. mon2.setTextColor(tc)
  458. tankProc1 = procenty(fluidCapacity,fluidAmount)
  459. x,y = mon2.getCursorPos()
  460. mon2.setCursorPos(offsetPos, (y+1))
  461. mon2.clearLine()
  462. -- mon2.write(" (" .. fluidName .. ") : " ..enu.dot(fluidAmount) .. " / " ..enu.dot(fluidCapacity) .. " mb (" ..procenty(fluidCapacity,fluidAmount).."%)"))
  463. mon2.write(" (" .. fluidName .. ") : (" ..tankProc1.."%)")
  464. disTankBar(tonumber(tankProc1),mon2,28,58,(y+1))
  465. mon2.setCursorPos(offsetPos, (y+2))
  466.  
  467. upBridgeDis(tanksAR,machines[i],fluidCapacity,fluidAmount,"T",0xCC0000,false)
  468. end
  469. end
  470. end
  471. end
  472.  
  473. x,y = mon2.getCursorPos()
  474. for i=1,10,1 do
  475. y = y + 1
  476. mon2.setCursorPos(1,y)
  477. mon2.clearLine()
  478. end
  479. loaded = true
  480.  
  481. end
  482.  
  483. function dispPower()
  484. local EUProc = 0
  485. local RFProc = 0
  486. local MJProc = 0
  487. local couMJM = 0
  488. local couRFM = 0
  489. local couEUM = 0
  490. local totalStorage = 0
  491. local totalCapacity = 0
  492. local totalStoredRF = 0
  493. local totalCapacityRF = 0
  494. local totalStoredMJ = 0
  495. local totalCapacityMJ = 0
  496.  
  497. for i=1, #machines do
  498. 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
  499. periphEU = peripheral.wrap(machines[i])
  500. if peripheral.isPresent(machines[i]) then
  501. local storedEU = periphEU.getEUStored()
  502. local capacity = periphEU.getEUCapacity()
  503. if storedEU <= 100 then
  504. print(machines[i])
  505. end
  506. totalStorage = totalStorage + storedEU
  507. totalStorage = math.floor(totalStorage)
  508. totalCapacity = capacity + totalCapacity
  509. EUProc = procenty(totalCapacity,totalStorage)
  510. couEUM = couEUM + 1
  511. end
  512. end
  513. if string.find(machines[i], "cofh_thermalexpansion_energycell") then -- TE Power
  514. periphRF = peripheral.wrap(machines[i])
  515. if peripheral.isPresent(machines[i]) then
  516. local storedRF = periphRF.getEnergyStored("all")
  517. local capacityRF = periphRF.getMaxEnergyStored("all")
  518. if storedRF<= 100 then
  519. print(machines[i])
  520. end
  521.  
  522. totalStoredRF = storedRF + totalStoredRF
  523. totalStoredRF = math.floor(totalStoredRF)
  524. totalCapacityRF = capacityRF + totalCapacityRF
  525. RFProc = procenty(totalCapacityRF,totalStoredRF)
  526. couRFM = couRFM +1
  527. end
  528.  
  529. end
  530. if string.find(machines[i], "blockcapacitorbank") then
  531. periphMJ = peripheral.wrap(machines[i])
  532. if peripheral.isPresent(machines[i]) then
  533. local storedMJ = periphMJ.getMJStored("all")
  534. local capacityMJ = periphMJ.getMaxEnergyStored("all")
  535. local maxMJInput = periphMJ.getMaxMJReceived("all")
  536. local MJ = periphMJ.getActivationEnergy("all")
  537. if storedMJ <= 100 then
  538. print(machines[i])
  539. end
  540. totalStoredMJ = storedMJ + totalStoredMJ
  541. totalStoredMJ = math.floor(totalStoredMJ)
  542. totalCapacityMJ = capacityMJ + totalCapacityMJ
  543. MJProc = procenty(totalCapacityMJ,totalStoredMJ)
  544. couMJM = couMJM +1
  545. end
  546. end
  547. end
  548. upBridgeDis(energ,1,totalCapacity,totalStorage,couEUM,0x3366FF,false)
  549. enu.appendString(powerMon, palette.lime, " * EU - "..EUProc.."%" , true, offsetPos, 3)
  550. disTankBar(tonumber(EUProc),mon,23,37,3)
  551. enu.appendString(powerMon, tc, " Stored EU " .. separator, true, offsetPos, 5)
  552. enu.appendString(powerMon, color_reading, (enu.dot(totalStorage)), false, pwrX_Reading, 5)
  553. enu.appendString(powerMon, tc, " Total EU Capacity " .. separator, true, offsetPos, 6)
  554. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacity)), false, pwrX_Reading,6 )
  555. enu.appendString(powerMon, tc, " Number of box " .. separator, true, offsetPos, 7)
  556. enu.appendString(powerMon, color_reading, (enu.dot(couEUM)), false, pwrX_Reading, 7)
  557. -- RF
  558. upBridgeDis(energ,2,totalCapacityRF,totalStoredRF,couRFM,0x3366FF,false)
  559. enu.appendString(powerMon, palette.lime, " * RF - "..RFProc.."%", true, offsetPos, 9)
  560. disTankBar(tonumber(RFProc),mon,23,37,9)
  561. enu.appendString(powerMon, tc, " Stored RF " .. separator, true, offsetPos, 11)
  562. enu.appendString(powerMon, color_reading, (enu.dot(totalStoredRF)), false, pwrX_Reading, 11)
  563. enu.appendString(powerMon, tc, " Total RF Capacity " .. separator, true, offsetPos, 12)
  564. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityRF)), false, pwrX_Reading, 12)
  565. enu.appendString(powerMon, tc, " Energy Cells " .. separator, true, offsetPos, 13)
  566. enu.appendString(powerMon, color_reading, (enu.dot(couRFM)), false, pwrX_Reading, 13)
  567. -- MJ
  568. upBridgeDis(energ,3,totalCapacityMJ,totalStoredMJ,couMJM,0x3366FF,false)
  569. enu.appendString(powerMon, palette.lime, " * MJ - "..MJProc.."%", true, offsetPos, 15)
  570. disTankBar(tonumber(MJProc),mon,23,37,15)
  571. enu.appendString(powerMon, tc, " Stored MJ " .. separator, true, offsetPos, 17)
  572. enu.appendString(powerMon, color_reading, (enu.dot(totalStoredMJ)), false, pwrX_Reading, 17)
  573. enu.appendString(powerMon, tc, " Total MJ Capacity " .. separator, true, offsetPos, 18)
  574. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityMJ)), false, pwrX_Reading, 18)
  575. enu.appendString(powerMon, tc, " Capacitor Banks " .. separator, true, offsetPos, 19)
  576. enu.appendString(powerMon, color_reading, (enu.dot(couMJM)), false, pwrX_Reading, 19)
  577. end
  578.  
  579. function dispMach()
  580. machineDispStart = 2 -- machineDisplayXPos
  581. for i=1, #machines do
  582. local m
  583. for m=1, #supported_Machines do
  584. if string.find(machines[i], supported_Machines[m]) then
  585. periphM = peripheral.wrap(machines[i])
  586. if peripheral.isPresent(machines[i]) then
  587. if string.find(machines[i], "thermalcentrifuge") then
  588. itemStackUsed = periphM.getStackInSlot(thermCentrItemUsed)
  589. energyTEProc = 150
  590. elseif string.find(machines[i], "orewashing") then
  591. itemStackUsed = periphM.getStackInSlot(oreWashItemUsed)
  592. energyTEProc = 150
  593. 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
  594. itemStackUsed = periphM.getStackInSlot(1)
  595. EnergyTE = periphM["getEnergy"]()
  596. EnergyMaxTE = periphM["getMaxEnergyStored"]("all")
  597. energyTEProc = procenty(EnergyMaxTE,EnergyTE)
  598. --print(energyTEProc)
  599. 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
  600. itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)
  601. energyTEProc = 150
  602. else
  603. itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)
  604. energyTEProc = 150
  605. end
  606. if tonumber(energyTEProc) <= 3 then
  607. powACT = "NO ENERGY"
  608. colM = palette.red
  609. elseif tonumber(energyTEProc) >= 2 and tonumber(energyTEProc) < 120 then
  610. powACT = " POWERED"
  611. colM = palette.yellow
  612. elseif tonumber(energyTEProc) == 150 then
  613. powACT = " NO INFO"
  614. colM = color_inactive
  615. end
  616.  
  617. machineDispStart = machineDispStart + 1
  618. if itemStackUsed ~= nil then
  619. itemName = enu.itemRename(itemStackUsed.name)
  620. -- timer[2] = os.clock()
  621. enu.appendString(machMon, color_ores, itemName, true, orePos, machineDispStart)
  622. str = (pFormat(peripheral.getType(machines[i])))
  623. enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  624. enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  625. enu.appendString(machMon, color_active, activeMsg, false, mStatusPos, machineDispStart)
  626.  
  627. elseif itemStackUsed == nil then
  628. enu.appendString(machMon, color_inactive, inactiveMsg, true, mStatusPos, machineDispStart)
  629. str = (pFormat(peripheral.getType(machines[i])))
  630. enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  631. enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  632. else
  633.  
  634. end
  635. end
  636. end
  637. end
  638. end
  639. for i=1,10,1 do
  640. machineDispStart = machineDispStart + 1
  641. mon4.setCursorPos(1,machineDispStart)
  642. mon4.clearLine()
  643. end
  644. end
  645. enu.cString(offsetPos, 1, hc, tankMon, "-- TANK INFO --")
  646. enu.cString(offsetPos, 1, hc, AEMon, "-- AE INFO --")
  647. enu.cString(offsetPos, 1, hc, powerMon, "-- POWER INFO--")
  648. enu.cString(offsetPos, machinesInfoCol, hc, machMon, "-- MACHINES INFO --")
  649. enu.cString(offsetPos, 1, hc, reactMon, "-- Reactor INFO --")
  650.  
  651. disBridgeInfo(energ,0,"- Power Info -",0xCC0000,false)
  652. disBridgeInfo(AEs,74,"- AE Info -",0xCC0000,true)
  653. disBridgeInfo(RactAR,130,"- Reactor Info -",0xCC0000,true)
  654. getInfoTankBridge()
  655. disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  656. -- Start
  657. while true do
  658. upMachines(false)
  659.  
  660. disReactorIC2()
  661. dispAE()
  662. dispTanks()
  663. dispPower()
  664. dispMach()
  665. sleep(1.5)
  666. end
Advertisement
Add Comment
Please, Sign In to add comment