spenk

ComputerCraft RedPowerAPI

Feb 5th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local side = "back"
  2.  
  3. function alloff()
  4.   rs.setBundledOutput(side, 0)
  5. end
  6.  
  7. function set(color, state)
  8.  color = colors[color] or colours[color]
  9.  if not color then
  10.   error("Invalid colour", 2)
  11.  end
  12.  local func = (state and colors.combine or colors.subtract)
  13.  rs.setBundledOutput(side, func(rs.getBundledOutput(side), color))
  14. end
  15.  
  16. function get(color)
  17.  color = colors[color] or colours[color]
  18.  return rs.testBundledInput(side, color)
  19. end
  20.  
  21. function toggle(color)
  22.  cstate = get(color)
  23.  if cstate == false then
  24.  set(color, true)
  25.  end
  26.  if cstate == true then
  27.  set(color, false)
  28.  end
  29. end
  30.  
  31. function setside(s)
  32.  side = s
  33. end
Advertisement
Add Comment
Please, Sign In to add comment