Advertisement
iStundt

Untitled

Mar 13th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 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 = "hyB8EzPp"
  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. if peripheral.find("extrautils_generatorsolar") == nil then
  52. else cube = peripheral.find("extrautils_generatorsolar")
  53. rfAPI = true
  54. end
  55. end
  56.  
  57. function IC2Check()
  58. IC2 = false
  59. if peripheral.find("mfsu") == nil then
  60. else cube = peripheral.find("mfsu")
  61. IC2 = true
  62. end
  63. if peripheral.find("mfe") == nil then
  64. else cube = peripheral.find("mfe")
  65. IC2 = true
  66. end
  67. if peripheral.find("cesu") == nil then
  68. else cube = peripheral.find("cesu")
  69. IC2 = true
  70. end
  71. if peripheral.find("batbox") == nil then
  72. else cube = peripheral.find("batbox")
  73. IC2 = true
  74. end
  75. end
  76.  
  77. function mekanismCheck()
  78. mekanism = false
  79. if peripheral.find("Basic Energy Cube") == nil then
  80. else cube = peripheral.find("Basic Energy Cube")
  81. mekanism = true
  82. end
  83. if peripheral.find("Advanced Energy Cube") == nil then
  84. else cube = peripheral.find("Advanced Energy Cube")
  85. mekanism = true
  86. end
  87. if peripheral.find("Elite Energy Cube") == nil then
  88. else cube = peripheral.find("Elite Energy Cube")
  89. mekanism = true
  90. end
  91. if peripheral.find("Ultimate Energy Cube") == nil then
  92. else cube = peripheral.find("Ultimate Energy Cube")
  93. mekanism = true
  94. end
  95. if peripheral.find("mekanism_machine") == nil then
  96. else cube = peripheral.find("mekanism_machine")
  97. mekanism = true
  98. end
  99. end
  100.  
  101.  
  102. RFAPI()
  103. IC2Check()
  104. mekanismCheck()
  105.  
  106. intro()
  107.  
  108. if peripheral.find("monitor") == nil then
  109. print("Connect Monitor!") print("terminating") sleep(2.5) os.reboot()
  110. end
  111.  
  112. if rfAPI == true then
  113. elseif IC2 == true then
  114. elseif mekanism == true then
  115. else print("Connect Energy Cell!") print("terminating") sleep(2.5) os.reboot()
  116. end
  117.  
  118. install()
  119. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement