Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component = require("component")
- sides = require("sides")
- term = require("term")
- gpu = component.gpu
- if component.draconic_rf_storage ~= nil then
- draco = component.draconic_rf_storage
- print("Core Found, Wrapped!")
- os.sleep(1)
- else
- print("Core not found..")
- os.sleep(1)
- end
- colors = { black = 0x000000, white = 0xf8f8ff, blue = 0x0000ff, lightGray = 0xd9d9d9, red = 0xff0000,
- purple = 0x9b30ff, carrot = 0xffa500, magenta = 0xcd00cd, lightBlue = 0x87cefa, yellow = 0xffff00,
- lime = 0x32cd32, pink = 0xffc0cb, gray = 0x696969, brown = 0x8b4500, green = 0x006400, cyan = 0x008b8b,
- olive = 0x6b8e23, gold = 0x8b6914, orangered = 0xdb4e02, diamond = 0x0fa7c7,crimson = 0xaf002a,fuchsia = 0xfd3f92,
- folly = 0xff004f, frenchBlue = 0x0072bb, lilac = 0x86608e, flax = 0xeedc82, darkGray = 0x563c5c,
- englishGreen = 0x1b4d3e, eggplant = 0x614051, deepPink = 0xff1493, ruby = 0x843f5b, orange = 0xf5c71a,
- lemon = 0xffd300, darkBlue = 0x002e63, bitterLime = 0xbfff00
- }
- -------------------------
- --Vars --
- Border_bg = colors.white
- Default_bg = colors.gray
- text_col = colors.white
- Tier = nil
- ---------
- -- Resolution --
- gpu.setResolution(54,7)
- -------------------------
- -- Functions --
- function guiBorders(x,y,len,height,str)
- gpu.setBackground(Border_bg)
- gpu.fill(x,y,len,height,str)
- gpu.setBackground(Default_bg)
- end
- function GUI()
- gpu.setBackground(Default_bg)
- term.clear()
- w, h = gpu.getResolution()
- guiBorders(1,1,w,1," ")
- for i = 1,h do
- guiBorders(1,i,1,1," ")
- guiBorders(w,i,1,1," ")
- end
- guiBorders(1,h,w,1," ")
- gpu.setForeground(text_col)
- end
- function Center(y,text)
- w, h = gpu.getResolution()
- term.setCursor((w-string.len(text))/2+1, y)
- term.write(text)
- end
- function comma_value(n) -- credit http://richard.warburton.it
- local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
- return left..(num:reverse():gsub('(%d%d%d)','%1.'):reverse())..right
- end
- function Disp()
- Center(2,"POWER STORAGE")
- cut = string.len(tostring(current))
- gpu.set(3,3,"Stored....: ")
- Center(4," "..comma_value(string.format("%.i",current)) .." / ".. tier .." RF ("..string.format("%.3f",
- tostring((current/cap)*100)) .."%)")
- end
- GUI()
- while true do
- current = draco.getEnergyStored()
- if draco.getMaxEnergyStored() > 2140000000000 then
- tier = tostring("∞")
- else
- tier = comma_value(tostring(draco.getMaxEnergyStored()))
- end
- cap = draco.getMaxEnergyStored()
- currentP = math.floor(current/cap*100)
- capP = math.floor(cap/cap*100)
- Disp()
- -- Update the Use --
- gpu.set(3,5, "Usage.....: ")
- OldCurrent = current
- os.sleep(1)
- Center(6," ")
- Current = draco.getEnergyStored()
- if Current > OldCurrent then
- gpu.setForeground(colors.lime)
- Center(6,"+"..comma_value(string.format("%.f", ((Current-OldCurrent)/20))).. " RF/t ")
- gpu.setForeground(text_col)
- elseif Current < OldCurrent then
- gpu.setForeground(colors.red)
- Center(6," "..comma_value(string.format("%.f",((Current-OldCurrent)/20))) .. " RF/t ")
- gpu.setForeground(text_col)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement