SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | - | Output API, By SuPeRMiNoR2 |
2 | + | Output API, By SuPeRMiNoR2 (With help from immibis) |
3 | LICENSE | |
4 | - | http://creativecommons.org/licenses/by-nc/3.0/ |
4 | + | http://creativecommons.org/licenses/by/3.0/deed.en_US |
5 | This license only applies to THIS PROGRAM, not to minecraft, computercraft, or redpower | |
6 | - | You may edit, and/or use this program/API in your own programs/APIS, provided you leave the license comment in. ]]-- |
6 | + | You may edit, and/or use this program/API in your own programs/APIS. You do not have to leave this license comment in, but you can if you want :) |
7 | - | --Version: 1.4 |
7 | + | ]]-- |
8 | ||
9 | - | local output_side = "back" |
9 | + | --Version: 1.5 |
10 | - | local output_white = 0 |
10 | + | |
11 | - | local output_orange = 0 |
11 | + | local side = "back" |
12 | - | local output_magenta = 0 |
12 | + | |
13 | - | local output_lightblue = 0 |
13 | + | |
14 | - | local output_yellow = 0 |
14 | + | rs.setBundledOutput(side, 0) |
15 | - | local output_lime = 0 |
15 | + | |
16 | - | local output_pink = 0 |
16 | + | |
17 | - | local output_gray = 0 |
17 | + | |
18 | - | local output_lightgray = 0 |
18 | + | color = colors[color] or colours[color] |
19 | - | local output_cyan = 0 |
19 | + | if not color then |
20 | - | local output_purple = 0 |
20 | + | error("Invalid colour", 2) |
21 | - | local output_blue = 0 |
21 | + | end |
22 | - | local output_brown = 0 |
22 | + | local func = (state and colors.combine or colors.subtract) |
23 | - | local output_green = 0 |
23 | + | rs.setBundledOutput(side, func(rs.getBundledOutput(side), color)) |
24 | - | local output_red = 0 |
24 | + | |
25 | - | local output_black = 0 |
25 | + | |
26 | - | local output = 0 |
26 | + | |
27 | color = colors[color] or colours[color] | |
28 | return rs.testBundledInput(side, color) | |
29 | end | |
30 | - | output_white = 0 |
30 | + | |
31 | - | output_orange = 0 |
31 | + | function toggle(color) |
32 | - | output_magenta = 0 |
32 | + | cstate = get(color) |
33 | - | output_lightblue = 0 |
33 | + | if cstate == false then |
34 | - | output_yellow = 0 |
34 | + | set(color, true) |
35 | - | output_lime = 0 |
35 | + | end |
36 | - | output_pink = 0 |
36 | + | if cstate == true then |
37 | - | output_gray = 0 |
37 | + | set(color, false) |
38 | - | output_lightgray = 0 |
38 | + | end |
39 | - | output_cyan = 0 |
39 | + | |
40 | - | output_purple = 0 |
40 | + | |
41 | - | output_blue = 0 |
41 | + | |
42 | - | output_brown = 0 |
42 | + | function setadv(sided, color, state) |
43 | - | output_green = 0 |
43 | + | color = colors[color] or colours[color] |
44 | - | output_red = 0 |
44 | + | if not color then |
45 | - | output_black = 0 |
45 | + | error("Invalid colour", 2) |
46 | - | update() |
46 | + | end |
47 | local func = (state and colors.combine or colors.subtract) | |
48 | rs.setBundledOutput(sided, func(rs.getBundledOutput(sided), color)) | |
49 | end | |
50 | - | if state == true then |
50 | + | --]] |
51 | - | state = 1 |
51 | + | |
52 | function setside(s) | |
53 | - | if state == false then |
53 | + | side = s |
54 | - | state = 0 |
54 | + |