Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("monitor_0")
- core = peripheral.wrap("draconicevolution_tileenergypylon_0")
- tank = peripheral.wrap("tile_endertech_endertankvalve_0")
- bridge = peripheral.wrap("openperipheral_bridge_0")
- debug = false
- function fill(x1, x2, y1, y2, color)
- if debug then print("Adding box from ("..x1..","..y1..") to ("..x2-x1..","..y2-y1..") with color: "..color) end
- bridge.addBox(x1,y1,x2-x1,y2-y1, color)
- end
- function init()
- bridge.clear()
- bridge.sync()
- end
- function writeat(line, text, index)
- if not index then index = 1 end
- bridge.addText(index, line, text)
- end
- function energy()
- stored = core.getEnergyStored()
- max = core.getMaxEnergyStored()
- percfull = math.floor(stored/max*100)
- percempty = 100 - math.ceil(stored/max*100)
- x1,x2,y1,y2 = 100,500, 1, 40
- x2 = x2 - x1
- y2 = y2 - y1
- eend = x2 * math.ceil(percfull / 100)
- if debug then
- print("Percentage full: "..percfull.."%")
- print("Red: from "..x1.." to "..eend)
- print("Black: from "..eend.." to "..x2)
- end
- fill(eend, x2, y1,y2, 0x000000)
- fill(x1, eend, y1,y2, 0xFF0000)
- writeat(x1, percfull.."%")
- end
- function essence()
- info = tank.getTankInfo("east")
- stored = info[1]["contents"]["amount"]
- max = info[1]["capacity"]
- fluid = info[1]["contents"]["rawName"]
- percfull = math.floor(stored/max*100)
- percempty = 100 - math.ceil(stored/max*100)
- usedheight = height - 20
- hfull = 30 - math.floor(usedheight * (percfull/100))
- hempty = hfull - math.ceil(usedheight * (percempty/100))
- fill(3,48, hfull,31, colors.green)
- fill(3,48, 21,hfull-1, colors.black)
- writeat(19, percfull.."%")
- end
- function main()
- init()
- while true do
- energy()
- --essence()
- bridge.sync()
- sleep(2)
- bridge.clear()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement