Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Config:
- blockSide = "back"
- rsSide = "right"
- maxPress = 5
- minPress = 3
- monActiv = false
- monSide = "monitor_2"
- screenLarger = 29
- -- Prog:
- p = peripheral.wrap(blockSide)
- function getPressure()
- press = math.floor(p.getPressure())
- press_2 = p.getCriticalPressure()
- term.setCursorPos(1,3)
- term.clearLine()
- term.setTextColor(colors.orange)
- write("Pressure: ")
- term.setTextColor(colors.white)
- print(press.."/"..press_2)
- term.clearLine()
- if press <= minPress then
- print("Generating Compressed Air ...")
- rs.setOutput(rsSide,true)
- genAir = true
- elseif press == maxPress then
- print("Pressure Done !")
- rs.setOutput(rsSide,false)
- genAir = false
- end
- end
- if monActiv then
- mon = peripheral.wrap(monSide)
- end
- function monitor()
- if monActiv then
- mon.clear()
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(1,2)
- mon.clearLine()
- mon.setTextColor(colors.orange)
- mon.write("Network Pressure: ")
- mon.setTextColor(colors.white)
- if genAir then
- color = colors.orange
- else
- color = colors.lime
- end
- mon.setTextColor(color)
- mon.write(press)
- mon.setTextColor(colors.white)
- mon.write("/"..maxPress)
- --Percent Calcul:
- ppTemp = (press*100)/maxPress
- pp = math.ceil(ppTemp)
- maxScreen = screenLarger - 6
- ppScreen = (maxScreen*pp)/100
- --print("Debug: "..pp)
- if pp == 0 and pp < 50 then
- ppColor = colors.orange
- elseif pp >= 50 and pp < 75 then
- ppColor = colors.yellow
- elseif pp >= 75 then
- ppColor = colors.lime
- end
- --print("Debug; "..ppColor)
- for i = 1,ppScreen,1 do
- case = tonumber(i)
- --print(i)
- mon.setCursorPos(case,4)
- mon.setBackgroundColor(ppColor)
- mon.write(" ")
- end
- mon.setBackgroundColor(colors.black)
- --mon.setCursorPos(1,4)
- --mon.setTextColor(colors.orange)
- --mon.write("Percent: ")
- mon.setTextColor(ppColor)
- mon.write(" "..pp)
- mon.setTextColor(colors.white)
- mon.write(" %")
- sleep(0.5)
- end
- end
- term.clear()
- while true do
- sleep(0)
- getPressure()
- monitor()
- end
Advertisement
Add Comment
Please, Sign In to add comment