Advertisement
Falcono

Basic Induction Matrix Monitor

Jun 3rd, 2025 (edited)
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function progress_bar(percentage)
  2.   count = 0
  3.   total = 50
  4.   start = '['
  5.   last = ']'
  6.   used = ''
  7.   empty = ''
  8.   for i=0, math.floor(percentage / 2) do
  9.       used = used .. "|"
  10.       count = count + 1
  11.   end
  12.   for i=0, total - math.floor(percentage / 2) do
  13.       empty = empty .. "-"
  14.       count = count + 1
  15.   end
  16.  
  17.   t_monitor.setTextColor(colors.white)
  18.   t_monitor.write(start)
  19.  
  20.   t_monitor.setTextColor(colors.white)
  21.   t_monitor.write(used)
  22.  
  23.   t_monitor.setTextColor(colors.gray)
  24.   t_monitor.write(empty)
  25.  
  26.   t_monitor.setTextColor(colors.white)
  27.   t_monitor.write(last)
  28.   return raw
  29. end
  30.  
  31.  
  32. monitor = peripheral.wrap("right")
  33. t_monitor = peripheral.wrap("top")
  34.  
  35. previous = 0
  36.  
  37.  
  38. function matrix()
  39.  
  40.   monitor.clear()
  41.   monitor.setCursorPos(1,1)
  42.   monitor.setTextScale(0.9)
  43.   monitor.write("Power Managment")
  44.   monitor.setCursorPos(1,2)
  45.   monitor.write(string.format("[%s]", name))
  46.  
  47.   max = cube.getMaxEnergy()
  48.   monitor.setCursorPos(1,3)
  49.   monitor.write(string.format("Capacity   : %s J", max))
  50.  
  51.   e_in = cube.getInput()
  52.   monitor.setCursorPos(1,4)
  53.   monitor.write(string.format("Receiving  : %s J/T", e_in))
  54.  
  55.   e_out = cube.getOutput()
  56.   monitor.setCursorPos(1,5)
  57.   monitor.write(string.format("Outputting : %s J/T", e_out))
  58.  
  59.   current = cube.getEnergy()
  60.   monitor.setCursorPos(1,6)
  61.   monitor.write(string.format("Stored     : %s J", current))
  62.  
  63.   cur_perc = (current / max) * 100
  64.   cur_perc = math.floor(cur_perc+0.5)
  65.  
  66.   t_monitor.clear()
  67.   t_monitor.setCursorPos(1,1)
  68.   t_monitor.setTextScale(0.9)
  69.   t_monitor.write(string.format("Stored     : %s Percent", cur_perc))
  70.  
  71.   t_monitor.setCursorPos(1,3)
  72.   val_max = progress_bar(cur_perc)
  73.  
  74.   cap = cube.getTransferCap()
  75.   out_perc = (e_out / cap) * 100
  76.   out_perc = math.floor(out_perc+0.5)
  77.   t_monitor.setCursorPos(1,5)
  78.   t_monitor.write(string.format("Outputting : %s Percent", out_perc))
  79.  
  80.  
  81.   t_monitor.setCursorPos(1,6)
  82.   val_out = progress_bar(out_perc)
  83.  
  84.  
  85.   in_perc = (e_in / cap) * 100
  86.   in_perc = math.floor(in_perc+0.5)
  87.   t_monitor.setCursorPos(1,8)
  88.   t_monitor.write(string.format("Receiving  : %s Percent", in_perc))
  89.  
  90.  
  91.   t_monitor.setCursorPos(1,9)
  92.   val_in = progress_bar(in_perc)
  93.  
  94. end
  95.  
  96. --while true do
  97. --  matrix()
  98. --  sleep(0.1)
  99. --end
  100.  
  101. local storage = peripheral.find("mekanism:induction_casing")
  102.  
  103. print(storage.tanks())
  104.  
  105. local name = peripheral.getNames()
  106.  
  107. print(name[0])
  108.  
  109. --print(peripheral.getMethods(name[0]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement