SHOW:
|
|
- or go back to the newest paste.
1 | mon = peripheral.find("monitor") | |
2 | sg = peripheral.find("stargate") | |
3 | ||
4 | mon.setBackgroundColor(colors.black) | |
5 | mon.clear() | |
6 | - | maxEng = 50000 |
6 | + | maxEng = 90000 |
7 | dialling = {} | |
8 | ||
9 | local function alarmSet(set) | |
10 | rs.setOutput("left", set) | |
11 | return | |
12 | end | |
13 | ||
14 | - | function drawPowerBar() -- checks power levels and writes power bar to monitor |
14 | + | |
15 | ||
16 | - | engPercent = (sg.energyAvailable() / (maxEng +1)) * 100 -- returns percent |
16 | + | |
17 | - | for i = y, (y - y / 100 * engPercent), -1 do |
17 | + | |
18 | - | mon.setCursorPos(x-2,i) |
18 | + | |
19 | - | if i > y/4*3 then |
19 | + | |
20 | - | mon.setBackgroundColor(colors.red) |
20 | + | |
21 | - | mon.setTextColor(colors.red) |
21 | + | |
22 | - | elseif i > y/2 then |
22 | + | |
23 | - | mon.setBackgroundColor(colors.orange) |
23 | + | |
24 | - | mon.setTextColor(colors.orange) |
24 | + | |
25 | - | elseif i > y/4 then |
25 | + | |
26 | - | mon.setBackgroundColor(colors.green) |
26 | + | |
27 | - | mon.setTextColor(colors.green) |
27 | + | |
28 | - | else |
28 | + | |
29 | - | mon.setBackgroundColor(colors.lime) |
29 | + | |
30 | - | mon.setTextColor(colors.lime) |
30 | + | |
31 | - | end |
31 | + | |
32 | - | mon.write(" ") |
32 | + | |
33 | end | |
34 | for i = chevX1+2, chevX2-2 do | |
35 | - | mon.setCursorPos(x-9,y) |
35 | + | |
36 | - | mon.write(math.floor(sg.energyAvailable() / 1000).."k SU ") |
36 | + | |
37 | end | |
38 | for i = chevY1+2, chevY2-2 do | |
39 | mon.setCursorPos(chevX1,i) | |
40 | mon.write(" ") | |
41 | end | |
42 | for i = chevY1+2, chevY2-2 do | |
43 | mon.setCursorPos(chevX2, i) | |
44 | mon.write(" ") | |
45 | end | |
46 | chev1pos = {chevX1, chevY2 } | |
47 | mon.setBackgroundColor(colors.gray) | |
48 | mon.setTextColor(colors.black) | |
49 | mon.setCursorPos(math.floor(chev1pos[1]), math.floor(chev1pos[2])-1) | |
50 | mon.write(" > ") | |
51 | chev2pos = {chevX1, chevY1 + ((chevY2 - chevY1) / 2) } | |
52 | mon.setCursorPos(math.floor(chev2pos[1]-1), math.floor(chev2pos[2])) | |
53 | mon.write(" > ") | |
54 | chev3pos = {chevX1, chevY1 } | |
55 | mon.setCursorPos(math.floor(chev3pos[1]), math.floor(chev3pos[2]+1)) | |
56 | mon.write(" > ") | |
57 | chev4pos = {chevX1 + ((chevX2 - chevX1) / 2), chevY1 } | |
58 | mon.setCursorPos(math.floor(chev4pos[1]-1), math.floor(chev4pos[2])) | |
59 | mon.write(" V ") | |
60 | chev5pos = {chevX2, chevY1 } | |
61 | mon.setCursorPos(math.floor(chev5pos[1]-2), math.floor(chev5pos[2])+1) | |
62 | mon.write(" < ") | |
63 | chev6pos = {chevX2, chevY1 + ((chevY2 - chevY1) / 2) } | |
64 | mon.setCursorPos(math.floor(chev6pos[1]-1), math.floor(chev6pos[2])) | |
65 | mon.write(" < ") | |
66 | chev7pos = {chevX2, chevY2 } | |
67 | mon.setCursorPos(math.floor(chev7pos[1]-2), math.floor(chev7pos[2]-1)) | |
68 | mon.write(" < ") | |
69 | chev8pos = {chevX1 + ((chevX2 - chevX1) /2), chevY2 } | |
70 | mon.setCursorPos(math.floor(chev8pos[1]-1), math.floor(chev8pos[2])) | |
71 | mon.write(" ") | |
72 | -- chev9pos = {chevX1 + ((chevX2 - chevX1) /2), chevY2 } | |
73 | -- mon.setCursorPos(math.floor(chev8pos[1]-1), chevY1 + ((chevY2 - chevY1) / 2)) | |
74 | -- mon.write(" 9 ") | |
75 | mon.setBackgroundColor(colors.black) | |
76 | mon.setCursorPos(x/2 - 4, y/2 - 1) | |
77 | mon.write(" ") | |
78 | mon.setCursorPos(x/2-1, y/2+4) | |
79 | mon.write(" ") | |
80 | end | |
81 | ||
82 | function drawChev( chevInfo ) | |
83 | mon.setBackgroundColor(colors.gray) | |
84 | x,y = mon.getSize() | |
85 | chevX1 = x/3 | |
86 | chevX2 = x/3*2+1 | |
87 | chevY1 = y/3-2 | |
88 | chevY2 = y/3*2 +2 | |
89 | if chevInfo[1] == 1 then | |
90 | chev1pos = {chevX1, chevY2 } | |
91 | mon.setBackgroundColor(colors.gray) | |
92 | mon.setCursorPos(math.floor(chev1pos[1]), math.floor(chev1pos[2])-1) | |
93 | mon.write(" "..chevInfo[2].." ") | |
94 | elseif chevInfo[1] == 2 then | |
95 | chev2pos = {chevX1, chevY1 + ((chevY2 - chevY1) / 2) } | |
96 | mon.setCursorPos(math.floor(chev2pos[1]-1), math.floor(chev2pos[2])) | |
97 | mon.write(" "..chevInfo[2].." ") | |
98 | elseif chevInfo[1] == 3 then | |
99 | chev3pos = {chevX1, chevY1 } | |
100 | mon.setCursorPos(math.floor(chev3pos[1]), math.floor(chev3pos[2]+1)) | |
101 | mon.write(" "..chevInfo[2].." ") | |
102 | elseif chevInfo[1] == 4 then | |
103 | chev4pos = {chevX1 + ((chevX2 - chevX1) / 2), chevY1 } | |
104 | mon.setCursorPos(math.floor(chev4pos[1]-1), math.floor(chev4pos[2])) | |
105 | mon.write(" "..chevInfo[2].." ") | |
106 | elseif chevInfo[1] == 5 then | |
107 | chev5pos = {chevX2, chevY1 } | |
108 | mon.setCursorPos(math.floor(chev5pos[1]-2), math.floor(chev5pos[2])+1) | |
109 | mon.write(" "..chevInfo[2].." ") | |
110 | elseif chevInfo[1] == 6 then | |
111 | chev6pos = {chevX2, chevY1 + ((chevY2 - chevY1) / 2) } | |
112 | mon.setCursorPos(math.floor(chev6pos[1]-1), math.floor(chev6pos[2])) | |
113 | mon.write(" "..chevInfo[2].." ") | |
114 | elseif chevInfo[1] == 7 then | |
115 | chev7pos = {chevX2, chevY2 } | |
116 | mon.setCursorPos(math.floor(chev7pos[1]-2), math.floor(chev7pos[2]-1)) | |
117 | mon.write(" "..chevInfo[2].." ") | |
118 | elseif chevInfo[1] == 8 then | |
119 | chev8pos = {chevX1 + ((chevX2 - chevX1) /2), chevY2 } | |
120 | mon.setCursorPos(math.floor(chev8pos[1]-1), math.floor(chev8pos[2])) | |
121 | mon.write(" "..chevInfo[2].." ") | |
122 | elseif chevInfo[1] == 9 then | |
123 | chev9pos = {chevX1 + ((chevX2 - chevX1) /2), chevY2 } | |
124 | mon.setCursorPos(math.floor(chev8pos[1]-1), chevY1 + ((chevY2 - chevY1) / 2)) | |
125 | mon.write(" "..chevInfo[2].." ") | |
126 | mon.setBackgroundColor(colors.black) | |
127 | end | |
128 | ||
129 | end | |
130 | ||
131 | ||
132 | ||
133 | function drawHome() -- draws the home screen | |
134 | mon.setBackgroundColor(colors.black) | |
135 | x,y = mon.getSize() | |
136 | mon.clear() | |
137 | mon.setCursorPos(1,y) | |
138 | mon.setTextColor(colors.gray) | |
139 | mon.setBackgroundColor(colors.black) | |
140 | mon.write("AbydOS") | |
141 | drawPowerBar() | |
142 | drawChevrons() | |
143 | ||
144 | end | |
145 | ||
146 | ||
147 | ||
148 | function drawRemoteAddress() | |
149 | mon.setBackgroundColor(colors.black) | |
150 | x,y = mon.getSize() | |
151 | mon.setCursorPos((x/2+1) - string.len(sg.remoteAddress())/2, y/2-2) | |
152 | mon.write(sg.remoteAddress()) | |
153 | end |