Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c=require("component")
- cr=require("computer")
- fs=require("filesystem")
- term=require("term")
- event=require("event")
- gpu=c.gpu
- screen=c.screen
- req_list={["openperipheral_bridge"]=1,["average_counter"]=1,["me_controller"]=1}
- err_c=0
- for v in pairs(req_list) do if not c.isAvailable(v) then req_list[v]=0 err_c=err_c+1 end end
- if err_c>0 then term.clear() gpu.setForeground(0xff0000) for v in pairs(req_list) do if req_list[v]==0 then print(v.." is not available") end end gpu.setForeground(0xffffff) os.sleep(3) return -1 end
- player={'Tumko','Danil5108','AliceWay','Aquard','MishaMin','Ven3ra','xovrin234','_VAVILON_','Gabar','Lexun'}
- brd=c.openperipheral_bridge
- me=c.me_controller
- term.clear()
- gpu.setForeground(0xffffff)
- fs.makeDirectory("tmp/bag")
- function getHostTime(timezone)
- timezone = timezone or 2
- local file = io.open("/HostTime.tmp", "w")
- file:write("")
- file:close()
- local timeCorrection = timezone * 3600
- local lastModified = tonumber(string.sub(fs.lastModified("/HostTime.tmp"), 1, -4)) + timeCorrection
- fs.remove("/HostTime.tmp")
- local year, month, day, hour, minute, second = os.date("%Y", lastModified), os.date("%m", lastModified), os.date("%d", lastModified), os.date("%H", lastModified), os.date("%M", lastModified), os.date("%S", lastModified)
- return tonumber(day), tonumber(month), tonumber(year), tonumber(hour), tonumber(minute), tonumber(second)
- end
- function real_time()
- local time = {getHostTime(3)}
- local text = string.format("%02d:%02d", time[4], time[5])
- brd.addBox(1,13,65,11,0x000000,0.5)
- brd.addText(4,15,"Время: "..text,0xFFFFFF)
- end
- function tf()
- local f=io.open("/tmp/bag/tps","w")
- f:write("tps")
- f:close()
- return(fs.lastModified("tmp/bag/tps"))
- end
- function tps()
- local c1,c2,c3,tps
- c1=tf()
- os.sleep(2)
- c2=tf()
- c3=c2-c1
- tps=20000*2/c3
- tps=string.sub(tps,1,5)
- brd.addBox(1,1,65,11,0x000000,0.5)
- brd.addText(10,3,"TPS:",0xFFFFFF)
- brd.addText(32,3,tps,0x04CCFF)
- end
- function cn_form(n)
- if n>=10^6 then return string.format("%.2f M",n/10^6)
- elseif n>=10^3 then return string.format("%.2f k",n/10^3)
- else return tostring(n) end
- end
- function sis()
- local mat,irn,irn_b,drac=0,0,0,0
- r1,r2,r3,r4=me.getItemsInNetwork({name="dwcity:Materia"})[1],me.getItemsInNetwork({name="minecraft:iron_ingot"})[1],me.getItemsInNetwork({name="minecraft:iron_block"})[1],me.getItemsInNetwork({name="DraconicEvolution:draconicIngot"})[1]
- if type(r1)=="table" then mat=r1["size"] end
- if type(r2)=="table" then irn=r2["size"] end
- if type(r3)=="table" then irn_b=r3["size"] end
- if type(r4)=="table" then drac=r4["size"] end
- irn=irn+irn_b*9
- brd.addBox(1,37,90,120,0x000000,0.5)
- brd.addIcon(3,44,"IC2:blockReactorChamber")
- brd.addIcon(3,64,"AdvancedSolarPanel:BlockMolecularTransformer")
- brd.addIcon(3,80,"dwcity:Materia")
- brd.addText(23,85,string.format("%d",mat),0xbbbbbb)
- brd.addIcon(3,98,"minecraft:iron_block")
- brd.addText(23,103,string.format("%.2f",irn/9),0xbbbbbb)
- brd.addIcon(3,116,"minecraft:iron_ingot")
- brd.addText(23,121,string.format("%d",irn),0xbbbbbb)
- brd.addIcon(3,134,"DraconicEvolution:draconicIngot")
- brd.addText(23,139,string.format("%d",drac),0xbbbbbb)
- end
- function plrs()
- local hs_p=164
- brd.addBox(1,hs_p-4,90,43,0x000000,0.5)
- for i=1,#player do
- if cr.addUser(player[i])~=nil then brd.addIcon(3,hs_p-5,"minecraft:skull",3) brd.addText(23,hs_p,player[i],0xbbbbbb)
- else brd.addIcon(3,hs_p-5,"minecraft:skull") brd.addText(23,hs_p,player[i],0x404040) end
- cr.removeUser(player[i])
- hs_p=hs_p+14
- end
- end
- while true do
- if not(c.isAvailable("openperipheral_bridge") and c.isAvailable("average_counter") and c.isAvailable("me_controller")) then cr.shutdown(1) end
- brd.clear()
- tps()
- real_time()
- plrs()
- sis()
- brd.sync()
- end
Advertisement
Add Comment
Please, Sign In to add comment