szakal119

Untitled

Apr 2nd, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.91 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奁3�F壟F�83奁3�F壟F�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 = "1.0 new supported machine by Ogrodnik"
  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("top") -- terminal glasses bridge ustaw nad komputerem
  64. local widthBR = 100
  65. local offset2 = 17
  66. bridge.clear()
  67.  
  68. -- Monitory
  69. local powerMon = "monitor_3" -- monitor for display power info
  70. local tankMon = "monitor_0" -- monitor for display tanks
  71. local AEMon = "monitor_1" -- monitor for display AE
  72. local machMon = "monitor_1" -- monitor for display machines
  73. local reactMon = "monitor_4" -- 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_ign_extruder = "IGN.EXRTUDER"
  108. local name_pow_furnance = "POW.FURNANCE"
  109. local name_pulverizer = "PULVERIZER"
  110. local name_sawmill = "SAWMILL"
  111. local name_ind_smel = "IND.SMELTER"
  112. local name_gl_precipitator = "GL.PRECIPITATOR"
  113. local name_magma_crucible = "MAGMA CRUCIBLE"
  114. local name_fl_transposer = "FL.TRANSPOSER"
  115. local name_feed_station = "FEED STATION"
  116. local name_world_anchor = "WORLD ANCHOR"
  117. local name_personal_anchor = "PERSONAL ANCHOR"
  118. local name_coke_oven = "COKE OVEN"
  119. local name_apiary = "APIARY"
  120. local name_rolling_machine = "ROLLING MACHINE"
  121. local name_blast_furnace = "BLAST FURNACE"
  122. local name_steam_oven = "STEAM OVEN"
  123. local name_steam_boiler = "H.STEAM BOILER"
  124.  
  125. -- Kolory
  126. local hc = palette.lightBlue -- domyslny kolor nag奁3�F壟F�85?0奁3�F壟F�奁3�F壟F�83奁3�F壟F�B3wka
  127. local tc = palette.white -- domyslny kolor textu
  128. local color_reading = palette.lime
  129. local color_inactive = palette.gray
  130. local color_active = palette.lime
  131. local color_machines = palette.orange
  132. local color_ores = palette.pink
  133. -- Pozycje tekst奁3�F壟F�83奁3�F壟F�B3w
  134. local pwrX_Reading = 25
  135. local machineDisplayXPos = 14
  136. local offsetPos = 2
  137. local mStatusPos = 28
  138. local orePos = 36
  139. -- SPECIAL CHARACTERS
  140. local separator = " | "
  141. local spacer = " : "
  142. -- Inne ustawienia
  143. local waitTime = {9,13}
  144. local timer = {0,0,0,0,0,0,0,0,0,0,0}
  145. local supported_Power = {"mfsu","mfe","batbox", "redstone_energy_cell"} --brak
  146. 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", "tile_thermalexpansion_machine_rockgen_name", "tile_thermalexpansion_machine_icegen_name", "tile_thermalexpansion_machine_crucible_name", "tile_thermalexpansion_machine_transposer_name", "feed_station", "world_anchor", "personal_anchor", "coke_oven", "apiculture_0", "rolling_machine", "blast_furnace", "steam_oven", "solid_fueled_boiler_firebox"} -- support nowych maszyn
  147. local sleepTime = 3
  148. local numFormat = 1
  149. -- sloty maszyn --
  150. local ic2ItemUsed = 7
  151. local ic2ItemCreated = 1
  152. local gtItemInput = 2
  153. local gtItemInd = 0
  154. local teItemInput = 0
  155. local oreWashItemUsed = 9
  156. local thermCentrItemUsed = 9
  157. -- Load API ---
  158. if fs.exists("enu") then else shell.run("pastebin get Mpk9yubJ enu") end
  159. --api mega proste
  160. os.loadAPI("enu")
  161. ---------------
  162. term.clear()
  163.  
  164. function upMachines(mnitPeri)
  165. term.clear()
  166. term.setCursorPos(1,1)
  167. machines = peripheral.getNames()
  168. table.sort(machines)
  169. if mnitPeri then
  170. for k, v in pairs(machines) do
  171. print(tostring(k)..": "..tostring(v))
  172. end
  173. end
  174. end
  175. function procenty(capa, stor)
  176. if capa and stor ~= 0 then
  177. local proc = 100 / capa * stor
  178. local a = math.floor(proc*1000 + 0.5)/ 1000
  179. tempProc = string.format("%.2f",a)
  180. else
  181. tempProc = 0
  182. end
  183. return tempProc
  184. end
  185. function round(num, idp)
  186. local mult = 10^(idp or 0)
  187. return math.floor(num * mult + 0.5) / mult
  188. end
  189. function round1(num)
  190. local a = math.floor(num*1000 + 0.5)/ 1000
  191. return a,string.format("%.2f",a)
  192. end
  193. function advList(getPeriph) -- lista dostepnych funkcji dla perip.
  194. uused = getPeriph["getAdvancedMethodsData"]()
  195. for key, value in pairs(uused) do
  196. print(value.name)
  197. --sleep(1)
  198. end
  199. end
  200. function writeCenter(text, xWidth)
  201. local xspot = math.floor((xWidth/2)-(string.len(text)*1.4))
  202. return xspot
  203. end
  204. function getInfoTankBridge()
  205. tanksAR={}
  206. for i=1, #machines do
  207. if string.find(machines[i], "rcirontankvalvetile")
  208. or string.find(machines[i], "rcsteeltankvalvetile")
  209. or string.find(machines[i], "openblocks_tank")
  210. or string.find(machines[i], "tile_basicblock_dynamic_valve_name")
  211. or string.find(machines[i], "factory2_1")
  212. or string.find(machines[i], "water_tank") then
  213. if peripheral.isPresent(machines[i]) then
  214. periph = peripheral.wrap(machines[i])
  215. fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)
  216. if fluidName == nil then
  217.  
  218. elseif fluidName ~= nil then
  219. tester = {
  220. {
  221. ["id"] =machines[i],
  222. ["name"] = fluidName,
  223. }
  224. }
  225. table.insert(tanksAR,tester)
  226. end
  227. end
  228. end
  229. end
  230. return tanksAR
  231. end
  232. function disBridgeInfo(array1,posStart,BoxName,colBar,addtext)
  233. offset2 = 18
  234. for i=1, #array1 do
  235. for key,value in pairs(array1[i]) do
  236. value["label"] = bridge.addText(5,5+offset2 + posStart,array1[i][1]["name"],0x33FF33)
  237. value["label"].setScale(0.5)
  238. value["proc"] = bridge.addText(45,5+offset2 + posStart,"FILL: 0.0%",0xC5360F)
  239. value["proc"].setScale(0.5)
  240. if addtext then
  241. value["textadd"] = bridge.addText(10,offset2 + posStart," ",0x33FF33)
  242. value["textadd"].setScale(0.5)
  243. end
  244. value["heatTitle"] = bridge.addText(5,10+offset2 + posStart,"0",0x66FFFF)
  245. value["heatTitle"].setScale(0.8)
  246. value["progressbar"] = bridge.addGradientBox(10,10+offset2 + posStart,100,7,0x000033,0.7,0x66ccff,0.7,1)
  247. value["progressbar"].setZ(10)
  248. -- value["progressbar"].setColor2(0x66CCFF)
  249. -- value["progressbar"].setGradient(1)
  250. value["progressbarmarker"] = bridge.addGradientBox(10,10+offset2 + posStart,1,7,colBar,0.7,0xFFFFFF,0.7,1)
  251. value["progressbarmarker"].setZ(11)
  252. -- value["progressbarmarker"].setGradient(1)
  253. -- value["progressbarmarker"].setColor2(0xFFFFFF)
  254. value["capTitle"] = bridge.addText(26,11+offset2 + posStart," 0/0",0x33FF33)
  255. value["capTitle"].setScale(0.5)
  256. offset2 = offset2 + 18
  257. end
  258. end
  259. boxName = bridge.addBox(2, 2+posStart, 111, offset2, 0x262626, 0.2)
  260. boxName2 = bridge.addText(5,5+posStart,BoxName,0x66CCFF)
  261. boxName2.setScale(0.7)
  262. end
  263. function ClearBridge(array1)
  264. for i=1, #array1 do
  265. -- for key,value in pairs(array1[i]) do
  266. -- value["label"].delete()
  267. -- value["proc"].delete()
  268. -- value["heatTitle"].delete()
  269. -- value["progressbar"].delete()
  270. -- value["progressbarmarker"].delete()
  271. -- value["capTitle"].delete()
  272. array1 = {}
  273. -- end
  274. end
  275. -- boxName.delete()
  276. -- boxName2.delete()
  277. boxName.setOpacity(0)
  278. boxName2.setText(" ")
  279. end
  280. function upBridgeDis(arrayNames,arrayNumber,capa1,stor1,currBOX,colBr,addtext1,newtext)
  281. for i=#arrayNames,1,-1 do
  282. for j=#arrayNames[i],1,-1 do
  283. storage1 = arrayNames[i][j]
  284. if storage1["id"] == arrayNumber then
  285. curStored = widthBR / capa1 * stor1
  286. -- storage1["progressbarmarker"].setColor(0xFFFFFF)
  287. storage1["progressbarmarker"].setWidth(curStored)
  288. if addtext1 then
  289. storage1["textadd"].setText(newtext)
  290. end
  291. curStoredE = round1(curStored)
  292. if curStoredE <= 29 then
  293. storage1["proc"].setColor(0xFF0000)
  294. storage1["proc"].setText("FILL: "..curStoredE.."%")
  295. elseif curStoredE >= 30 and curStoredE <= 79 then
  296. storage1["proc"].setColor(0xFFFF00)
  297. storage1["proc"].setText("FILL: "..curStoredE.."%")
  298. elseif curStoredE >= 80 and curStoredE <= 99 then
  299. storage1["proc"].setColor(0x009900)
  300. storage1["proc"].setText("FILL: "..curStoredE.."%")
  301. elseif curStoredE >= 100 then
  302. storage1["proc"].setColor(0x66CCFF)
  303. storage1["proc"].setText("FULL")
  304. end
  305. disSmalCAP= enu.dot(stor1).."/"..enu.dot(capa1)
  306. storage1["capTitle"].setX(writeCenter(disSmalCAP,100)+11)
  307. storage1["capTitle"].setText(disSmalCAP)
  308. storage1["heatTitle"].setText(tostring(currBOX))
  309. end
  310. end
  311. end
  312. end
  313. function disTankBar(tankProc,monBar,x1PosBar,x2PosBar,yPosBar)
  314. monBar.setCursorPos(x1PosBar,yPosBar)
  315. lengBar = x2PosBar - x1PosBar
  316. widthBar = lengBar / 100 * tankProc
  317. monBar.write("|")
  318. if tankProc <= 29 then
  319. monBar.setBackgroundColor(colors.red)
  320. elseif tankProc >= 30 and tankProc <= 59 then
  321. monBar.setBackgroundColor(colors.orange)
  322. elseif tankProc >= 60 and tankProc <= 79 then
  323. monBar.setBackgroundColor(colors.lime)
  324. elseif tankProc >= 80 and tankProc <= 99 then
  325. monBar.setBackgroundColor(colors.green)
  326. elseif tankProc >= 100 then
  327. monBar.setBackgroundColor(colors.blue)
  328. end
  329.  
  330. for k = x1PosBar, x1PosBar + widthBar do
  331. monBar.write(" ")
  332. end
  333.  
  334. monBar.setBackgroundColor(colors.black)
  335. monBar.setCursorPos(x2PosBar + 2,yPosBar)
  336. monBar.write("|")
  337. end
  338.  
  339. machines = peripheral.getNames()
  340. table.sort(machines)
  341.  
  342. -- MONITOR 1 x,y Pos
  343. local machinesInfoCol = 1
  344.  
  345. -- MONITOR 2 x,y Pos
  346. local tankPosStart = 1
  347.  
  348. -- *** FUNKCJE ***
  349. function pFormat(pName) -- formatowanie nazwy
  350. if string.find(pName, "compressor") then pName = name_comp
  351. elseif string.find(pName, "electric_furnace") then pName = name_furnace
  352. elseif string.find(pName, "extractor") then pName = name_ext
  353. elseif string.find(pName, "macerator") then pName = name_mace
  354. elseif string.find(pName, "canning") then pName = name_canning
  355. elseif string.find(pName, "recycler") then pName = name_recycler
  356. elseif string.find(pName, "former") then pName = name_former
  357. elseif string.find(pName, "orewashing") then pName = name_washer
  358. elseif string.find(pName, "thermalcentrifuge") then pName = name_centrifuge
  359. elseif string.find(pName, "batbox") then pName = name_mfsu
  360. elseif string.find(pName, "cofh_thermalexpansion_energycell") then pName = name_REC
  361. elseif string.find(pName, "tile_thermalexpansion_machine_furnace_name") then pName = name_pow_furnance
  362. elseif string.find(pName, "tile_thermalexpansion_machine_pulverizer_name") then pName = name_pulverizer
  363. elseif string.find(pName, "tile_thermalexpansion_machine_sawmill_name") then pName = name_sawmill
  364. elseif string.find(pName, "tile_thermalexpansion_machine_rockgen_name") then pName = name_ign_extruder
  365. elseif string.find(pName, "tile_thermalexpansion_machine_smelter_name") then pName = name_ind_smel
  366. elseif string.find(pName, "tile_thermalexpansion_machine_icegen_name") then pName = name_gl_precipitator
  367. elseif string.find(pName, "tile_thermalexpansion_machine_crucible_name") then pName = name_magma_crucible
  368. elseif string.find(pName, "tile_thermalexpansion_machine_transposer_name") then pName = name_fl_transposer
  369. elseif string.find(pName, "feed_station") then pName = name_feed_station
  370. elseif string.find(pName, "world_anchor") then pName = name_world_anchor
  371. elseif string.find(pName, "personal_anchor") then pName = name_personal_anchor
  372. elseif string.find(pName, "coke_oven") then pName = name_coke_oven
  373. elseif string.find(pName, "apiculture_0") then pName = name_apiary
  374. elseif string.find(pName, "rolling_machine") then pName = name_rolling_machine
  375. elseif string.find(pName, "blast_furnace") then pName = name_blast_furnace
  376. elseif string.find(pName, "steam_oven") then pName = name_steam_oven
  377. elseif string.find(pName, "solid_fueled_boiler_firebox") then pName = name_steam_boiler
  378. end
  379. return pName
  380. end
  381.  
  382. function disReactorIC2()
  383. mon5.setCursorPos(offsetPos,2)
  384. for i=1, #machines do
  385. -- reactor
  386. if string.find(machines[i], "nuclear_reactor") then
  387. NRperiph = peripheral.wrap(machines[i])
  388. local heatNR = NRperiph["getHeat"]()
  389. local heatMaxNR = NRperiph["getMaxHeat"]()
  390. local euOutputNR = NRperiph["getEUOutput"]()*5
  391. local ActiveNR = NRperiph["isActive"]()
  392. local procHeat = procenty(heatMaxNR,heatNR)
  393. -- advList(NRperiph)
  394. if ActiveNR then powNR = 1 else powNR = 0 end
  395.  
  396. upBridgeDis(RactAR,6,heatMaxNR,heatNR,powNR,0x990099,true, "EU Output: "..euOutputNR)
  397. enu.appendString(reactMon, tc, " Is Active " .. separator, true, offsetPos, 4)
  398. enu.appendString(reactMon, color_reading, ActiveNR, false, pwrX_Reading, 4)
  399. enu.appendString(reactMon, tc, " Reactor Heat " .. separator, true, offsetPos, 5)
  400. enu.appendString(reactMon, color_reading, (enu.dot(heatNR)), false, pwrX_Reading, 5)
  401.  
  402. enu.appendString(reactMon, tc, " Max Reactor Heat " .. separator, true, offsetPos,6)
  403. enu.appendString(reactMon, color_reading, (enu.dot(heatMaxNR)), false, pwrX_Reading,6)
  404.  
  405. enu.appendString(reactMon, tc, " EU Output " .. separator, true, offsetPos,8)
  406. enu.appendString(reactMon, color_reading, (enu.dot(euOutputNR)), false, pwrX_Reading,8)
  407.  
  408. enu.appendString(reactMon, tc, " Proc Heat " .. separator, true, offsetPos, 10)
  409. enu.appendString(reactMon, color_reading, procHeat.."%", false, pwrX_Reading, 10)
  410. disTankBar(tonumber(procHeat),mon5,2,35,11)
  411. end
  412. end
  413. end
  414.  
  415. function dispAE()
  416. mon3.setCursorPos(offsetPos,2)
  417. local AEy = 14
  418. for j=1, #machines do
  419. -- AE
  420. if string.find(machines[j], "appeng_me_tilecontroller") then
  421. AEperiph = peripheral.wrap(machines[j])
  422.  
  423. local storedAE = AEperiph["getUnusedBytes"]()
  424. local capacityAE = AEperiph["getTotalBytes"]()
  425. local itemCountAE = AEperiph["getStoredItemCount"]()
  426. local itemSTypeAE = AEperiph["getStoredItemTypes"]()
  427. local itemTTypeAE = AEperiph["getTotalItemTypes"]()
  428.  
  429. local aeJobs = AEperiph["getJobList"]()
  430. upBridgeDis(AEs,4,capacityAE,storedAE,1,0x330000,true," Items: "..enu.dot(itemCountAE))
  431. enu.appendString(AEMon, tc, " Memory Stored " .. separator, true, offsetPos, 3)
  432. enu.appendString(AEMon, color_reading, (enu.dot(storedAE)), false, pwrX_Reading, 3)
  433. enu.appendString(AEMon, tc, " Memory State " .. separator, true, offsetPos, 4)
  434. enu.appendString(AEMon, color_reading, procenty(capacityAE,storedAE).."%", false, pwrX_Reading, 4)
  435. enu.appendString(AEMon, tc, " Memory Capacity " .. separator, true, offsetPos, 5)
  436. enu.appendString(AEMon, color_reading, (enu.dot(capacityAE)), false, pwrX_Reading,5 )
  437.  
  438. enu.appendString(AEMon, tc, " Items " .. separator, true, offsetPos, 7)
  439. enu.appendString(AEMon, color_reading, (enu.dot(itemCountAE)), false, pwrX_Reading,7 )
  440.  
  441. upBridgeDis(AEs,5,itemTTypeAE,itemSTypeAE,1,0x330000,false)
  442. enu.appendString(AEMon, tc, " Stored Types " .. separator, true, offsetPos, 9)
  443. enu.appendString(AEMon, color_reading, (enu.dot(itemSTypeAE)), false, pwrX_Reading,9 )
  444. enu.appendString(AEMon, tc, " Stored Types State " .. separator, true, offsetPos, 10)
  445. enu.appendString(AEMon, color_reading, procenty(itemTTypeAE,itemSTypeAE).."%", false, pwrX_Reading,10)
  446. enu.appendString(AEMon, tc, " Total Types " .. separator, true, offsetPos, 11)
  447. enu.appendString(AEMon, color_reading, (enu.dot(itemTTypeAE)), false, pwrX_Reading,11)
  448.  
  449. enu.appendString(AEMon, tc, " Currently Crafting:" .. separator, true, offsetPos, 13)
  450. for key, value in pairs(aeJobs) do
  451. enu.appendString(AEMon, palette.lightBlue,tostring(value.qty), false, 4,AEy )
  452. enu.appendString(AEMon, palette.lightBlue,"- "..value.name, false,12 ,AEy )
  453. AEy = AEy +1
  454. end
  455. end
  456. end
  457. for i=1,10,1 do
  458. mon3.setCursorPos(1,AEy)
  459. mon3.clearLine()
  460. AEy = AEy + 1
  461. end
  462. end
  463.  
  464. function dispTanks()
  465. mon2.setCursorPos(offsetPos,2)
  466. ClearBridge(tanksAR)
  467. getInfoTankBridge()
  468. disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  469. for i=1, #machines do
  470. -- Tanks
  471. if string.find(machines[i], "rcirontankvalvetile")
  472. or string.find(machines[i], "rcsteeltankvalvetile")
  473. or string.find(machines[i], "openblocks_tank")
  474. or string.find(machines[i], "tile_basicblock_dynamic_valve_name")
  475. or string.find(machines[i], "factory2_1")
  476. or string.find(machines[i], "water_tank") then
  477. -- print(machines[i])
  478. if peripheral.isPresent(machines[i]) then
  479. periph = peripheral.wrap(machines[i])
  480.  
  481. fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)
  482.  
  483.  
  484. if fluidName == nil then
  485. -- brak fluidu nie wyswietli tanka
  486. elseif fluidName ~= nil then
  487.  
  488. mon2.setTextColor(tc)
  489. tankProc1 = procenty(fluidCapacity,fluidAmount)
  490. x,y = mon2.getCursorPos()
  491. mon2.setCursorPos(offsetPos, (y+1))
  492. mon2.clearLine()
  493. -- mon2.write(" (" .. fluidName .. ") : " ..enu.dot(fluidAmount) .. " / " ..enu.dot(fluidCapacity) .. " mb (" ..procenty(fluidCapacity,fluidAmount).."%)"))
  494. mon2.write(" (" .. fluidName .. ") : (" ..tankProc1.."%)")
  495. disTankBar(tonumber(tankProc1),mon2,28,58,(y+1))
  496. mon2.setCursorPos(offsetPos, (y+2))
  497.  
  498. upBridgeDis(tanksAR,machines[i],fluidCapacity,fluidAmount,"T",0xCC0000,false)
  499. end
  500. end
  501. end
  502. end
  503.  
  504. x,y = mon2.getCursorPos()
  505. for i=1,10,1 do
  506. y = y + 1
  507. mon2.setCursorPos(1,y)
  508. mon2.clearLine()
  509. end
  510. loaded = true
  511.  
  512. end
  513.  
  514. function dispPower()
  515. local EUProc = 0
  516. local RFProc = 0
  517. local MJProc = 0
  518. local couMJM = 0
  519. local couRFM = 0
  520. local couEUM = 0
  521. local totalStorage = 0
  522. local totalCapacity = 0
  523. local totalStoredRF = 0
  524. local totalCapacityRF = 0
  525. local totalStoredMJ = 0
  526. local totalCapacityMJ = 0
  527.  
  528. for i=1, #machines do
  529. 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
  530. periphEU = peripheral.wrap(machines[i])
  531. if peripheral.isPresent(machines[i]) then
  532. local storedEU = periphEU.getEUStored()
  533. local capacity = periphEU.getEUCapacity()
  534. if storedEU <= 100 then
  535. print(machines[i])
  536. end
  537. totalStorage = totalStorage + storedEU
  538. totalStorage = math.floor(totalStorage)
  539. totalCapacity = capacity + totalCapacity
  540. EUProc = procenty(totalCapacity,totalStorage)
  541. couEUM = couEUM + 1
  542. end
  543. end
  544. if string.find(machines[i], "cofh_thermalexpansion_energycell") then -- TE Power
  545. periphRF = peripheral.wrap(machines[i])
  546. if peripheral.isPresent(machines[i]) then
  547. local storedRF = periphRF.getEnergyStored("all")
  548. local capacityRF = periphRF.getMaxEnergyStored("all")
  549. if storedRF<= 100 then
  550. print(machines[i])
  551. end
  552.  
  553. totalStoredRF = storedRF + totalStoredRF
  554. totalStoredRF = math.floor(totalStoredRF)
  555. totalCapacityRF = capacityRF + totalCapacityRF
  556. RFProc = procenty(totalCapacityRF,totalStoredRF)
  557. couRFM = couRFM +1
  558. end
  559.  
  560. end
  561. if string.find(machines[i], "blockcapacitorbank") then
  562. periphMJ = peripheral.wrap(machines[i])
  563. if peripheral.isPresent(machines[i]) then
  564. local storedMJ = periphMJ.getMJStored("all")
  565. local capacityMJ = periphMJ.getMaxEnergyStored("all")
  566. local maxMJInput = periphMJ.getMaxMJReceived("all")
  567. local MJ = periphMJ.getActivationEnergy("all")
  568. if storedMJ <= 100 then
  569. print(machines[i])
  570. end
  571. totalStoredMJ = storedMJ + totalStoredMJ
  572. totalStoredMJ = math.floor(totalStoredMJ)
  573. totalCapacityMJ = capacityMJ + totalCapacityMJ
  574. MJProc = procenty(totalCapacityMJ,totalStoredMJ)
  575. couMJM = couMJM +1
  576. end
  577. end
  578. end
  579. upBridgeDis(energ,1,totalCapacity,totalStorage,couEUM,0x3366FF,false)
  580. enu.appendString(powerMon, palette.lime, " * EU - "..EUProc.."%" , true, offsetPos, 3)
  581. disTankBar(tonumber(EUProc),mon,23,37,3)
  582. enu.appendString(powerMon, tc, " Stored EU " .. separator, true, offsetPos, 5)
  583. enu.appendString(powerMon, color_reading, (enu.dot(totalStorage)), false, pwrX_Reading, 5)
  584. enu.appendString(powerMon, tc, " Total EU Capacity " .. separator, true, offsetPos, 6)
  585. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacity)), false, pwrX_Reading,6 )
  586. enu.appendString(powerMon, tc, " Number of box " .. separator, true, offsetPos, 7)
  587. enu.appendString(powerMon, color_reading, (enu.dot(couEUM)), false, pwrX_Reading, 7)
  588. -- RF
  589. upBridgeDis(energ,2,totalCapacityRF,totalStoredRF,couRFM,0x3366FF,false)
  590. enu.appendString(powerMon, palette.lime, " * RF - "..RFProc.."%", true, offsetPos, 9)
  591. disTankBar(tonumber(RFProc),mon,23,37,9)
  592. enu.appendString(powerMon, tc, " Stored RF " .. separator, true, offsetPos, 11)
  593. enu.appendString(powerMon, color_reading, (enu.dot(totalStoredRF)), false, pwrX_Reading, 11)
  594. enu.appendString(powerMon, tc, " Total RF Capacity " .. separator, true, offsetPos, 12)
  595. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityRF)), false, pwrX_Reading, 12)
  596. enu.appendString(powerMon, tc, " Energy Cells " .. separator, true, offsetPos, 13)
  597. enu.appendString(powerMon, color_reading, (enu.dot(couRFM)), false, pwrX_Reading, 13)
  598. -- MJ
  599. upBridgeDis(energ,3,totalCapacityMJ,totalStoredMJ,couMJM,0x3366FF,false)
  600. enu.appendString(powerMon, palette.lime, " * MJ - "..MJProc.."%", true, offsetPos, 15)
  601. disTankBar(tonumber(MJProc),mon,23,37,15)
  602. enu.appendString(powerMon, tc, " Stored MJ " .. separator, true, offsetPos, 17)
  603. enu.appendString(powerMon, color_reading, (enu.dot(totalStoredMJ)), false, pwrX_Reading, 17)
  604. enu.appendString(powerMon, tc, " Total MJ Capacity " .. separator, true, offsetPos, 18)
  605. enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityMJ)), false, pwrX_Reading, 18)
  606. enu.appendString(powerMon, tc, " Capacitor Banks " .. separator, true, offsetPos, 19)
  607. enu.appendString(powerMon, color_reading, (enu.dot(couMJM)), false, pwrX_Reading, 19)
  608. end
  609.  
  610. function dispMach()
  611. machineDispStart = 2 -- machineDisplayXPos
  612. for i=1, #machines do
  613. local m
  614. for m=1, #supported_Machines do
  615. if string.find(machines[i], supported_Machines[m]) then
  616. periphM = peripheral.wrap(machines[i])
  617. if peripheral.isPresent(machines[i]) then
  618. if string.find(machines[i], "thermalcentrifuge") then
  619. itemStackUsed = periphM.getStackInSlot(thermCentrItemUsed)
  620. energyTEProc = 150
  621. elseif string.find(machines[i], "orewashing") then
  622. itemStackUsed = periphM.getStackInSlot(oreWashItemUsed)
  623. energyTEProc = 150
  624. 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_icegen_name") or string.find(machines[i], "tile_thermalexpansion_machine_sawmill_name") or string.find(machines[i], "tile_thermalexpansion_machine_smelter_name") or string.find(machines[i], "tile_thermalexpansion_machine_crucible_name") or string.find(machines[i], "tile_thermalexpansion_machine_transposer_name") then
  625. itemStackUsed = periphM.getStackInSlot(1)
  626. EnergyTE = periphM["getEnergy"]()
  627. EnergyMaxTE = periphM["getMaxEnergyStored"]("all")
  628. energyTEProc = procenty(EnergyMaxTE,EnergyTE)
  629. --print(energyTEProc)
  630. elseif string.find(machines[i], "tile_thermalexpansion_machine_rockgen_name") or string.find(machines[i], "feed_station") or string.find(machines[i], "world_anchor") or string.find(machines[i], "personal_anchor") or string.find(machines[i], "coke_oven") or string.find(machines[i], "blast_furnace") or string.find(machines[i], "steam_oven") then
  631. itemStackUsed = periphM.getStackInSlot(1)
  632. energyTEProc = 150
  633. elseif string.find(machines[i], "apiculture_0") then
  634. itemStackUsed = periphM.getStackInSlot(1)
  635. energyTEProc = 150
  636. elseif string.find(machines[i], "solid_fueled_boiler_firebox") then
  637. itemStackUsed = periphM.getStackInSlot(3)
  638. energyTEProc = 150
  639. elseif string.find(machines[i], "rolling_machine") then
  640. itemStackUsed = periphM.getStackInSlot(10)
  641. energyTEProc = 150
  642. 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
  643. itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)
  644. energyTEProc = 150
  645. else
  646. itemStackUsed = periphM.getStackInSlot(ic2ItemUsed)
  647. energyTEProc = 150
  648. end
  649. if tonumber(energyTEProc) <= 3 then
  650. powACT = "NO ENERGY"
  651. colM = palette.red
  652. elseif tonumber(energyTEProc) >= 2 and tonumber(energyTEProc) < 120 then
  653. powACT = " POWERED"
  654. colM = palette.yellow
  655. elseif tonumber(energyTEProc) == 150 then
  656. powACT = " N/A"
  657. colM = color_inactive
  658. end
  659.  
  660. machineDispStart = machineDispStart + 1
  661. if itemStackUsed ~= nil then
  662. itemName = enu.itemRename(itemStackUsed.name)
  663. -- timer[2] = os.clock()
  664. enu.appendString(machMon, color_ores, itemName, true, orePos, machineDispStart)
  665. str = (pFormat(peripheral.getType(machines[i])))
  666. enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  667. enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  668. enu.appendString(machMon, color_active, activeMsg, false, mStatusPos, machineDispStart)
  669.  
  670. elseif itemStackUsed == nil then
  671. enu.appendString(machMon, color_inactive, inactiveMsg, true, mStatusPos, machineDispStart)
  672. str = (pFormat(peripheral.getType(machines[i])))
  673. enu.appendString(machMon, colM, powACT, false, 17, machineDispStart)
  674. enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
  675. else
  676.  
  677. end
  678. end
  679. end
  680. end
  681. end
  682. for i=1,10,1 do
  683. machineDispStart = machineDispStart + 1
  684. mon4.setCursorPos(1,machineDispStart)
  685. mon4.clearLine()
  686. end
  687. end
  688. enu.cString(offsetPos, 1, hc, tankMon, "-- TANK INFO --")
  689. enu.cString(offsetPos, 1, hc, AEMon, "-- AE INFO --")
  690. enu.cString(offsetPos, 1, hc, powerMon, "-- POWER INFO--")
  691. enu.cString(offsetPos, machinesInfoCol, hc, machMon, "-- MACHINES INFO --")
  692. enu.cString(offsetPos, 1, hc, reactMon, "-- Reactor INFO --")
  693.  
  694. disBridgeInfo(energ,0,"- Power Info -",0xCC0000,false)
  695. disBridgeInfo(AEs,74,"- AE Info -",0xCC0000,true)
  696. disBridgeInfo(RactAR,130,"- Reactor Info -",0xCC0000,true)
  697. getInfoTankBridge()
  698. disBridgeInfo(tanksAR,168,"- Tank Info -",0xCC0000,false)
  699. --ScrollBar
  700.  
  701.  
  702.  
  703.  
  704. -- Start
  705. while true do
  706.  
  707. strtpos = 12 --Start position on screen
  708. speed = 0.2 --Scroll Speed (Seconds)
  709.  
  710. pos = strtpos
  711. poslimit = 0 - strtpos
  712.  
  713. while true do
  714. mon4.clear()
  715. mon4.setCursorPos(pos, 1)
  716. mon4.write(text)
  717. sleep(speed)
  718. if pos == poslimit then
  719. pos = strtpos
  720. else
  721. pos = pos - 1
  722. end
  723. end
  724. upMachines(false)
  725.  
  726. disReactorIC2()
  727. dispAE()
  728. dispTanks()
  729. dispPower()
  730. dispMach()
  731. sleep(1.5)
  732.  
  733. end
  734. end
Advertisement
Add Comment
Please, Sign In to add comment