Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wheelDisp(x,y,p) --x,y coord; p energy
- if x==5 and y>13 then
- if p==0 then return colors.gray else return colors.red end
- elseif x==4 and y==16 then
- if p<5 then return colors.gray else return colors.red end
- elseif (x==4 and y==15) or (x==3 and y==16) then
- if p<10 then return colors.gray else return colors.red end
- elseif (x==4 and y==14) or ((x==3 or x==2) and y==15) then
- if p<15 then return colors.gray else return colors.yellow end
- elseif x<4 and y==14 then
- if p<20 then return colors.gray else return colors.yellow end
- elseif x<6 and y==13 then
- if p<25 then return colors.gray else return colors.yellow end
- elseif x<3 and y==12 then
- if p<30 then return colors.gray else return colors.yellow end
- elseif (x==4 and y==12) or ((x==2 or x==3) and y==11) then
- if p<35 then return colors.gray else return colors.yellow end
- elseif (x==4 and y==11) or ((x==3 or x==4) and y==10) then
- if p<40 then return colors.gray else return colors.green end
- elseif x==5 and y>13 then
- if p<45 then return colors.gray else return colors.green end
- elseif x==6 and y>13 then
- if p<50 then return colors.gray else return colors.green end
- elseif ((x==7 or x==8) and y==10) or (x==7 and y==11) then
- if p<60 then return colors.gray else return colors.green end
- elseif ((x==8 or x==9) and y==11) or (x==7 and y==12) then
- if p<65 then return colors.gray else return colors.green end
- elseif x>7 and y==12 then
- if p<70 then return colors.gray else return colors.green end
- elseif x>5 and y==13 then
- if p<75 then return colors.gray else return colors.green end
- elseif x>7 and y==14 then
- if p<80 then return colors.gray else return colors.green end
- elseif ((x==8 or x==9) and y==15) or (x==7 and y==14) then
- if p<85 then return colors.gray else return colors.green end
- elseif (x==7 and y<14) or (x==8 and y==16) then
- if p<90 then return colors.gray else return colors.green end
- else if p<100 then return colors.gray else return colors.green end
- end
- end
- --initialization
- sto = peripheral.wrap("draconic_storage_2")
- mon = peripheral.wrap("monitor_1")
- mon.clear()
- l = {10,11,12,13,14,15,16}
- --process
- while 1 do
- --aqquisition
- mon.setBackgroundColor(colors.black)
- out = sto.getEnergyStored()
- os.sleep(1)
- out = (sto.getEnergyStored() - out)/20
- per = (sto.getEnergyStored()/sto.getMaxEnergyStored())*100
- --display num
- mon.setTextColor(colors.lightBlue) mon.setCursorPos(1,1) mon.write("Draconic power storage")
- mon.setTextColor(colors.gray) mon.setCursorPos(1,2) mon.write("-Transfer rate (Rf/t)")
- mon.setCursorPos(1,3)
- if out>0 then mon.setTextColor(colors.green) else mon.setTextColor(colors.red) end
- mon.write(out) mon.write(" ")
- mon.setTextColor(colors.gray) mon.setCursorPos(1,5) mon.write("-Energy stored (Rf -- %)")
- mon.setTextColor(colors.green) mon.setCursorPos(1,6) mon.write(sto.getEnergyStored())
- if per<10 then mon.setTextColor(colors.red) elseif per>=10 and per <40 then mon.setTextColor(colors.yellow) else mon.setTextColor(colors.green) end
- mon.setCursorPos(18,6) mon.write(per) mon.setCursorPos(22,6) mon.write(" ")
- --display graph
- for i=1,10 do
- if i>2 and i<9 then
- for j=1,7 do
- mon.setCursorPos(i,l[j]) mon.setBackgroundColor(wheelDisp(i,l[j],per)) mon.write(" ")
- end
- end
- if i==2 or i==9 then
- for j=2,6 do
- mon.setCursorPos(i,l[j]) mon.setBackgroundColor(wheelDisp(i,l[j],per)) mon.write(" ")
- end
- end
- if i==1 or i==10 then
- for j=3,5 do
- mon.setCursorPos(i,l[j]) mon.setBackgroundColor(wheelDisp(i,l[j],per)) mon.write(" ")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement