Advertisement
Simlor_GER

SappS - BigReactors (Kein Installer)

Dec 11th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. --Alle Rechte am nachfolgenden Programm Code sind "SimlorLP" (oder in Minecraft auch nur "Simlor") vorbehalten.
  2. term.setBackgroundColor(128)
  3. term.clear()
  4.  
  5. term.setBackgroundColor(1)
  6. term.setCursorPos(1,4)
  7. print(" ")
  8. print(" ")
  9. print(" ")
  10.  
  11. term.setCursorPos(14,5)
  12. term.setTextColor(128)
  13. write("SimSoft - ")
  14. term.setTextColor(128)
  15. print("Big Reactors")
  16.  
  17. --Variablen
  18.  
  19. file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","r")
  20. local fileData = {}
  21. local line = file.readLine()
  22. repeat
  23. table.insert(fileData,line)
  24. line = file.readLine()
  25. until line == nil
  26. file.close()
  27.  
  28. sps = fileData[1]
  29.  
  30. sps = (sps+1)
  31. sps = (sps-1)
  32.  
  33. --Functionen
  34.  
  35.  
  36.  
  37. function GraMenu()
  38.  
  39. while true do
  40.  
  41. local reactor = peripheral.wrap("BigReactors-Reactor_"..id)
  42. term.setBackgroundColor(128)
  43. shell.run("clear")
  44. term.setTextColor(32768)
  45. term.setCursorPos(3,2)
  46. print("SimSoft - BigReactor-SappS")
  47.  
  48. term.setCursorPos(1,4)
  49. term.setBackgroundColor(256)
  50. print(" ")
  51. print(" ")
  52. print(" ")
  53. print(" ")
  54. print(" ")
  55. print(" ")
  56. print(" ")
  57.  
  58. term.setCursorPos(2,18)
  59. term.setTextColor(256)
  60. term.setBackgroundColor(128)
  61. print("Verlassen")
  62.  
  63. term.setBackgroundColor(256)
  64.  
  65. term.setCursorPos(4,5)
  66. term.setTextColor(1)
  67. print("Speicher : ",reactor.getEnergyStored(),"RF von 10000000RF")
  68.  
  69. term.setCursorPos(4,7)
  70. term.setTextColor(128)
  71. print("Temperatur : ",reactor.getFuelTemperature())
  72. tem = reactor.getFuelTemperature()
  73. if tem > 100 and tem < 1000 then
  74. term.setCursorPos(22,7)
  75. print("C ")
  76. elseif tem > 1000 and tem < 10000 then
  77. term.setCursorPos(23,7)
  78. print("C ")
  79. elseif tem > 10000 and tem < 100000 then
  80. term.setCursorPos(24,7)
  81. print("C ")
  82. elseif tem > 100000 then
  83. term.setCursorPos(25,7)
  84. print("C ")
  85. else
  86. term.setCursorPos(21,7)
  87. print("C ")
  88. end
  89.  
  90. term.setBackgroundColor(128)
  91. term.setCursorPos(36,18)
  92. term.setTextColor(256)
  93. print("Reaktor ein/aus")
  94.  
  95. term.setBackgroundColor(128)
  96. term.setCursorPos(2,12)
  97. term.setTextColor(256)
  98. write("Abschalten bei ")
  99. term.setTextColor(1)
  100. write(sps)
  101. write("%")
  102. term.setTextColor(256)
  103. print(" Speicher belegung")
  104.  
  105. term.setBackgroundColor(256)
  106. term.setCursorPos(4,9)
  107. term.setTextColor(1)
  108. ak = reactor.getActive()
  109.  
  110. if ak == true then
  111. aka = "Aktiv"
  112. else
  113. aka = "Inaktiv"
  114. end
  115.  
  116. print("Status : ",aka)
  117.  
  118. sleep(0.4)
  119.  
  120. end
  121. end
  122.  
  123.  
  124. function UeberW()
  125. while true do
  126. local reactor = peripheral.wrap("BigReactors-Reactor_"..id)
  127.  
  128. sna = reactor.getEnergyStored()
  129.  
  130. if ak == true then
  131.  
  132. if sps == 0 then
  133.  
  134. elseif sps == 25 and sna > 2500000 then
  135. reactor.setActive(false)
  136. elseif sps == 25 and sna < 2500000 then
  137. reactor.setActive(true)
  138.  
  139. elseif sps == 50 and sna > 5000000 then
  140. reactor.setActive(false)
  141. elseif sps == 50 and sna < 5000000 then
  142. reactor.setActive(true)
  143.  
  144. elseif sps == 75 and sna > 7500000 then
  145. reactor.setActive(false)
  146. elseif sps == 75 and sna < 7500000 then
  147. reactor.setActive(true)
  148.  
  149. elseif sps == 100 and sna > 9999999 then
  150. reactor.setActive(false)
  151. elseif sps == 100 and sna < 9999999 then
  152. reactor.setActive(true)
  153. end
  154. end
  155. sleep(1)
  156. end
  157. end
  158.  
  159.  
  160. function TouchMenu()
  161. while true do
  162. event,side,x,y = os.pullEvent()
  163. if event == "mouse_click" then
  164.  
  165. local reactor = peripheral.wrap("BigReactors-Reactor_"..id)
  166.  
  167. if x >= 2 and x <= 10 and y == 18 then
  168. break
  169. end
  170.  
  171. if x >= 36 and x <= 50 and y == 18 then
  172. if ak == true then
  173. reactor.setActive(false)
  174. elseif ak == false then
  175. reactor.setActive(true)
  176. end
  177. end
  178.  
  179. if x >= 17 and x <= 20 and y == 12 then
  180.  
  181. if sps == 0 then
  182. sps = 25
  183. local file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","w")
  184. file.writeLine(sps)
  185. file.close()
  186. elseif sps == 25 then
  187. sps = 50
  188. local file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","w")
  189. file.writeLine(sps)
  190. file.close()
  191. elseif sps == 50 then
  192. sps = 75
  193. local file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","w")
  194. file.writeLine(sps)
  195. file.close()
  196. elseif sps == 75 then
  197. sps = 100
  198. local file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","w")
  199. file.writeLine(sps)
  200. file.close()
  201. elseif sps == 100 then
  202. sps = 0
  203. local file = fs.open("SimSoft/SappS/BigReactorOrdner/daten","w")
  204. file.writeLine(sps)
  205. file.close()
  206. end
  207. end
  208. end
  209. end
  210. end
  211.  
  212.  
  213.  
  214. --Reaktor Suche
  215.  
  216.  
  217.  
  218. term.setBackgroundColor(128)
  219. term.clear()
  220.  
  221. term.setCursorPos(2,2)
  222. term.setTextColor(1)
  223. print("Reaktor Verbindung herstellen")
  224.  
  225. term.setBackgroundColor(256)
  226. term.setCursorPos(1,4)
  227. print(" ")
  228. print(" ")
  229. print(" ")
  230.  
  231. term.setCursorPos(4,5)
  232. term.setTextColor(128)
  233. print("Reaktor ID:")
  234.  
  235. term.setTextColor(1)
  236. term.setCursorPos(16,5)
  237. id = read()
  238.  
  239. local reactor = peripheral.wrap("BigReactors-Reactor_"..id)
  240.  
  241. con = reactor
  242.  
  243. if con == fasle then
  244.  
  245. term.setCursorPos(1,9)
  246. term.setBackgroundColor(256)
  247. print(" ")
  248. print(" ")
  249. print(" ")
  250.  
  251. term.setCursorPos(4,10)
  252. term.setTextColor(16384)
  253. print("Die ID konnte nicht gefunden werden :/")
  254. sleep(2)
  255.  
  256. else
  257.  
  258. term.setCursorPos(1,9)
  259. term.setBackgroundColor(256)
  260. print(" ")
  261. print(" ")
  262. print(" ")
  263.  
  264. term.setCursorPos(4,10)
  265. term.setTextColor(32)
  266. print("Verbinde...")
  267. end
  268.  
  269.  
  270.  
  271.  
  272.  
  273. --Hauptteil
  274.  
  275. parallel.waitForAny(function() GraMenu() end,function() TouchMenu() end, function() UeberW() end)
  276.  
  277. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement