MoJoCreatior

Power Monitor Installer V:20 --old

Mar 21st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.42 KB | None | 0 0
  1. --[[  Power Monitoring Program Written By: 0_Mr_Redstone_0  AKA  MoJoCreatior
  2. This code is considered free for use both commercial and private and can be redistributed so long as it meats following criteria:
  3. 1: 0_Mr_Redstone_0 and MoJoCreatior are credited as the original authors
  4. 2: You do not try to take full ownership of the code/written program
  5. 3: If you modify the code for re-upload you must provide it under the same conditions. as in- Open Source, and credit me as original author]]
  6.  
  7. program = "Power Monitor"
  8. setup = "f2ty2kg3"
  9. program = "trrwXhMX"
  10.  
  11. --functions
  12.   function intro()
  13.     term.setBackgroundColour(colors.white)
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.     term.setTextColour(colors.green)
  17.     print(program.." -Written By: 0_Mr_Redstone_0  AKA  MoJoCreatior\n")
  18.   end
  19.  
  20.   function install()
  21.       fs.delete("setup.lua")
  22.       fs.delete("program.lua")
  23.       fs.delete("config/")
  24.       shell.run("pastebin get "..setup.." setup.lua")
  25.       shell.run("pastebin get "..program.." program.lua")
  26.       fs.delete("startup")
  27.       startup = fs.open("startup","w")
  28.       startup.write('shell.run("setup.lua")')
  29.       startup.close()
  30.       if fs.exists("config/update") == true then print("Updated")
  31.         else print("Installed")
  32.     end
  33.   end
  34.  
  35.   function configSave(name,data)
  36.     cfg = fs.open("config/"..name,"w")
  37.     cfg.write(data)
  38.     cfg.close()
  39.   end
  40.  
  41.   function RFAPI()
  42.     rfAPI = false
  43.     if peripheral.find("tile_thermalexpansion_cell_resonant_name") == nil then
  44.       else cube = peripheral.find("tile_thermalexpansion_cell_resonant_name")
  45.       rfAPI = true
  46.     end
  47.     if peripheral.find("tile_blockcapacitorbank_name") == nil then
  48.       else cube = peripheral.find("tile_blockcapacitorbank_name")
  49.       rfAPI = true
  50.     end
  51.   end
  52.  
  53.   function IC2Check()
  54.     IC2 = false
  55.     if peripheral.find("mfsu") == nil then
  56.       else cube = peripheral.find("mfsu")
  57.       IC2 = true
  58.     end
  59.     if peripheral.find("mfe") == nil then
  60.       else cube = peripheral.find("mfe")
  61.       IC2 = true
  62.     end
  63.     if peripheral.find("cesu") == nil then
  64.       else cube = peripheral.find("cesu")
  65.       IC2 = true
  66.     end
  67.     if peripheral.find("batbox") == nil then
  68.       else cube = peripheral.find("batbox")
  69.       IC2 = true
  70.     end
  71.   end
  72.  
  73.   function mekanismCheck()
  74.     mekanism = false
  75.     if peripheral.find("Basic Energy Cube") == nil then
  76.       else cube = peripheral.find("Basic Energy Cube")
  77.       mekanism = true
  78.     end
  79.     if peripheral.find("Advanced Energy Cube") == nil then
  80.       else cube = peripheral.find("Advanced Energy Cube")
  81.       mekanism = true
  82.     end
  83.     if peripheral.find("Elite Energy Cube") == nil then
  84.       else cube = peripheral.find("Elite Energy Cube")
  85.       mekanism = true
  86.     end
  87.     if peripheral.find("Ultimate Energy Cube") == nil then
  88.       else cube = peripheral.find("Ultimate Energy Cube")
  89.       mekanism = true
  90.     end
  91.     if peripheral.find("Induction Matrix") == nil then
  92.       else cube = peripheral.find("Induction Matrix")
  93.       mekanism = true
  94.     end
  95.   end
  96.  
  97.  
  98. RFAPI()
  99. IC2Check()
  100. mekanismCheck()
  101.  
  102. intro()
  103.  
  104. if peripheral.find("monitor") == nil then
  105.   print("Connect Monitor!") print("terminating") sleep(2.5) os.reboot()
  106. end
  107.  
  108. if rfAPI == true then
  109.   elseif IC2 == true then
  110.   elseif mekanism == true then
  111.   else print("Connect Energy Cell!") print("terminating") sleep(2.5) os.reboot()
  112. end
  113.  
  114. install()
  115. os.reboot()
Add Comment
Please, Sign In to add comment