View difference between Paste ID: 9qjQjL35 and zp9yVDgd
SHOW: | | - or go back to the newest paste.
1-
local comp = require("component")
1+
local comp = require("component")
2-
local sides = require("sides")
2+
local sides = require("sides")
3-
local capacitor = comp.capacitor_bank
3+
local capacitor = comp.draconic_rf_storage
4-
local term = require("term")
4+
local term = require("term")
5-
5+
6-
local maxEnergy = capacitor.getMaxEnergyStored()
6+
local maxEnergy = capacitor.getMaxEnergyStored()
7-
7+
8-
function typeOnScreen(perc)
8+
function typeOnScreen(perc)
9-
  term.setCursor(15, 1)
9+
  term.setCursor(15, 1)
10-
  lenPerc = string.len(perc)
10+
  lenPerc = string.len(perc)
11-
  if lenPerc == 1 then
11+
  if lenPerc == 1 then
12-
    term.write("  " .. perc .."%\n")
12+
    term.write("  " .. perc .."%\n")
13-
  elseif lenPerc == 2 then
13+
  elseif lenPerc == 2 then
14-
    term.write(" " .. perc .."%\n")
14+
    term.write(" " .. perc .."%\n")
15-
  elseif lenPerc == 3 then
15+
  elseif lenPerc == 3 then
16-
    term.write(perc .. "%\n")
16+
    term.write(perc .. "%\n")
17-
  end
17+
  end
18-
  term.setCursor(17, 5)
18+
  term.setCursor(17, 5)
19-
  print (capacitor.getEnergyStored())
19+
  print (capacitor.getEnergyStored())
20-
end
20+
  term.setCursor(15, 6)
21-
21+
  print(capacitor.getTransferPerTick() .. " RF/t")
22-
22+
end
23-
function main()
23+
24-
  term.clear()
24+
25-
  print ("Capacitors at ")
25+
function main()
26-
  print ("\n\nTotal energy:   " .. maxEnergy)
26+
  comp.gpu(setResolution(120, 32)
27-
  print ("Current Energy: ")
27+
  term.clear()
28-
  while true do
28+
  print ("Capacitors at ")
29-
    energyStored = capacitor.getEnergyStored()
29+
  print ("\n\nTotal energy:   " .. maxEnergy)
30-
    energyPerc = math.floor((energyStored / maxEnergy) * 100)
30+
  print ("Current Energy: ")
31-
    if energyPerc <= 40 then
31+
  print ("Current rate: ")
32-
      comp.redstone.setOutput(sides.right, 0)
32+
  while true do
33-
    elseif energyPerc >= 95 then
33+
    energyStored = capacitor.getEnergyStored()
34-
      comp.redstone.setOutput(sides.right, 15)
34+
    energyPerc = math.floor((energyStored / maxEnergy) * 100)
35-
    end
35+
    if energyPerc <= 40 then
36-
    typeOnScreen(energyPerc)
36+
      comp.redstone.setOutput(sides.right, 0)
37-
    os.sleep(2)
37+
    elseif energyPerc >= 95 then
38-
  end
38+
      comp.redstone.setOutput(sides.right, 15)
39-
end
39+
    end
40-
40+
    typeOnScreen(energyPerc)
41-
41+
    os.sleep(2)
42
  end
43
end
44
45
46
main()