Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cubes = {}
- print("Locating energy cubes...")
- for i,k in pairs(peripheral.getNames()) do
- if string.find(peripheral.getType(k),"Energy Cube") then
- cubes[#cubes+1] = k
- end
- end
- print("Locating monitor...")
- for i,k in pairs(peripheral.getNames()) do
- if peripheral.getType(k) == "monitor" then
- print("Monitor: " .. k)
- monitor = peripheral.wrap(k)
- end
- end
- print("Getting monitor size...")
- resolution = {monitor.getSize()}
- print("Width: " .. resolution[1] .. " Height: " .. resolution[2])
- print("Is colour: " .. tostring(monitor.isColour()))
- if not monitor.isColour() then
- error("Colour monitor needed")
- end
- term.redirect(monitor)
- term.clear()
- term.setTextColour(colours.white)
- term.setBackgroundColour(colours.black)
- term.clear()
- while true do
- MaxEnergy = 0
- Energy = 0
- Output = 0
- for i,k in pairs(cubes) do
- cube = peripheral.wrap(k)
- MaxEnergy = MaxEnergy + cube.getMaxEnergy()
- Energy = Energy + cube.getEnergy()
- Output = Output + cube.getOutput()
- end
- MaxEnergy = MaxEnergy * 0.4
- Energy = Energy * 0.4
- Output = Output * 0.4
- -- J -> RF
- term.setCursorPos(2,2)
- term.clearLine()
- term.setTextColour(colours.lime)
- term.write(math.floor(Energy/1000) .. " kRF / " .. math.floor(MaxEnergy/1000) .. " kRF")
- term.setCursorPos(2,3)
- term.setTextColour(colours.yellow)
- term.write("Output: " .. math.floor(MaxEnergy/1000) .. " kRF (" .. #cubes .. ")")
- term.setCursorPos(2,4)
- if not Change then Change = Energy end
- Difference = Energy - Change
- Change = Energy
- if Difference > 0 then
- term.setTextColour(colours.green)
- term.write("Gain: +" .. Difference .. " RF")
- elseif Difference == 0 then
- term.setTextColour(colours.yellow)
- term.write("Idle: ±0 RF")
- else
- term.setTextColour(colours.red)
- term.write("Loss: -" .. string.gsub(Difference ,"-","") .. " RF")
- end
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement