Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.79 KB | None | 0 0
  1. local mon = peripheral.find("monitor")
  2. local core = peripheral.find("draconic_rf_storage")
  3. local tier = 0
  4. local colorShield = colors.white
  5. local colorCore = colors.white
  6. local input, output = peripheral.find("flux_gate")
  7. local limitTransfer = true
  8. local page = 1
  9. local putLimit = ""
  10. local version = "0.8"
  11.  
  12.  
  13. mon.setTextScale(1)
  14.  
  15. local function fileWrite(path, text)
  16. local file = io.open(path, "w")
  17. file:write(text)
  18. file:close()
  19. end
  20.  
  21. local function fileWriteFromTable(path, t)
  22. local text = ""
  23. for _, line in pairs(t) do
  24. text = text..line.."\n"
  25. end
  26. fileWrite(path, text)
  27. end
  28.  
  29. local function fileGetTable(path)
  30. if fs.exists(path) then
  31. local file = io.open(path, "r")
  32. local lines = {}
  33. local i = 1
  34. local line = file:read("*l")
  35. while line ~= nil do
  36. lines[i] = line
  37. line = file:read("*l")
  38. i = i +1
  39. end
  40. file:close()
  41. return lines
  42. end
  43. return {}
  44. end
  45.  
  46. local function fileReplaceLine(path, n, text)
  47. local lines = fileGetTable(path)
  48. lines[n] = text
  49. fileWriteFromTable(path, lines)
  50. end
  51.  
  52. local function fileAppend(path, text)
  53. local file = io.open(path, "a")
  54. file:write(text.."\n")
  55. file:close()
  56. end
  57.  
  58. local function fileGetLength(path)
  59. local file = io.open(path, "r")
  60. local i = 0
  61. while file:read("*l") ~= nil do
  62. i = i +1
  63. end
  64. file:close()
  65. return i
  66. end
  67.  
  68. local function fileGetLines(path, startN, endN)
  69. local lines = fileGetTable(path)
  70. local linesOut = {}
  71. local x = 1
  72. for i = startN, endN, 1 do
  73. linesOut[x] = lines[i]
  74. x = x + 1
  75. end
  76. return linesOut
  77. end
  78.  
  79. local function detectInOutput()
  80. input, output = peripheral.find("flux_gate")
  81. --print(input)
  82. --print(output)
  83. if core.getTransferPerTick() ~= 0 then
  84. if core.getTransferPerTick() < 0 then
  85. output.setSignalLowFlow(0)
  86. sleep(2)
  87. if core.getTransferPerTick() >= 0 then
  88. --keep it
  89. else
  90. output, input = peripheral.find("flux_gate")
  91. end
  92. output.setSignalLowFlow(2147483647)
  93. input.setSignalLowFlow(2147483647)
  94. elseif core.getTransferPerTick() > 0 then
  95. input.setSignalLowFlow(0)
  96. sleep(2)
  97. if core.getTransferPerTick() <= 0 then
  98. --keep it
  99. else
  100. output, input = peripheral.find("flux_gate")
  101. end
  102. output.setSignalLowFlow(2147483647)
  103. input.setSignalLowFlow(2147483647)
  104. end
  105. end
  106. end
  107.  
  108. if peripheral.find("flux_gate") == nil then
  109. limitTransfer = false
  110. else
  111. limitTransfer = true
  112. detectInOutput()
  113. end
  114.  
  115.  
  116. local function round(num, idp)
  117. local mult = 10^(idp or 0)
  118. return math.floor(num * mult + 0.5) / mult
  119. end
  120.  
  121. local function drawL1(xPos, yPos)
  122. mon.setCursorPos(xPos, yPos)
  123. mon.setBackgroundColor(colorCore)
  124. mon.write(" ")
  125. mon.setCursorPos(xPos, yPos+1)
  126. mon.write(" ")
  127. mon.setCursorPos(xPos, yPos+2)
  128. mon.write(" ")
  129. mon.setCursorPos(xPos, yPos+3)
  130. mon.write(" ")
  131. mon.setCursorPos(xPos, yPos+4)
  132. mon.setBackgroundColor(colorShield)
  133. mon.write(" ")
  134. mon.setCursorPos(xPos, yPos+5)
  135. mon.setBackgroundColor(colorCore)
  136. mon.write(" ")
  137. mon.setCursorPos(xPos, yPos+6)
  138. mon.write(" ")
  139. mon.setCursorPos(xPos, yPos+7)
  140. mon.setBackgroundColor(colorShield)
  141. mon.write(" ")
  142. mon.setCursorPos(xPos, yPos+8)
  143. mon.setBackgroundColor(colorCore)
  144. mon.write(" ")
  145. end
  146.  
  147. local function drawL2(xPos, yPos)
  148. mon.setCursorPos(xPos, yPos)
  149. mon.setBackgroundColor(colorCore)
  150. mon.write(" ")
  151. mon.setCursorPos(xPos, yPos+1)
  152. mon.write(" ")
  153. mon.setCursorPos(xPos, yPos+2)
  154. mon.write(" ")
  155. mon.setCursorPos(xPos, yPos+3)
  156. mon.write(" ")
  157. mon.setCursorPos(xPos, yPos+4)
  158. mon.write(" ")
  159. mon.setCursorPos(xPos, yPos+5)
  160. mon.setBackgroundColor(colorShield)
  161. mon.write(" ")
  162. mon.setCursorPos(xPos, yPos+6)
  163. mon.setBackgroundColor(colorCore)
  164. mon.write(" ")
  165. mon.setCursorPos(xPos, yPos+7)
  166. mon.write(" ")
  167. mon.setCursorPos(xPos, yPos+8)
  168. mon.write(" ")
  169. end
  170.  
  171. local function drawL3(xPos, yPos)
  172. mon.setCursorPos(xPos, yPos)
  173. mon.setBackgroundColor(colorCore)
  174. mon.write(" ")
  175. mon.setCursorPos(xPos, yPos+1)
  176. mon.write(" ")
  177. mon.setCursorPos(xPos, yPos+2)
  178. mon.setBackgroundColor(colorShield)
  179. mon.write(" ")
  180. mon.setCursorPos(xPos, yPos+3)
  181. mon.setBackgroundColor(colorCore)
  182. mon.write(" ")
  183. mon.setCursorPos(xPos, yPos+4)
  184. mon.write(" ")
  185. mon.setCursorPos(xPos, yPos+5)
  186. mon.write(" ")
  187. mon.setCursorPos(xPos, yPos+6)
  188. mon.setBackgroundColor(colorShield)
  189. mon.write(" ")
  190. mon.setCursorPos(xPos, yPos+7)
  191. mon.setBackgroundColor(colorCore)
  192. mon.write(" ")
  193. mon.setCursorPos(xPos, yPos+8)
  194. mon.write(" ")
  195. end
  196.  
  197. local function drawL4(xPos, yPos)
  198. mon.setCursorPos(xPos, yPos)
  199. mon.setBackgroundColor(colorCore)
  200. mon.write(" ")
  201. mon.setCursorPos(xPos, yPos+1)
  202. mon.write(" ")
  203. mon.setCursorPos(xPos, yPos+2)
  204. mon.write(" ")
  205. mon.setCursorPos(xPos, yPos+3)
  206. mon.setBackgroundColor(colorShield)
  207. mon.write(" ")
  208. mon.setCursorPos(xPos, yPos+4)
  209. mon.setBackgroundColor(colorCore)
  210. mon.write(" ")
  211. mon.setCursorPos(xPos, yPos+5)
  212. mon.write(" ")
  213. mon.setCursorPos(xPos, yPos+6)
  214. mon.write(" ")
  215. mon.setCursorPos(xPos, yPos+7)
  216. mon.setBackgroundColor(colorShield)
  217. mon.write(" ")
  218. mon.setCursorPos(xPos, yPos+8)
  219. mon.setBackgroundColor(colorCore)
  220. mon.write(" ")
  221. end
  222.  
  223. local function drawL5(xPos, yPos)
  224. mon.setCursorPos(xPos, yPos)
  225. mon.setBackgroundColor(colorShield)
  226. mon.write(" ")
  227. mon.setCursorPos(xPos, yPos+1)
  228. mon.setBackgroundColor(colorCore)
  229. mon.write(" ")
  230. mon.setCursorPos(xPos, yPos+2)
  231. mon.write(" ")
  232. mon.setCursorPos(xPos, yPos+3)
  233. mon.write(" ")
  234. mon.setCursorPos(xPos, yPos+4)
  235. mon.write(" ")
  236. mon.setCursorPos(xPos, yPos+5)
  237. mon.write(" ")
  238. mon.setCursorPos(xPos, yPos+6)
  239. mon.write(" ")
  240. mon.setCursorPos(xPos, yPos+7)
  241. mon.write(" ")
  242. mon.setCursorPos(xPos, yPos+8)
  243. mon.write(" ")
  244. end
  245.  
  246. local function drawL6(xPos, yPos)
  247. mon.setCursorPos(xPos, yPos)
  248. mon.setBackgroundColor(colorCore)
  249. mon.write(" ")
  250. mon.setCursorPos(xPos, yPos+1)
  251. mon.setBackgroundColor(colorShield)
  252. mon.write(" ")
  253. mon.setCursorPos(xPos, yPos+2)
  254. mon.setBackgroundColor(colorCore)
  255. mon.write(" ")
  256. mon.setCursorPos(xPos, yPos+3)
  257. mon.write(" ")
  258. mon.setCursorPos(xPos, yPos+4)
  259. mon.write(" ")
  260. mon.setCursorPos(xPos, yPos+5)
  261. mon.setBackgroundColor(colorShield)
  262. mon.write(" ")
  263. mon.setCursorPos(xPos, yPos+6)
  264. mon.setBackgroundColor(colorCore)
  265. mon.write(" ")
  266. mon.setCursorPos(xPos, yPos+7)
  267. mon.write(" ")
  268. mon.setCursorPos(xPos, yPos+8)
  269. mon.write(" ")
  270. end
  271.  
  272. local function drawL7(xPos, yPos)
  273. mon.setCursorPos(xPos, yPos)
  274. mon.setBackgroundColor(colorCore)
  275. mon.write(" ")
  276. mon.setCursorPos(xPos, yPos+1)
  277. mon.write(" ")
  278. mon.setCursorPos(xPos, yPos+2)
  279. mon.write(" ")
  280. mon.setCursorPos(xPos, yPos+3)
  281. mon.setBackgroundColor(colorShield)
  282. mon.write(" ")
  283. mon.setCursorPos(xPos, yPos+4)
  284. mon.setBackgroundColor(colorCore)
  285. mon.write(" ")
  286. mon.setCursorPos(xPos, yPos+5)
  287. mon.write(" ")
  288. mon.setCursorPos(xPos, yPos+6)
  289. mon.setBackgroundColor(colorShield)
  290. mon.write(" ")
  291. mon.setCursorPos(xPos, yPos+7)
  292. mon.setBackgroundColor(colorCore)
  293. mon.write(" ")
  294. mon.setCursorPos(xPos, yPos+8)
  295. mon.setBackgroundColor(colorShield)
  296. mon.write(" ")
  297. end
  298.  
  299. local function drawL8(xPos, yPos)
  300. mon.setCursorPos(xPos, yPos)
  301. mon.setBackgroundColor(colorCore)
  302. mon.write(" ")
  303. mon.setCursorPos(xPos, yPos+1)
  304. mon.write(" ")
  305. mon.setCursorPos(xPos, yPos+2)
  306. mon.write(" ")
  307. mon.setCursorPos(xPos, yPos+3)
  308. mon.write(" ")
  309. mon.setCursorPos(xPos, yPos+4)
  310. mon.setBackgroundColor(colorShield)
  311. mon.write(" ")
  312. mon.setCursorPos(xPos, yPos+5)
  313. mon.setBackgroundColor(colorCore)
  314. mon.write(" ")
  315. mon.setCursorPos(xPos, yPos+6)
  316. mon.write(" ")
  317. mon.setCursorPos(xPos, yPos+7)
  318. mon.write(" ")
  319. mon.setCursorPos(xPos, yPos+8)
  320. mon.write(" ")
  321. end
  322.  
  323. local function drawL9(xPos, yPos)
  324. mon.setCursorPos(xPos, yPos)
  325. mon.setBackgroundColor(colorCore)
  326. mon.write(" ")
  327. mon.setCursorPos(xPos, yPos+1)
  328. mon.setBackgroundColor(colorShield)
  329. mon.write(" ")
  330. mon.setCursorPos(xPos, yPos+2)
  331. mon.setBackgroundColor(colorCore)
  332. mon.write(" ")
  333. mon.setCursorPos(xPos, yPos+3)
  334. mon.write(" ")
  335. mon.setCursorPos(xPos, yPos+4)
  336. mon.write(" ")
  337. mon.setCursorPos(xPos, yPos+5)
  338. mon.write(" ")
  339. mon.setCursorPos(xPos, yPos+6)
  340. mon.write(" ")
  341. mon.setCursorPos(xPos, yPos+7)
  342. mon.setBackgroundColor(colorShield)
  343. mon.write(" ")
  344. mon.setCursorPos(xPos, yPos+8)
  345. mon.setBackgroundColor(colorCore)
  346. mon.write(" ")
  347. end
  348.  
  349. local function drawL10(xPos, yPos)
  350. mon.setCursorPos(xPos, yPos)
  351. mon.setBackgroundColor(colorCore)
  352. mon.write(" ")
  353. mon.setCursorPos(xPos, yPos+1)
  354. mon.write(" ")
  355. mon.setCursorPos(xPos, yPos+2)
  356. mon.setBackgroundColor(colorShield)
  357. mon.write(" ")
  358. mon.setCursorPos(xPos, yPos+3)
  359. mon.setBackgroundColor(colorCore)
  360. mon.write(" ")
  361. mon.setCursorPos(xPos, yPos+4)
  362. mon.write(" ")
  363. mon.setCursorPos(xPos, yPos+5)
  364. mon.setBackgroundColor(colorShield)
  365. mon.write(" ")
  366. mon.setCursorPos(xPos, yPos+6)
  367. mon.setBackgroundColor(colorCore)
  368. mon.write(" ")
  369. mon.setCursorPos(xPos, yPos+7)
  370. mon.write(" ")
  371. mon.setCursorPos(xPos, yPos+8)
  372. mon.setBackgroundColor(colorShield)
  373. mon.write(" ")
  374. end
  375.  
  376. local function drawL11(xPos, yPos)
  377. mon.setCursorPos(xPos, yPos)
  378. mon.setBackgroundColor(colorCore)
  379. mon.write(" ")
  380. mon.setCursorPos(xPos, yPos+1)
  381. mon.write(" ")
  382. mon.setCursorPos(xPos, yPos+2)
  383. mon.write(" ")
  384. mon.setCursorPos(xPos, yPos+3)
  385. mon.write(" ")
  386. mon.setCursorPos(xPos, yPos+4)
  387. mon.write(" ")
  388. mon.setCursorPos(xPos, yPos+5)
  389. mon.write(" ")
  390. mon.setCursorPos(xPos, yPos+6)
  391. mon.setBackgroundColor(colorShield)
  392. mon.write(" ")
  393. mon.setCursorPos(xPos, yPos+7)
  394. mon.setBackgroundColor(colorCore)
  395. mon.write(" ")
  396. mon.setCursorPos(xPos, yPos+8)
  397. mon.write(" ")
  398. end
  399.  
  400. local function drawL12(xPos, yPos)
  401. mon.setCursorPos(xPos, yPos)
  402. mon.setBackgroundColor(colorShield)
  403. mon.write(" ")
  404. mon.setCursorPos(xPos, yPos+1)
  405. mon.setBackgroundColor(colorCore)
  406. mon.write(" ")
  407. mon.setCursorPos(xPos, yPos+2)
  408. mon.write(" ")
  409. mon.setCursorPos(xPos, yPos+3)
  410. mon.write(" ")
  411. mon.setCursorPos(xPos, yPos+4)
  412. mon.write(" ")
  413. mon.setCursorPos(xPos, yPos+5)
  414. mon.write(" ")
  415. mon.setCursorPos(xPos, yPos+6)
  416. mon.write(" ")
  417. mon.setCursorPos(xPos, yPos+7)
  418. mon.write(" ")
  419. mon.setCursorPos(xPos, yPos+8)
  420. mon.write(" ")
  421. end
  422.  
  423. local function drawL13(xPos, yPos)
  424. mon.setCursorPos(xPos, yPos)
  425. mon.setBackgroundColor(colorCore)
  426. mon.write(" ")
  427. mon.setCursorPos(xPos, yPos+1)
  428. mon.write(" ")
  429. mon.setCursorPos(xPos, yPos+2)
  430. mon.write(" ")
  431. mon.setCursorPos(xPos, yPos+3)
  432. mon.setBackgroundColor(colorShield)
  433. mon.write(" ")
  434. mon.setCursorPos(xPos, yPos+4)
  435. mon.setBackgroundColor(colorCore)
  436. mon.write(" ")
  437. mon.setCursorPos(xPos, yPos+5)
  438. mon.write(" ")
  439. mon.setCursorPos(xPos, yPos+6)
  440. mon.setBackgroundColor(colorShield)
  441. mon.write(" ")
  442. mon.setCursorPos(xPos, yPos+7)
  443. mon.setBackgroundColor(colorCore)
  444. mon.write(" ")
  445. mon.setCursorPos(xPos, yPos+8)
  446. mon.write(" ")
  447. end
  448.  
  449. local function drawBox(xMin, xMax, yMin, yMax, title)
  450. mon.setBackgroundColor(colors.gray)
  451. for xPos = xMin, xMax, 1 do
  452. mon.setCursorPos(xPos, yMin)
  453. mon.write(" ")
  454. end
  455. for yPos = yMin, yMax, 1 do
  456. mon.setCursorPos(xMin, yPos)
  457. mon.write(" ")
  458. mon.setCursorPos(xMax, yPos)
  459. mon.write(" ")
  460. end
  461. for xPos = xMin, xMax, 1 do
  462. mon.setCursorPos(xPos, yMax)
  463. mon.write(" ")
  464. end
  465. mon.setCursorPos(xMin+2, yMin)
  466. mon.setBackgroundColor(colors.black)
  467. mon.write(" ")
  468. mon.write(title)
  469. mon.write(" ")
  470. end
  471.  
  472. local function drawButton(xMin, xMax, yMin, yMax, text1, text2, bcolor)
  473. mon.setBackgroundColor(bcolor)
  474. for yPos = yMin, yMax, 1 do
  475. for xPos = xMin, xMax, 1 do
  476. mon.setCursorPos(xPos, yPos)
  477. mon.write(" ")
  478. end
  479. end
  480. mon.setCursorPos(math.floor((((xMax+xMin)/2)+0.5)-string.len(text1)/2),math.floor(((yMax+yMin)/2)))
  481. mon.write(text1)
  482. if text2 == nil then
  483. else
  484. mon.setCursorPos(math.floor((((xMax+xMin)/2)+0.5)-string.len(text2)/2),math.floor(((yMax+yMin)/2)+0.5))
  485. mon.write(text2)
  486. end
  487. mon.setBackgroundColor(colors.black)
  488. end
  489.  
  490. local function drawClear(xMin, xMax, yMin, yMax)
  491. mon.setBackgroundColor(colors.black)
  492. for yPos = yMin, yMax, 1 do
  493. for xPos = xMin, xMax, 1 do
  494. mon.setCursorPos(xPos, yPos)
  495. mon.write(" ")
  496. end
  497. end
  498. end
  499.  
  500.  
  501.  
  502. local function drawDetails(xPos, yPos)
  503. energyStored = core.getEnergyStored()
  504. energyMax = core.getMaxEnergyStored()
  505. energyTransfer = core.getTransferPerTick()
  506. if limitTransfer == true then
  507. inputRate = input.getFlow()
  508. outputRate = output.getFlow()
  509. end
  510. mon.setCursorPos(xPos, yPos)
  511. if energyMax < 50000000 then
  512. tier = 1
  513. elseif energyMax < 300000000 then
  514. tier = 2
  515. elseif energyMax < 2000000000 then
  516. tier = 3
  517. elseif energyMax < 10000000000 then
  518. tier = 4
  519. elseif energyMax < 50000000000 then
  520. tier = 5
  521. elseif energyMax < 400000000000 then
  522. tier = 6
  523. elseif energyMax < 3000000000000 then
  524. tier = 7
  525. else
  526. tier = 8
  527. end
  528. mon.write("Tier: ")
  529. mon.write(tier)
  530. mon.setCursorPos(xPos+7, yPos)
  531. mon.write(" ")
  532. mon.setCursorPos(xPos, yPos+1)
  533. mon.write("Stored: ")
  534. if energyStored < 1000 then
  535. mon.write(energyStored)
  536. elseif energyStored < 1000000 then
  537. mon.write(round((energyStored/1000),1))
  538. mon.write("k")
  539. elseif energyStored < 1000000000 then
  540. mon.write(round((energyStored/1000000),1))
  541. mon.write("M")
  542. elseif energyStored < 1000000000000 then
  543. mon.write(round((energyStored/1000000000),1))
  544. mon.write("G")
  545. elseif energyStored < 1000000000000000 then
  546. mon.write(round((energyStored/1000000000000),1))
  547. mon.write("T")
  548. elseif energyStored < 1000000000000000000 then
  549. mon.write(round((energyStored/1000000000000000),1))
  550. mon.write("P")
  551. elseif energyStored < 1000000000000000000000 then
  552. mon.write(round((energyStored/1000000000000000000),1))
  553. mon.write("E")
  554. end
  555. mon.write("RF")
  556. mon.write("/")
  557. if energyMax < 1000 then
  558. mon.write(energyMax)
  559. elseif energyMax < 1000000 then
  560. mon.write(round((energyMax/1000),1))
  561. mon.write("k")
  562. elseif energyMax < 1000000000 then
  563. mon.write(round((energyMax/1000000),1))
  564. mon.write("M")
  565. elseif energyMax < 1000000000000 then
  566. mon.write(round((energyMax/1000000000),1))
  567. mon.write("G")
  568. elseif energyMax < 1000000000000000 then
  569. mon.write(round((energyMax/1000000000000),1))
  570. mon.write("T")
  571. elseif energyMax < 1000000000000000000 then
  572. mon.write(round((energyMax/1000000000000000 ),1))
  573. mon.write("P")
  574. elseif energyMax < 1000000000000000000000 then
  575. mon.write(round((energyMax/1000000000000000000),1))
  576. mon.write("E")
  577. end
  578. mon.write("RF")
  579. mon.setCursorPos(xPos, yPos+2)
  580. mon.setBackgroundColor(colors.lightGray)
  581. for l = 1, 20, 1 do
  582. mon.write(" ")
  583. end
  584. mon.setCursorPos(xPos, yPos+2)
  585. mon.setBackgroundColor(colors.lime)
  586. for l = 0, round((((energyStored/energyMax)*10)*2)-1,0), 1 do
  587. mon.write(" ")
  588. end
  589. mon.setCursorPos(xPos, yPos+3)
  590. mon.setBackgroundColor(colors.lightGray)
  591. for l = 1, 20, 1 do
  592. mon.write(" ")
  593. end
  594. mon.setCursorPos(xPos, yPos+3)
  595. mon.setBackgroundColor(colors.lime)
  596. for l = 0, round((((energyStored/energyMax)*10)*2)-1,0), 1 do
  597. mon.write(" ")
  598. end
  599. mon.setBackgroundColor(colors.black)
  600. mon.setCursorPos(xPos, yPos+4)
  601. mon.write(" ")
  602. if string.len(tostring(round((energyStored/energyMax)*100))) == 1 then
  603. if round((energyStored/energyMax)*100) <= 10 then
  604. mon.setCursorPos(xPos, yPos+4)
  605. mon.write(round((energyStored/energyMax)*100))
  606. mon.setCursorPos(xPos+1, yPos+4)
  607. mon.write("% ")
  608. else
  609. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-10)/5), yPos+4)
  610. mon.write(round((energyStored/energyMax)*100))
  611. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-10)/5)+1, yPos+4)
  612. mon.write("% ")
  613. end
  614. elseif string.len(tostring(round((energyStored/energyMax)*100))) == 2 then
  615. if round((energyStored/energyMax)*100) <= 15 then
  616. mon.setCursorPos(xPos, yPos+4)
  617. mon.write(round((energyStored/energyMax)*100))
  618. mon.setCursorPos(xPos+2, yPos+4)
  619. mon.write("% ")
  620. else
  621. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-15)/5), yPos+4)
  622. mon.write(round((energyStored/energyMax)*100))
  623. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-15)/5)+2, yPos+4)
  624. mon.write("% ")
  625. end
  626. elseif string.len(tostring(round((energyStored/energyMax)*100))) == 3 then
  627. if round((energyStored/energyMax)*100) <= 20 then
  628. mon.setCursorPos(xPos, yPos+4)
  629. mon.write(round((energyStored/energyMax)*100))
  630. mon.setCursorPos(xPos+3, yPos+4)
  631. mon.write("% ")
  632. else
  633. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-20)/5), yPos+4)
  634. mon.write(round((energyStored/energyMax)*100))
  635. mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-20)/5)+3, yPos+4)
  636. mon.write("% ")
  637. end
  638. end
  639. mon.setCursorPos(xPos, yPos+5)
  640. mon.write("InputMax:")
  641. mon.setCursorPos(xPos, yPos+6)
  642. mon.write(" ")
  643. mon.setCursorPos(xPos, yPos+6)
  644. mon.setTextColor(colors.lime)
  645. if limitTransfer == true then
  646. if inputRate == 0 then
  647. mon.setTextColor(colors.red)
  648. end
  649. if inputRate < 1000 then
  650. mon.write(inputRate)
  651. elseif inputRate < 1000000 then
  652. mon.write(round((inputRate/1000),1))
  653. mon.write("k")
  654. elseif inputRate < 1000000000 then
  655. mon.write(round((inputRate/1000000),1))
  656. mon.write("M")
  657. elseif inputRate < 1000000000000 then
  658. mon.write(round((inputRate/1000000000),1))
  659. mon.write("G")
  660. elseif inputRate < 1000000000000000 then
  661. mon.write(round((inputRate/1000000000000),1))
  662. mon.write("T")
  663. elseif inputRate < 1000000000000000000 then
  664. mon.write(round((inputRate/1000000000000000 ),1))
  665. mon.write("P")
  666. elseif inputRate < 1000000000000000000000 then
  667. mon.write(round((inputRate/1000000000000000000),1))
  668. mon.write("E")
  669. end
  670. mon.write("RF")
  671. else
  672. mon.write("INFINITE")
  673. end
  674. mon.setTextColor(colors.white)
  675. mon.setCursorPos(xPos+12, yPos+5)
  676. mon.write("OutputMax:")
  677. mon.setCursorPos(xPos+12, yPos+6)
  678. mon.write(" ")
  679. mon.setTextColor(colors.red)
  680. mon.setCursorPos(xPos+12, yPos+6)
  681. if limitTransfer == true then
  682. if outputRate < 1000 then
  683. mon.write(outputRate)
  684. elseif outputRate < 1000000 then
  685. mon.write(round((outputRate/1000),1))
  686. mon.write("k")
  687. elseif outputRate < 1000000000 then
  688. mon.write(round((outputRate/1000000),1))
  689. mon.write("M")
  690. elseif outputRate < 1000000000000 then
  691. mon.write(round((outputRate/1000000000),1))
  692. mon.write("G")
  693. elseif outputRate < 1000000000000000 then
  694. mon.write(round((outputRate/1000000000000),1))
  695. mon.write("T")
  696. elseif outputRate < 1000000000000000000 then
  697. mon.write(round((outputRate/1000000000000000),1))
  698. mon.write("P")
  699. elseif outputRate < 1000000000000000000000 then
  700. mon.write(round((outputRate/1000000000000000000),1))
  701. mon.write("E")
  702. end
  703. mon.write("RF")
  704. else
  705. mon.write("INFINITE")
  706. end
  707. mon.setTextColor(colors.white)
  708. mon.setCursorPos(xPos, yPos+7)
  709. mon.write("Transfer:")
  710. mon.setCursorPos(xPos, yPos+8)
  711. if energyTransfer < 0 then
  712. mon.setTextColor(colors.red)
  713. if energyTransfer*(-1) < 1000 then
  714. mon.write(energyTransfer)
  715. elseif energyTransfer*(-1) < 1000000 then
  716. mon.write(round((energyTransfer/1000),1))
  717. mon.write("k")
  718. elseif energyTransfer*(-1) < 1000000000 then
  719. mon.write(round((energyTransfer/1000000),1))
  720. mon.write("M")
  721. elseif energyTransfer*(-1) < 1000000000000 then
  722. mon.write(round((energyTransfer/1000000000),1))
  723. mon.write("G")
  724. elseif energyTransfer*(-1) < 1000000000000000 then
  725. mon.write(round((energyTransfer/1000000000000),1))
  726. mon.write("T")
  727. elseif energyTransfer*(-1) < 1000000000000000000 then
  728. mon.write(round((energyTransfer/1000000000000000),1))
  729. mon.write("P")
  730. elseif energyTransfer*(-1) < 1000000000000000000000 then
  731. mon.write(round((energyTransfer/1000000000000000000),1))
  732. mon.write("E")
  733. end
  734. elseif energyTransfer == 0 then
  735. mon.setTextColor(colors.red)
  736. mon.write("0")
  737. else
  738. mon.setTextColor(colors.lime)
  739. if energyTransfer < 1000 then
  740. mon.write(energyTransfer)
  741. elseif energyTransfer < 1000000 then
  742. mon.write(round((energyTransfer/1000),1))
  743. mon.write("k")
  744. elseif energyTransfer < 1000000000 then
  745. mon.write(round((energyTransfer/1000000),1))
  746. mon.write("M")
  747. elseif energyTransfer < 1000000000000 then
  748. mon.write(round((energyTransfer/1000000000),1))
  749. mon.write("G")
  750. elseif energyTransfer < 1000000000000000 then
  751. mon.write(round((energyTransfer/1000000000000),1))
  752. mon.write("T")
  753. elseif energyTransfer < 1000000000000000000 then
  754. mon.write(round((energyTransfer/1000000000000000),1))
  755. mon.write("P")
  756. elseif energyTransfer < 1000000000000000000000 then
  757. mon.write(round((energyTransfer/1000000000000000000),1))
  758. mon.write("E")
  759. end
  760. end
  761. mon.write("RF")
  762. mon.setTextColor(colors.white)
  763. mon.setCursorPos(xPos+12, yPos+7)
  764. mon.write("Limited:")
  765. mon.setCursorPos(xPos+12, yPos+8)
  766. if limitTransfer == true then
  767. mon.setTextColor(colors.lime)
  768. mon.write("On")
  769. else
  770. mon.setTextColor(colors.red)
  771. mon.write("Off")
  772. end
  773. mon.setTextColor(colors.white)
  774. end
  775.  
  776. local function drawAll()
  777. while true do
  778. mon.clear()
  779. versionText = "Version "..version.." by TheAzylium"
  780. verPos = 51 - string.len(versionText)
  781. mon.setCursorPos(verPos,26)
  782. mon.setTextColor(colors.gray)
  783. mon.write(versionText)
  784. mon.setTextColor(colors.white)
  785. drawBox(2,20,2,14,"ENERGY CORE")
  786. drawBox(22,49,2,14,"DETAILS")
  787. yPos = 4
  788. xMin = 5
  789. for xPos = xMin, xMin+12, 1 do
  790. drawDetails(24,4)
  791. if tier <= 7 then
  792. colorShield = colors.lightBlue
  793. colorCore = colors.cyan
  794. else
  795. colorShield = colors.yellow
  796. colorCore = colors.orange
  797. end
  798. xPos1 = xPos
  799. if xPos1 >= xMin+13 then
  800. xPos1a = xPos1 - 13
  801. drawL1(xPos1a, yPos)
  802. else
  803. drawL1(xPos1, yPos)
  804. end
  805. xPos2 = xPos + 1
  806. if xPos2 >= xMin+13 then
  807. xPos2a = xPos2 - 13
  808. drawL2(xPos2a, yPos)
  809. else
  810. drawL2(xPos2, yPos)
  811. end
  812. xPos3 = xPos + 2
  813. if xPos3 >= xMin+13 then
  814. xPos3a = xPos3 - 13
  815. drawL3(xPos3a, yPos)
  816. else
  817. drawL3(xPos3, yPos)
  818. end
  819. xPos4 = xPos + 3
  820. if xPos4 >= xMin+13 then
  821. xPos4a = xPos4 - 13
  822. drawL4(xPos4a, yPos)
  823. else
  824. drawL4(xPos4, yPos)
  825. end
  826. xPos5 = xPos + 4
  827. if xPos5 >= xMin+13 then
  828. xPos5a = xPos5 - 13
  829. drawL5(xPos5a, yPos)
  830. else
  831. drawL5(xPos5, yPos)
  832. end
  833. xPos6 = xPos + 5
  834. if xPos6 >= xMin+13 then
  835. xPos6a = xPos6 - 13
  836. drawL6(xPos6a, yPos)
  837. else
  838. drawL6(xPos6, yPos)
  839. end
  840. xPos7 = xPos + 6
  841. if xPos7 >= xMin+13 then
  842. xPos7a = xPos7 - 13
  843. drawL7(xPos7a, yPos)
  844. else
  845. drawL7(xPos7, yPos)
  846. end
  847. xPos8 = xPos + 7
  848. if xPos8 >= xMin+13 then
  849. xPos8a = xPos8 - 13
  850. drawL8(xPos8a, yPos)
  851. else
  852. drawL8(xPos8, yPos)
  853. end
  854. xPos9 = xPos + 8
  855. if xPos9 >= xMin+13 then
  856. xPos9a = xPos9 - 13
  857. drawL9(xPos9a, yPos)
  858. else
  859. drawL9(xPos9, yPos)
  860. end
  861. xPos10 = xPos + 9
  862. if xPos10 >= xMin+13 then
  863. xPos10a = xPos10 - 13
  864. drawL10(xPos10a, yPos)
  865. else
  866. drawL10(xPos10, yPos)
  867. end
  868. xPos11 = xPos + 10
  869. if xPos11 >= xMin+13 then
  870. xPos11a = xPos11 - 13
  871. drawL11(xPos11a, yPos)
  872. else
  873. drawL11(xPos11, yPos)
  874. end
  875. xPos12 = xPos + 11
  876. if xPos12 >= xMin+13 then
  877. xPos12a = xPos12 - 13
  878. drawL12(xPos12a, yPos)
  879. else
  880. drawL12(xPos12, yPos)
  881. end
  882. xPos13 = xPos + 12
  883. if xPos13 >= xMin+13 then
  884. xPos13a = xPos13 - 13
  885. drawL13(xPos13a, yPos)
  886. else
  887. drawL13(xPos13, yPos)
  888. end
  889. mon.setBackgroundColor(colors.black)
  890. mon.setCursorPos(xMin, yPos)
  891. mon.write(" ")
  892. mon.setCursorPos(xMin+10, yPos)
  893. mon.write(" ")
  894. mon.setCursorPos(xMin, yPos+1)
  895. mon.write(" ")
  896. mon.setCursorPos(xMin+12, yPos+1)
  897. mon.write(" ")
  898. mon.setCursorPos(xMin, yPos+7)
  899. mon.write(" ")
  900. mon.setCursorPos(xMin+12, yPos+7)
  901. mon.write(" ")
  902. mon.setCursorPos(xMin, yPos+8)
  903. mon.write(" ")
  904. mon.setCursorPos(xMin+10, yPos+8)
  905. mon.write(" ")
  906. mon.setCursorPos(51 - 8,1)
  907. sleep(1)
  908. end
  909. end
  910. end
  911.  
  912.  
  913.  
  914. while true do
  915. parallel.waitForAny(drawAll)
  916. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement