Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bridge = peripheral.find("me_bridge") or peripheral.find("meBridge")
- local monitor = peripheral.find("monitor")
- if not bridge then error("ME Bridge not found!") end
- if not monitor then monitor = term end
- local w, h = monitor.getSize()
- local canvas = window.create(monitor, 1, 1, w, h)
- -- CONFIGURATION
- -- Size of External storage
- local EXTERNAL_ITEM_GOAL = 782336
- local REACTOR_FUEL_NAME = "alltheores:uranium_ingot"
- local WATCHLIST = {
- { name = "minecraft:coal", label = "Coal" },
- { name = "ae2:certus_quartz_crystal", label = "Certus Crystal"},
- { name = "mysticalagriculture:certus_quartz_essence", label = "Certus Essence"},
- { name = "ae2:fluix_crystal", label = "Fluix Crystal" },
- { name = "mysticalagriculture:fluix_essence", label= "Fluix Essence" },
- { name = "mekanism:ingot_refined_obsidian", label = "Refined Obsidian" },
- { name = "mysticalagriculture:refined_obsidian_essence", label = "Refined Obsidian Essence" },
- { name = "create:veridium", label = "Veridium" },
- { name = "mysticalagriculture:stone_essence", label = "Stone Essence" },
- { name = "mysticalagriculture:copper_essence", label = "Copper Essence" },
- }
- -- Required for your Uranium tracking
- local function getCount(itemName)
- local item = bridge.getItem({name = itemName})
- if item then
- -- 1.21.1 uses .count, older versions use .amount
- return item.count or item.amount or 0
- end
- return 0
- end
- local function safe(n1, n2)
- local func = bridge[n1] or bridge[n2]
- if func then return func() end
- return 0
- end
- local function drawBar(y, label, current, max, color)
- max = math.max(1, max or 1)
- local barWidth = w - 14
- local percent = math.max(0, math.min(1, current / max))
- local filled = math.floor(percent * barWidth)
- canvas.setCursorPos(2, y)
- canvas.setTextColor(colors.white)
- canvas.write(label)
- canvas.setCursorPos(10, y)
- canvas.setBackgroundColor(colors.gray)
- canvas.write(string.rep(" ", barWidth))
- canvas.setCursorPos(10, y)
- canvas.setBackgroundColor(color)
- canvas.write(string.rep(" ", filled))
- canvas.setBackgroundColor(colors.black)
- canvas.setCursorPos(w - 3, y)
- canvas.setTextColor(colors.yellow)
- canvas.write(math.floor(percent * 100) .. "%")
- end
- while true do
- term.redirect(canvas)
- canvas.setBackgroundColor(colors.black)
- canvas.clear()
- -- Main Stats
- local energy = safe("getStoredEnergy", "getEnergyStorage")
- local maxEnergy = safe("getEnergyCapacity", "getMaxEnergyStorage")
- local usedInt = safe("getUsedItemStorage", "getUsedItemDiskStorage")
- local totalInt = safe("getTotalItemStorage", "getMaxItemDiskStorage")
- -- Item Tracking
- local uraniumCount = getCount(REACTOR_FUEL_NAME)
- -- External Storage Logic
- local usedExt = safe("getUsedExternalItemStorage", "getUsedExternItemStorage")
- local reportedMax = safe("getMaxItemExternalStorage", "getTotalExternItemStorage")
- -- Force-Fix for External Bar
- local displayMaxExt = reportedMax
- if reportedMax <= usedExt or reportedMax == 0 then
- displayMaxExt = EXTERNAL_ITEM_GOAL
- end
- -- Header
- canvas.setTextColor(colors.cyan)
- canvas.setCursorPos(math.floor(w/2) - 8, 1)
- canvas.write("AE2 NETWORK DASHBOARD")
- -- Bars
- drawBar(3, "POWER ", energy, maxEnergy, colors.green)
- drawBar(5, "DRIVES", usedInt, totalInt, colors.blue)
- drawBar(7, "EXTERN", usedExt, displayMaxExt, colors.orange)
- -- Fuel Info
- canvas.setCursorPos(2, 9)
- canvas.setTextColor(colors.yellow)
- canvas.write("== REACTOR FUEL ==")
- canvas.setCursorPos(2, 10)
- canvas.setTextColor(uraniumCount < 1000 and colors.red or colors.white)
- canvas.write("Uranium: " .. uraniumCount)
- -- Watchlist Info
- canvas.setCursorPos(2, 12)
- canvas.setTextColor(colors.magenta)
- canvas.write("== WATCHLIST ==")
- local line = 13
- for _, item in ipairs(WATCHLIST) do
- local count = getCount(item.name)
- canvas.setCursorPos(2, line)
- canvas.setTextColor(colors.lightGray)
- canvas.write(item.label .. ": ")
- canvas.setTextColor(colors.white)
- canvas.write(tostring(count))
- line = line + 1
- end
- -- Footer stats
- canvas.setCursorPos(2, line + 1)
- canvas.setTextColor(colors.lightGray)
- canvas.write("Phys. Items: " .. usedExt)
- canvas.setCursorPos(2, h)
- canvas.setTextColor(colors.white)
- canvas.write("Load: ")
- canvas.setTextColor(colors.green)
- canvas.write(math.floor(safe("getEnergyUsage") or 0) .. " AE/t")
- canvas.setVisible(true)
- canvas.setVisible(false)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment