Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Check()
- if peripheral.find("Induction Matrix") == nil then
- else cube = peripheral.find("Induction Matrix")
- name = "Induction Matrix"
- end
- return name
- end
- function progress_bar(percentage)
- count = 0
- total = 50
- start = '['
- last = ']'
- used = ''
- empty = ''
- for i=0, math.floor(percentage / 2) do
- used = used .. "|"
- count = count + 1
- end
- for i=0, total - math.floor(percentage / 2) do
- empty = empty .. "-"
- count = count + 1
- end
- t_monitor.setTextColor(colors.white)
- t_monitor.write(start)
- t_monitor.setTextColor(colors.white)
- t_monitor.write(used)
- t_monitor.setTextColor(colors.gray)
- t_monitor.write(empty)
- t_monitor.setTextColor(colors.white)
- t_monitor.write(last)
- return raw
- end
- monitor = peripheral.wrap("right")
- t_monitor = peripheral.wrap("top")
- previous = 0
- function eng_cube()
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextScale(0.8)
- monitor.write(string.format("Showing Data For [%s]", name))
- max = cube.getMaxEnergy()
- monitor.setCursorPos(1,2)
- monitor.write(string.format("Capacity: %s J", max))
- current = cube.getEnergy()
- e_in = current - previous
- previous = current
- monitor.setCursorPos(1,3)
- monitor.write(string.format("I/O(+/-): %s J/T", e_in))
- monitor.setCursorPos(1,4)
- monitor.write(string.format("Stored : %s J", current))
- end
- function matrix()
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextScale(0.9)
- monitor.write("Power Managment")
- monitor.setCursorPos(1,2)
- monitor.write(string.format("[%s]", name))
- max = cube.getMaxEnergy()
- monitor.setCursorPos(1,3)
- monitor.write(string.format("Capacity : %s J", max))
- e_in = cube.getInput()
- monitor.setCursorPos(1,4)
- monitor.write(string.format("Receiving : %s J/T", e_in))
- e_out = cube.getOutput()
- monitor.setCursorPos(1,5)
- monitor.write(string.format("Outputting : %s J/T", e_out))
- current = cube.getEnergy()
- monitor.setCursorPos(1,6)
- monitor.write(string.format("Stored : %s J", current))
- cur_perc = (current / max) * 100
- cur_perc = math.floor(cur_perc+0.5)
- t_monitor.clear()
- t_monitor.setCursorPos(1,1)
- t_monitor.setTextScale(0.9)
- t_monitor.write(string.format("Stored : %s Percent", cur_perc))
- t_monitor.setCursorPos(1,3)
- val_max = progress_bar(cur_perc)
- cap = cube.getTransferCap()
- out_perc = (e_out / cap) * 100
- out_perc = math.floor(out_perc+0.5)
- t_monitor.setCursorPos(1,5)
- t_monitor.write(string.format("Outputting : %s Percent", out_perc))
- t_monitor.setCursorPos(1,6)
- val_out = progress_bar(out_perc)
- in_perc = (e_in / cap) * 100
- in_perc = math.floor(in_perc+0.5)
- t_monitor.setCursorPos(1,8)
- t_monitor.write(string.format("Receiving : %s Percent", in_perc))
- t_monitor.setCursorPos(1,9)
- val_in = progress_bar(in_perc)
- end
- while true do
- Check()
- if name == "Induction Matrix"
- then
- matrix()
- sleep(0.1)
- else
- eng_cube()
- sleep(0.05)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement