Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m=peripheral.wrap("left")
- p=peripheral.wrap("bottom")
- term.redirect(m)
- tX,tY=term.getSize()
- local function writeTextCentered(text,y,tCol)
- if text==nil or y<=0 then return false; end
- sValue=(tX-string.len(text))/2;
- if tCol then term.setTextColor(tCol) end
- term.setCursorPos(sValue,y);
- term.write(text);
- term.setBackgroundColor(colors.green)
- end
- local function writeTextSpecificCentered(text,sX,eX,y,tCol)
- if text==nil or y<=0 then return false; end
- sValue=(((eX+1)-sX)-string.len(text))/2;
- if tCol then term.setTextColor(tCol) end
- term.setCursorPos(sValue+sX,y);
- term.write(text);
- term.setBackgroundColor(colors.green)
- end
- local function drawLoadingScreen(count,total,info)
- term.setBackgroundColor(colors.white)
- paintutils.drawLine(1,tY-3,tX,tY-3,colors.white)
- writeTextCentered(info,tY-3,colors.blue)
- paintutils.drawLine(2,tY-1,tX-2,tY-1,colors.white)
- paintutils.drawLine(2,tY-1,1+((count*(tX-2))/total),tY-1,colors.green)
- end
- function main()
- while true do
- h=p.getEnergyStored()
- mx=p.getMaxEnergyStored()
- if h==mx then
- rs.setOutput("back",true)
- else
- rs.setOutput("back",false)
- end
- pc=h/mx
- ts=tostring(tostring(h).."/"..tostring(mx).." ("..tostring(pc*100).."%)")
- paintutils.drawFilledBox(1,1,tX,tY,colors.white)
- paintutils.drawBox(1,tY-2,tX,tY,colors.lightGray)
- drawLoadingScreen(h,mx,ts)
- sleep(1)
- end
- end
- _,err=pcall(main)
- term.setBackgroundColor(colours.black)
- term.setTextColor(colours.white)
- print("\n\n\n\n"..err)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement