Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function testBundledOutput( side, c )
- local out = rs.getBundledOutput( side )
- return colors.subtract( out, c ) ~= out
- end
- local bundled = {
- setColor = function( self, c, bool )
- if testBundledOutput( self.side, c ) ~= bool then
- self:toggleColor( c )
- end
- end,
- toggleColor = function( self, c )
- rs.setBundledOutput( self.side, colors[ bool and "subtract" or "combine" ]( rs.getBundledOutput( self.side ), c ) )
- end,
- allOff = function( self )
- rs.setBundledOutput( self.side, 0 )
- end,
- getInput = function( self, c )
- if c then
- return rs.testBundledInput( self.side, c )
- else
- local t = {}
- for k, v in pairs( colors ) do
- t[ k ] = type( v ) == "number" and rs.testBundledInput( self.side, v )
- end
- return t
- end
- end,
- }
- function getBundledSide( side )
- return setmetatable( {side = side}, {__index=bundled} )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement