Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- supported: macerator,electric furnace,extractor,compressor,
- -- supported: plate bending machine,assembling machine,industrial grinder,industrial blast furnace
- -- supported: recycler,powered furnace,pulverizer,sawmill, induction smelter
- -- supported: batbox,mfe,cesu,mfsu,capacitor bank
- -- supported: RC tanks, OpenBlocks tanks(W.I.P.)
- -- supported: me controller
- -- bitowa paleta kolorow.
- local palette = {["white"] = 1, ["orange"] = 2, ["magenta"] = 4, ["lightBlue"] = 8, ["yellow"] = 16,
- ["lime"] = 32, ["pink"] = 64, ["gray"] = 128, ["lightGray"] = 256, ["cyan"] = 512, ["purple"] = 1024,
- ["blue"] = 2048, ["brown"] = 4096, ["green"] = 8192, ["red"] = 16384, ["black"] = 32768}
- -- *** CONFIG **
- -- zmienne
- local version = "0.5.5"
- local activeMsg, inactiveMsg, pendingMsg = "USING", "IDLE", "PENDI"
- local textSize = 1
- local name_mfsu = "BatBox"
- -- Monitory
- local powerMon = "monitor_9" -- pierwszy monitor "ENERGIA i MASZYNY"
- local tankMon = "monitor_8" -- drugi monitor "Tanki RC"
- local AEMon = "monitor_10" -- monitor AE
- local machMon = "monitor_11"
- local mon = peripheral.wrap(powerMon)
- local mon2 = peripheral.wrap(tankMon)
- local mon3 = peripheral.wrap(AEMon)
- local mon4 = peripheral.wrap(machMon)
- mon.clear()
- mon2.clear()
- mon3.clear()
- mon4.clear()
- mon.setTextScale(textSize)
- mon2.setTextScale(textSize)
- mon3.setTextScale(textSize)
- mon4.setTextScale(textSize)
- -- Maszyny --
- -- IC2
- local name_comp = "COMPRESSOR"
- local name_furnace = "E.FURNACE"
- local name_ext = "EXTRCTOR"
- local name_mace = "MACERTOR"
- local name_recycler = "RECYCLR"
- local name_canning = "CAN_MCHINE"
- -- GT
- local name_pbm = "PLATE BEND.M."
- local name_asseM = "ASSEMBL M."
- local name_ind_grin = "IND.GRINDER"
- local name_ind_BF = "BLAST.FURN."
- -- TE
- local name_REC = "R.E.C."
- local name_pow_furnance = "POW.FURNANCE"
- local name_pulverizer = "PULVERIZER"
- local name_sawmill = "SAWMILL"
- local name_ind_smel = "IND.SMELTER"
- -- Kolory
- local hc = palette.lightBlue -- domyslny kolor nag��wka
- local tc = palette.white -- domyslny kolor textu
- local color_reading = palette.lime
- local color_inactive = palette.gray
- local color_active = palette.lime
- local color_machines = palette.orange
- local color_ores = palette.pink
- -- Pozycje tekst�w
- local pwrX_Reading = 25
- local machineDisplayXPos = 14
- local offsetPos = 2
- local mStatusPos = 18
- local orePos = 26
- -- SPECIAL CHARACTERS
- local separator = " | "
- local spacer = " : "
- -- Inne ustawienia
- local waitTime = {9,13}
- local timer = {0,0,0,0,0,0,0,0,0,0,0}
- local supported_Power = {"mfsu","mfe","batbox", "redstone_energy_cell"}
- local supported_Machines = {"automatic_macerator","electric_furnace", "automatic_extractor", "automatic_compressor", "plate_bending_machine", "assembling_machine", "industrial_grinder", "industrial_blast_furnace", "canning", "recycler", "powered_furnace", "pulverizer", "sawmill", "induction_smelter"}
- local sleepTime = 2
- local numFormat = 1
- -- sloty maszyn --
- local ic2ItemUsed = 6
- local ic2ItemCreated = 1
- local gtItemInput = 2
- local gtItemInd = 0
- local teItemInput = 0
- -- Load API ---
- if fs.exists("enu") then else shell.run("pastebin get AyU03Gk8 enu") end
- os.loadAPI("enu")
- ---------------
- term.clear()
- function upMachines(mnitPeri)
- term.clear()
- term.setCursorPos(1,1)
- machines = peripheral.getNames()
- table.sort(machines)
- if mnitPeri then
- for k, v in pairs(machines) do
- print(tostring(k)..": "..tostring(v))
- end
- end
- end
- function procenty(capa, stor)
- if capa and stor ~= 0 then
- local proc = 100 / capa * stor
- local a = math.floor(proc*1000 + 0.5)/ 1000
- tempProc = string.format("%.2f",a)
- else
- tempProc = 0
- end
- return tempProc
- end
- function advList(getPeriph) -- lista dostepnych funkcji dla perip.
- uused = getPeriph["getAdvancedMethodsData"]()
- for key, value in pairs(uused) do
- print(value.name)
- sleep(1)
- end
- end
- machines = peripheral.getNames()
- table.sort(machines)
- -- MONITOR 1 x,y Pos
- local machinesInfoCol = 1
- -- MONITOR 2 x,y Pos
- local tankPosStart = 1
- -- *** FUNKCJE ***
- function pFormat(pName) -- formatowanie nazwy
- if string.find(pName, "automatic_compressor") then pName = name_comp
- elseif string.find(pName, "electric_furnace") then pName = name_furnace
- elseif string.find(pName, "automatic_extractor") then pName = name_ext
- elseif string.find(pName, "automatic_macerator") then pName = name_mace
- elseif string.find(pName, "canning") then pName = name_canning
- elseif string.find(pName, "recycler") then pName = name_recycler
- elseif string.find(pName, "former") then pName = name_former
- elseif string.find(pName, "batbox") then pName = name_mfsu
- elseif string.find(pName, "redstone_energy_cell") then pName = name_REC
- elseif string.find(pName, "powered_furnace") then pName = name_pow_furnance
- elseif string.find(pName, "pulverizer") then pName = name_pulverizer
- elseif string.find(pName, "sawmill") then pName = name_sawmill
- elseif string.find(pName, "induction_smelter") then pName = name_ind_smel
- elseif string.find(pName, "plate_bending_machine") then pName = name_pbm
- elseif string.find(pName, "assembling_machine") then pName = name_asseM
- elseif string.find(pName, "industrial_grinder") then pName = name_ind_grin
- elseif string.find(pName, "industrial_blast_furnace") then pName = name_ind_BF
- end
- return pName
- end
- function dispAE()
- mon3.setCursorPos(offsetPos,2)
- for j=1, #machines do
- -- AE
- AEperiph = peripheral.wrap(machines[j])
- if string.find(machines[j], "me_controller") then
- local AEener = AEperiph.provideCellWithFilter("STORED") -- All, STORED
- local storedAE = AEener.usedBytes
- local capacityAE = AEener.totalBytes
- local itemCountAE = AEener.storedItemCount
- local itemSTypeAE = AEener.storedItemTypes
- local itemTTypeAE = AEener.totalItemTypes
- --print(AEperiph)
- enu.appendString(AEMon, tc, " Memory Stored " .. separator, true, offsetPos, 3)
- enu.appendString(AEMon, color_reading, (enu.dot(storedAE)), false, pwrX_Reading, 3)
- enu.appendString(AEMon, tc, " Memory State " .. separator, true, offsetPos, 5)
- enu.appendString(AEMon, palette.cyan, procenty(capacityAE,storedAE).."%", false, pwrX_Reading, 5)
- enu.appendString(AEMon, tc, " Memory Capacity " .. separator, true, offsetPos, 4)
- enu.appendString(AEMon, color_reading, (enu.dot(capacityAE)), false, pwrX_Reading,4 )
- enu.appendString(AEMon, tc, " Items " .. separator, true, offsetPos, 7)
- enu.appendString(AEMon, color_reading, (enu.dot(itemCountAE)), false, pwrX_Reading,7 )
- enu.appendString(AEMon, tc, " Stored Types " .. separator, true, offsetPos, 9)
- enu.appendString(AEMon, color_reading, (enu.dot(itemSTypeAE)), false, pwrX_Reading,9 )
- enu.appendString(AEMon, tc, " Stored Types State " .. separator, true, offsetPos, 11)
- enu.appendString(AEMon, palette.cyan, procenty(itemTTypeAE,itemSTypeAE).."%", false, pwrX_Reading,11)
- enu.appendString(AEMon, tc, " Total Types " .. separator, true, offsetPos, 10)
- enu.appendString(AEMon, color_reading, (enu.dot(itemTTypeAE)), false, pwrX_Reading,10)
- end
- end
- end
- function dispTanks()
- mon2.setCursorPos(offsetPos,2)
- for i=1, #machines do
- -- RC Tanks
- if string.find(machines[i], "iron_tank_valve") or string.find(machines[i], "steel_tank_valve") or string.find(machines[i], "tank") then
- -- print(machines[i])
- if peripheral.isPresent(machines[i]) then
- periph = peripheral.wrap(machines[i])
- fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = enu.getTank(periph)
- if fluidName == nil then
- -- brak fluidu nie wyswietli tanka
- elseif fluidName ~= nil then
- mon2.setTextColor(tc)
- x,y = mon2.getCursorPos()
- mon2.setCursorPos(offsetPos, (y+1))
- mon2.clearLine()
- mon2.write(" (" .. fluidName .. ") : " ..enu.dot(fluidAmount) .. " / " ..enu.dot(fluidCapacity) .. " mb (" ..procenty(fluidCapacity,fluidAmount).."%)")
- end
- end
- end
- end
- end
- function dispPower()
- local couMJM = 0
- local couEUM = 0
- local totalStorage = 0
- local totalCapacity = 0
- local totalStoredMJ = 0
- local totalCapacityMJ = 0
- for i=1, #machines do
- if string.find(machines[i], "batbox") then -- IC2 Power
- periph = peripheral.wrap(machines[i])
- local storedEU = periph.getStored()
- local capacity = periph.getCapacity()
- totalStorage = totalStorage + storedEU
- totalCapacity = capacity + totalCapacity
- couEUM = couEUM + 1
- end
- if string.find(machines[i], "redstone_energy_cell") or string.find(machines[i], "capacitor_bank") then -- TE Power
- periph = peripheral.wrap(machines[i])
- local storedMJ = periph.getEnergyStored()
- local capacityMJ = periph.getMaxEnergyStored()
- totalStoredMJ = storedMJ + totalStoredMJ
- totalStoredMJ = math.floor(totalStoredMJ)
- totalCapacityMJ = capacityMJ + totalCapacityMJ
- couMJM = couMJM +1
- end
- end
- -- EU
- enu.cString(offsetPos, 3, palette.lime, powerMon, " * EU - "..procenty(totalCapacity,totalStorage).."%")
- enu.appendString(powerMon, tc, " Stored EU " .. separator, true, offsetPos, 4)
- enu.appendString(powerMon, color_reading, (enu.dot(totalStorage)), false, pwrX_Reading, 4)
- enu.appendString(powerMon, tc, " Total EU Capacity " .. separator, true, offsetPos, 5)
- enu.appendString(powerMon, color_reading, (enu.dot(totalCapacity)), false, pwrX_Reading,5 )
- enu.appendString(powerMon, tc, " Liczba Box " .. separator, true, offsetPos, 6)
- enu.appendString(powerMon, color_reading, (enu.dot(couEUM)), false, pwrX_Reading, 6)
- -- MJ
- enu.cString(offsetPos, 8, palette.lime, powerMon, " * MJ - "..procenty(totalCapacityMJ,totalStoredMJ).."%")
- enu.appendString(powerMon, tc, " Stored MJ " .. separator, true, offsetPos, 9)
- enu.appendString(powerMon, color_reading, enu.dot(totalStoredMJ), false, pwrX_Reading, 9)
- enu.appendString(powerMon, tc, " Total MJ Capacity " .. separator, true, offsetPos, 10)
- enu.appendString(powerMon, color_reading, (enu.dot(totalCapacityMJ)), false, pwrX_Reading, 10)
- enu.appendString(powerMon, tc, " Liczba E.C & C.B " .. separator, true, offsetPos, 11)
- enu.appendString(powerMon, color_reading, (enu.dot(couMJM)), false, pwrX_Reading, 11)
- end
- function dispMach()
- machineDispStart = 2 -- machineDisplayXPos
- for i=1, #machines do
- local m
- for m=1, #supported_Machines do
- if string.find(machines[i], supported_Machines[m]) then
- periph = peripheral.wrap(machines[i])
- if string.find(machines[i], "powered_furnace") or string.find(machines[i], "pulverizer") or string.find(machines[i], "sawmill") or string.find(machines[i], "induction_smelter") then
- itemStackUsed = periph.getStackInSlot(teItemInput)
- elseif string.find(machines[i], "automatic_macerator") or string.find(machines[i], "automatic_compressor") or string.find(machines[i], "automatic_extractor") or string.find(machines[i], "plate_bending_machine") or string.find(machines[i], "assembling_machine") then
- itemStackUsed = periph.getStackInSlot(gtItemInput)
- elseif string.find(machines[i], "industrial_grinder") or string.find(machines[i], "industrial_blast_furnace")then
- itemStackUsed = periph.getStackInSlot(gtItemInd)
- else
- itemStackUsed = periph.getStackInSlot(ic2ItemUsed)
- end
- machineDispStart = machineDispStart + 1
- if itemStackUsed ~= nil then
- itemName = enu.itemRename(itemStackUsed.name)
- -- timer[2] = os.clock()
- enu.appendString(machMon, color_ores, itemName, true, orePos, machineDispStart)
- str = (pFormat(peripheral.getType(machines[i])))
- enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
- enu.appendString(machMon, color_active, activeMsg, false, mStatusPos, machineDispStart)
- elseif itemStackUsed == nil then
- enu.appendString(machMon, color_inactive, inactiveMsg, true, mStatusPos, machineDispStart)
- str = (pFormat(peripheral.getType(machines[i])))
- enu.appendString(machMon, tc, str, false, offsetPos, machineDispStart)
- else
- end
- end
- end
- end
- end
- enu.cString(offsetPos, 1, hc, tankMon, "-- RailCraft Tank Info --")
- enu.cString(offsetPos, 1, hc, AEMon, "-- AE INFO --")
- enu.cString(offsetPos, 1, hc, powerMon, "-- POWER INFO--")
- -- Start
- while true do
- mon4.clear()
- enu.cString(offsetPos, machinesInfoCol, hc, machMon, "-- MASZYNY INFO --")
- upMachines(false)
- dispAE()
- dispTanks()
- dispPower()
- dispMach()
- sleep(sleepTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment