Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tank = peripheral.wrap("back")
- --local m = peripheral.wrap("top")
- --term.redirect(m)
- Color1 = colors.white
- Color2 = colors.red
- Title = "Lava Tank"
- Data = {}
- Width = 5
- Height = 10
- x,y = term.getSize()
- term.clear()
- if Width > x then
- print("Error : Width too large ")
- os.shutdown()
- elseif Height > y then
- print("Error : Height too hight ")
- end
- function Middle(SizeMax,Size)
- return(math.floor((SizeMax/2)-(Size/2)))
- end
- function FillData()
- for k,v in pairs(Tank.getTanks("back")[1]) do
- peripheral.call("top","write",k)
- peripheral.call("top","write",v)
- peripheral.call("top","write","\n")
- Data[k] = v
- end
- end
- function getCord(Cord)
- Xpos,Ypos = term.getCursorPos()
- if Cord == "x" then
- return Xpos
- else
- return Ypos
- end
- end
- function Initialisation()
- term.setCursorPos(Middle(x,Width),Middle(y,Height))
- paintutils.drawLine(getCord("x"),getCord("y"),getCord("x"),getCord("y")+Height,Color1)
- paintutils.drawLine(getCord("x"),getCord("y"),getCord("x")+Width,getCord("y"),Color1)
- paintutils.drawLine(getCord("x")+Width,getCord("y")+Height,getCord("x"),getCord("y")+Height,Color1)
- paintutils.drawLine(getCord("x")+Width,getCord("y")+Height,getCord("x"),getCord("y")+Width,Color1)
- end
- while true do
- term.clear()
- Initialisation()
- FillData()
- term.setCursorPos(getCord("x")+1,getCord("y"))
- for i = 1,(Data["amount"]/Data["capacity"])*Width do
- paintutils.drawLine(getCord("x"),getCord("y")+i,getCord("x")+Width-2,getCord("y")+i,Color2)
- end
- term.setCursorPos(Middle(x,2*#Title),Middle(y,term.getCursorPos()[2]))
- term.write(Title)
- term.setCursorPos(getCord("x"),getCord("y")+5)
- term.write(math.floor(Data["amount"]/Data["capacity"]*100).." %")
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment