Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize all the cubes and the monitor
- cube = {}
- cube[0] = peripheral.wrap("mekanism:ultimate_energy_cube_0")
- cube[1] = peripheral.wrap("mekanism:ultimate_energy_cube_1")
- cube[2] = peripheral.wrap("mekanism:ultimate_energy_cube_2")
- cube[3] = peripheral.wrap("mekanism:ultimate_energy_cube_3")
- cube[4] = peripheral.wrap("mekanism:ultimate_energy_cube_4")
- cube[5] = peripheral.wrap("mekanism:ultimate_energy_cube_5")
- cube[6] = peripheral.wrap("mekanism:ultimate_energy_cube_6")
- cube[7] = peripheral.wrap("mekanism:ultimate_energy_cube_7")
- cube[8] = peripheral.wrap("mekanism:ultimate_energy_cube_8")
- cube[9] = peripheral.wrap("mekanism:ultimate_energy_cube_9")
- cube[10] = peripheral.wrap("mekanism:ultimate_energy_cube_10")
- cube[11] = peripheral.wrap("mekanism:ultimate_energy_cube_11")
- mon = peripheral.wrap("top")
- -- Initialize current Energy array
- currentE = {}
- for i=0,11 do currentE[i] = -1 end
- mon.setTextScale(1)
- -- main loop
- while true do
- for i=0,11 do
- currentCube = cube[i]
- cubeE = currentCube.getEnergy()
- -- Check if current cube should be updated
- if cubeE ~= currentE[i] then
- mon.setCursorPos(1,i+1)
- mon.clearLine()
- mon.setTextColor(colors.white)
- if i < 9 then
- mon.write(string.format("CUBE %d: ",i+1))
- else
- mon.write(string.format("CUBE %d: ",i+1))
- end
- -- determine the color if the text base on the amount of charge left in the cube
- if cubeE < 1000000 then
- mon.setTextColor(colors.yellow)
- elseif cubeE < 50000 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- mon.write(string.format("%.2f",cubeE/1000000))
- mon.setTextColor(colors.white)
- mon.write(" M")
- currentE[i] = cubeE
- end
- end
- sleep(5)
- end
Add Comment
Please, Sign In to add comment