SHOW:
|
|
- or go back to the newest paste.
1 | - | -[[ Power Monitoring Program Written By: 0_Mr_Redstone_0 AKA MoJoCreatior |
1 | + | --[[ Power Monitoring Program Written By: 0_Mr_Redstone_0 AKA MoJoCreatior |
2 | ||
3 | Modified by CheezyPig under public domain]] | |
4 | ||
5 | program = "Power Monitor" | |
6 | setup = "f2ty2kg3" | |
7 | program = "trrwXhMX" | |
8 | ||
9 | --functions | |
10 | function intro() | |
11 | term.setBackgroundColour(colors.white) | |
12 | term.clear() | |
13 | term.setCursorPos(1,1) | |
14 | term.setTextColour(colors.green) | |
15 | print(program.." -Fatal Error Occurred\n") | |
16 | end | |
17 | ||
18 | function install() | |
19 | fs.delete("setup.lua") | |
20 | fs.delete("program.lua") | |
21 | fs.delete("config/") | |
22 | shell.run("pastebin get "..setup.." setup.lua") | |
23 | shell.run("pastebin get "..program.." program.lua") | |
24 | fs.delete("startup") | |
25 | startup = fs.open("startup","w") | |
26 | startup.write('shell.run("setup.lua")') | |
27 | startup.close() | |
28 | if fs.exists("config/update") == true then print("Updated") | |
29 | else print("A FATAL ERROR HAS OCCURRED... PLEASE REBOOT") | |
30 | end | |
31 | end | |
32 | ||
33 | function configSave(name,data) | |
34 | cfg = fs.open("config/"..name,"w") | |
35 | cfg.write(data) | |
36 | cfg.close() | |
37 | end | |
38 | ||
39 | function RFAPI() | |
40 | rfAPI = false | |
41 | if peripheral.find("tile_thermalexpansion_cell_resonant_name") == nil then | |
42 | else cube = peripheral.find("tile_thermalexpansion_cell_resonant_name") | |
43 | rfAPI = true | |
44 | end | |
45 | if peripheral.find("tile_blockcapacitorbank_name") == nil then | |
46 | else cube = peripheral.find("tile_blockcapacitorbank_name") | |
47 | rfAPI = true | |
48 | end | |
49 | if peripheral.find("extrautils_generatorsolar") == nil then | |
50 | else cube = peripheral.find("extrautils_generatorsolar") | |
51 | rfAPI = true | |
52 | end | |
53 | end | |
54 | ||
55 | function IC2Check() | |
56 | IC2 = false | |
57 | if peripheral.find("mfsu") == nil then | |
58 | else cube = peripheral.find("mfsu") | |
59 | IC2 = true | |
60 | end | |
61 | if peripheral.find("mfe") == nil then | |
62 | else cube = peripheral.find("mfe") | |
63 | IC2 = true | |
64 | end | |
65 | if peripheral.find("cesu") == nil then | |
66 | else cube = peripheral.find("cesu") | |
67 | IC2 = true | |
68 | end | |
69 | if peripheral.find("batbox") == nil then | |
70 | else cube = peripheral.find("batbox") | |
71 | IC2 = true | |
72 | end | |
73 | end | |
74 | ||
75 | function mekanismCheck() | |
76 | mekanism = false | |
77 | if peripheral.find("Basic Energy Cube") == nil then | |
78 | else cube = peripheral.find("Basic Energy Cube") | |
79 | mekanism = true | |
80 | end | |
81 | if peripheral.find("Advanced Energy Cube") == nil then | |
82 | else cube = peripheral.find("Advanced Energy Cube") | |
83 | mekanism = true | |
84 | end | |
85 | if peripheral.find("Elite Energy Cube") == nil then | |
86 | else cube = peripheral.find("Elite Energy Cube") | |
87 | mekanism = true | |
88 | end | |
89 | if peripheral.find("Ultimate Energy Cube") == nil then | |
90 | else cube = peripheral.find("Ultimate Energy Cube") | |
91 | mekanism = true | |
92 | end | |
93 | if peripheral.find("Induction Matrix") == nil then | |
94 | else cube = peripheral.find("Induction Matrix") | |
95 | mekanism = true | |
96 | end | |
97 | end | |
98 | ||
99 | ||
100 | RFAPI() | |
101 | IC2Check() | |
102 | mekanismCheck() | |
103 | ||
104 | intro() | |
105 | ||
106 | if peripheral.find("monitor") == nil then | |
107 | print("Connect Monitor!") print("terminating") sleep(2.5) os.reboot() | |
108 | end | |
109 | ||
110 | if rfAPI == true then | |
111 | elseif IC2 == true then | |
112 | elseif mekanism == true then | |
113 | else print("Connect Energy Cell!") print("terminating") sleep(2.5) os.reboot() | |
114 | end | |
115 | ||
116 | install() | |
117 | os.reboot() |