SHOW:
|
|
- or go back to the newest paste.
1 | API = require("buttonAPI") | |
2 | local event = require("event") | |
3 | local computer = require("computer") | |
4 | local term = require("term") | |
5 | local component = require("component") | |
6 | local gpu = component.gpu | |
7 | ||
8 | local rs = component.redstone | |
9 | local colors = require("colors") | |
10 | local sides = require("sides") | |
11 | ||
12 | function API.fillTable() | |
13 | - | API.setTable("Purgar", test1, 10,20,3,5) |
13 | + | API.setTable("Gen 1", test1, 10,20,3,5) |
14 | - | API.setTable("Activar", test2, 22,32,3,5) |
14 | + | API.setTable("Gen 2", test2, 22,32,3,5) |
15 | - | API.setTable("Memoria", test3, 10,20,8,10) |
15 | + | API.setTable("Gen 3", test3, 10,20,8,10) |
16 | - | API.setTable("Reiniciar", test4, 22,32,8,10) |
16 | + | API.setTable("Gen 4", test4, 22,32,8,10) |
17 | - | API.setTable("Salir", test5, 10,32,13,15) |
17 | + | API.setTable("Exit", test5, 10,32,13,15) |
18 | - | API.setTable("Autopurga", test6, 34,50,3,15) |
18 | + | API.setTable("Emergency stop", test6, 34,50,3,15) |
19 | - | API.setTable("Luces", test7, 52,62,3,5) |
19 | + | API.setTable("Lights", test7, 52,62,3,5) |
20 | API.screen() | |
21 | end | |
22 | ||
23 | function getClick() | |
24 | local _, _, x, y = event.pull(1,touch) | |
25 | if x == nil or y == nil then | |
26 | local h, w = gpu.getResolution() | |
27 | gpu.set(h, w, ".") | |
28 | gpu.set(h, w, " ") | |
29 | else | |
30 | API.checkxy(x,y) | |
31 | end | |
32 | end | |
33 | ||
34 | function test1() | |
35 | API.toggleButton("Gen 1") | |
36 | - | term.write("Trabajando... ") |
36 | + | |
37 | - | rs.setOutput(sides.right,15) |
37 | + | |
38 | term.write("Working... ") | |
39 | - | API.flash("Purgar",0.25) |
39 | + | rs.setOutput(sides.right,15) |
40 | os.sleep(3) | |
41 | term.setCursor(1,25) | |
42 | - | term.write("Estacion 3 purgada ") |
42 | + | term.write("System ready ") |
43 | else | |
44 | term.setCursor(1,25) | |
45 | - | term.write("Sistema listo ") |
45 | + | term.write("Working... ") |
46 | rs.setOutput(sides.right,0) | |
47 | os.sleep(3) | |
48 | term.setCursor(1,25) | |
49 | - | API.toggleButton("Activar") |
49 | + | term.write("System ready ") |
50 | end | |
51 | end | |
52 | - | term.write("Trabajando... ") |
52 | + | |
53 | function test2() | |
54 | API.toggleButton("Gen 2") | |
55 | if buttonStatus == true then | |
56 | - | term.write("Sistema listo ") |
56 | + | |
57 | term.write("Working... ") | |
58 | rs.setOutput(sides.left,15) | |
59 | - | term.write("Trabajando... ") |
59 | + | |
60 | term.setCursor(1,25) | |
61 | term.write("System ready ") | |
62 | else | |
63 | - | term.write("Sistema listo ") |
63 | + | |
64 | term.write("Working... ") | |
65 | rs.setOutput(sides.left,0) | |
66 | os.sleep(3) | |
67 | term.setCursor(1,25) | |
68 | term.write("System ready ") | |
69 | - | term.write("Memoria libre: "..computer.freeMemory().." bytes") |
69 | + | |
70 | - | os.sleep(3) |
70 | + | |
71 | ||
72 | - | term.write("Sistema listo ") |
72 | + | |
73 | API.toggleButton("Gen 3") | |
74 | if buttonStatus == true then | |
75 | term.setCursor(1,25) | |
76 | - | computer.shutdown(true) |
76 | + | term.write("Working... ") |
77 | rs.setOutput(sides.front,15) | |
78 | os.sleep(3) | |
79 | term.setCursor(1,25) | |
80 | term.write("System ready ") | |
81 | else | |
82 | term.setCursor(1,25) | |
83 | term.write("Working... ") | |
84 | rs.setOutput(sides.front,0) | |
85 | os.sleep(3) | |
86 | - | term.write("Trabajando... ") |
86 | + | |
87 | - | API.flash("Autopurga",0.25) |
87 | + | term.write("System ready ") |
88 | - | rs.setOutput(sides.front,15) |
88 | + | |
89 | end | |
90 | ||
91 | function test4() | |
92 | - | term.write("Estacion purgada") |
92 | + | API.toggleButton("Gen 4") |
93 | if buttonStatus == true then | |
94 | term.setCursor(1,25) | |
95 | - | term.write("Sistema listo ") |
95 | + | term.write("Working... ") |
96 | rs.setOutput(sides.back,15) | |
97 | os.sleep(3) | |
98 | term.setCursor(1,25) | |
99 | - | API.toggleButton("Luces") |
99 | + | term.write("System ready ") |
100 | else | |
101 | term.setCursor(1,25) | |
102 | - | term.write("Trabajando... ") |
102 | + | term.write("Working... ") |
103 | rs.setOutput(sides.back,0) | |
104 | os.sleep(3) | |
105 | term.setCursor(1,25) | |
106 | - | term.write("Sistema listo ") |
106 | + | term.write("System ready ") |
107 | end | |
108 | end | |
109 | - | term.write("Trabajando... ") |
109 | + | |
110 | function test5() | |
111 | term.clear() | |
112 | os.exit() | |
113 | - | term.write("Sistema listo ") |
113 | + | |
114 | ||
115 | function test6() | |
116 | term.setCursor(1,25) | |
117 | term.write("Working... ") | |
118 | API.flash("Emergency stop",0.25) | |
119 | os.sleep(2) | |
120 | rs.setOutput(sides.front,0) | |
121 | - | API.heading("Kerberos. Tablero de control de sistemas") |
121 | + | rs.setOutput(sides.back,0) |
122 | - | API.label(1,24,"Drizzard 2016. maumagro") |
122 | + | |
123 | rs.setOutput(sides.left,0) | |
124 | term.setCursor(1,25) | |
125 | term.write("Reactors emergency shutdown! ") | |
126 | os.sleep(1) | |
127 | term.setCursor(1,25) | |
128 | term.write("System ready ") | |
129 | os.exit() | |
130 | end | |
131 | ||
132 | function test7() | |
133 | API.toggleButton("Lights") | |
134 | if buttonStatus == true then | |
135 | term.setCursor(1,25) | |
136 | term.write("Working... ") | |
137 | os.sleep(3) | |
138 | rs.setOutput(sides.up,15) | |
139 | term.setCursor(1,25) | |
140 | term.write("System ready ") | |
141 | else | |
142 | term.setCursor(1,25) | |
143 | term.write("Working... ") | |
144 | os.sleep(3) | |
145 | rs.setOutput(sides.up,0) | |
146 | term.setCursor(1,25) | |
147 | term.write("System ready ") | |
148 | end | |
149 | end | |
150 | ||
151 | term.setCursorBlink(false) | |
152 | gpu.setResolution(80, 25) | |
153 | API.clear() | |
154 | API.fillTable() | |
155 | API.heading("McProton. System control module") | |
156 | API.label(1,24,"McPrime 2017. maumagro") | |
157 | ||
158 | while true do | |
159 | getClick() | |
160 | end | |
161 | ||
162 | ||
163 | ||
164 | --eof |