Advertisement
Znailxxor

Nodetracker

Jun 6th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. function checkColor(aspect)
  2.     if aspect == "ignis" then return colors.red
  3.     elseif aspect == "terra" then return colors.green
  4.     elseif aspect == "aer" then return colors.yellow
  5.     elseif aspect == "perditio" then return colors.gray
  6.     elseif aspect == "aqua" then return colors.cyan
  7.     elseif aspect == "ordo" then return colors.lightGray
  8.     else return colors.white end
  9. end
  10.  
  11.  
  12. while 1 do
  13.         nodes = {peripheral.find("tt_aspectContainer")}
  14.         monitor = peripheral.find("monitor")
  15.     monitor.clear()
  16.         y = 1
  17.         for i, node in ipairs(nodes) do
  18.                 x = 1
  19.         total = 0
  20.                 for _, aspect in pairs(node.getAspects()) do
  21.                         monitor.setCursorPos(x, y+1)
  22.             monitor.setTextColor(checkColor(aspect))
  23.                         monitor.write(aspect:gsub("^%l", string.upper))
  24.             monitor.setTextColor(colors.white)
  25.                         monitor.setCursorPos(x, y+2)
  26.             count = node.getAspectCount(aspect)
  27.             total = total + count
  28.                         monitor.write(tostring(count))
  29.                         x = x + string.len(aspect) + 1
  30.                 end
  31.         x = 1
  32.         monitor.setCursorPos(x, y)
  33.                 monitor.write("Node "..tostring(i).." ("..tostring(total)..")")
  34.                 y = y + 4
  35.         end
  36.     sleep(1)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement