Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("By colhaydutu /ps colhaydutu")
- print("Setup")
- print("Place wired modem back side of the computer")
- print("Place wired modem any side of the ic2 battery (like pesu, mfe, msfu, batbox) but it must be block modem")
- print("Right click all modems for connect")
- print("Place monitors 2x4 like this and place modem back side of any monitor (yellows are monitors , red is computer)")
- paintutils.drawPixel(10, 16, colors.yellow)
- paintutils.drawPixel(12, 16, colors.yellow)
- paintutils.drawPixel(14, 16, colors.yellow)
- paintutils.drawPixel(16, 16, colors.yellow)
- paintutils.drawPixel(8, 18, colors.red)
- paintutils.drawPixel(10 , 18, colors.yellow)
- paintutils.drawPixel(12 , 18, colors.yellow)
- paintutils.drawPixel(14 , 18, colors.yellow)
- paintutils.drawPixel(16 , 18, colors.yellow)
- local function findMonitors()
- local monitors = {}
- for _, name in pairs(peripheral.getNames()) do
- if string.match(name, "^monitor_") then
- local monitor = peripheral.wrap(name)
- table.insert(monitors, monitor)
- end
- end
- return monitors
- end
- local monitors = findMonitors()
- local monitor = monitors[1] -- İlk bulunan monitörü kullan
- local modem = peripheral.wrap("back")
- modem.open(11)
- local function drawBar(monitor, x, y, width, fillPercentage)
- local w, h = monitor.getSize()
- term.redirect(monitor)
- paintutils.drawLine(3, 3, 4, 3, colors.orange)
- paintutils.drawLine(13, 3, w - 2, 3, colors.orange)
- paintutils.drawLine(3, 3, 3, h - 1, colors.orange)
- paintutils.drawLine(w - 2, 3, w - 2, h - 1, colors.orange)
- paintutils.drawLine(w - 2, h - 1, 3, h - 1, colors.orange)
- monitor.setBackgroundColor(colors.gray)
- monitor.setTextColor(colors.black)
- monitor.setCursorPos(6, 3)
- monitor.write("[INFO]")
- local fillWidth = math.floor(width * fillPercentage)
- monitor.setBackgroundColor(colors.gray)
- monitor.setTextColor(colors.black)
- monitor.setCursorPos(x, y)
- monitor.write("[ ")
- for i = 1, width do
- if i <= fillWidth then
- monitor.setBackgroundColor(colors.green)
- monitor.write(" ")
- else
- monitor.setBackgroundColor(colors.red)
- monitor.write(" ")
- end
- end
- monitor.setBackgroundColor(colors.gray)
- monitor.write(" ] " .. math.floor(fillPercentage * 100) .. "%")
- end
- local battery
- for _, name in pairs(peripheral.getNames()) do
- if string.match(name, "^Elite") then
- battery = peripheral.wrap(name)
- break
- end
- end
- if not battery then
- print("IC2 battery not found. Please use modem and right-click on it to connect.")
- return
- end
- local previousEnergy = battery.getEnergyStored()
- local enerji = battery.getEnergyStored()
- while true do
- local totalEnergy = battery.getEnergyStored()
- local totalCapacity = battery.getEnergyCapacity()
- local capPercentage = totalCapacity > 0 and totalEnergy / totalCapacity or 0
- local energyUsed = previousEnergy - totalEnergy
- previousEnergy = totalEnergy
- local enerjigiris = totalEnergy - enerji
- enerji = totalEnergy
- monitor.clear()
- drawBar(monitor, 5, 7, 20, capPercentage)
- monitor.setCursorPos(5, 5)
- monitor.setBackgroundColor(colors.gray)
- monitor.setTextColor(colors.black)
- monitor.write("Energy: " .. (totalEnergy / 1000) .. " K RF")
- monitor.setCursorPos(5, 9)
- monitor.write("Energy Used: " .. (energyUsed / 1000) .. " K RF")
- monitor.setCursorPos(5, 10)
- monitor.write("Energy Production: " .. (enerjigiris / 1000) .. " K RF")
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement