Advertisement
OpposingGeek

temp

Apr 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. --SubComputer
  2. row = "row1"
  3.  
  4. allColors = colors.combine(colors.red, colors.green, colors.brown, colors.blue, colors.purple, colors.cyan, colors.lightGray, colors.gray, colors.pink, colors.lime)
  5. activeColors = allColors
  6. colorNames = {colors.red, colors.green, colors.brown, colors.blue, colors.purple, colors.cyan, colors.lightGray, colors.gray, colors.pink, colors.lime}
  7.  
  8. row1bottom = {"terra", "arbor", "perditio", "instrumentum", "ignis", "spiritus", "corpus", "iter", "meto", "potentia"}
  9. row1back = {"praecantatio", "aqua", "sensus", "aer", "herba", "motus", "bestia", "venenum", "mortuus", "victus"}
  10.  
  11. function getAspectInfo(name)
  12. count = 1
  13. while count <= table.getn(row1bottom) do
  14. if row1bottom[count] == name then
  15. return count, "bottom"
  16. end
  17. count = count + 1
  18. end
  19. count = 1
  20. while count <= table.getn(row1back) do
  21. if row1back[count] == name then
  22. return count, "back"
  23. end
  24. count = count + 1
  25. end
  26. end
  27.  
  28. function removeColor(colorIndex, side)
  29. col = colorNames[colorIndex]
  30. activeColors = colors.subtract(activeColors, col)
  31.  
  32. end
  33.  
  34. function reloadColors()
  35. activeColors = allColors
  36. updateSignals("both")
  37. end
  38.  
  39. --Updates the redstone signals
  40. function updateSignals(side)
  41. if side ~= "both" then
  42. redstone.setBundledOutput(side, activeColors)
  43. else
  44. redstone.setBundledOutput("bottom", activeColors)
  45. redstone.setBundledOutput("back", activeColors)
  46. end
  47. rednet.broadcast("clear")
  48. end
  49.  
  50. --Just initializes rednet
  51. function rednetInit()
  52. rednet.open("top")
  53. rednet.broadcast(row)
  54. end
  55.  
  56. --Main Code Body
  57. updateSignals("both")
  58. rednetInit()
  59. while true do
  60. id, msg = rednet.receive(5)
  61. sleep(0)
  62. if msg ~= nil and msg ~= "row2" and msg ~= "clear" then
  63. reloadColors()
  64.  
  65. count, side = getAspectInfo(msg)
  66. removeColor(count)
  67. updateSignals(side)
  68. end
  69. if msg == "clear" then
  70. reloadColors()
  71. end
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement