Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m=peripheral.wrap("top")
- local max,amount,pourcent
- local pmax = 60
- local pmin = 10
- local maj = true
- function screen()
- m.clear()
- m.setCursorPos(1,2)
- m.write(amount.." /")
- m.setCursorPos(1,3)
- m.write(math.ceil(max))
- m.setCursorPos(1,4)
- m.write(math.ceil(pourcent).." %")
- term.clear()
- term.setCursorPos(2,2)
- term.write("current pourcentage : "..pourcent)
- term.setCursorPos(2,3)
- term.write("1 : pourcentage min (redstone+) : "..pmin)
- temp = max*(pmin/100)
- term.write(" ("..temp..")")
- term.setCursorPos(2,4)
- term.write("2 : pourcentage max (redstone-) : "..pmax)
- temp = max*(pmax/100)
- term.write(" ("..temp..")")
- term.setCursorPos(2,5)
- term.write("current redstone signal : ")
- term.write(rs.getOutput("right"))
- end
- function principal()
- while true do
- if maj then
- l=peri^heral.call("back","getTankInfo")
- max = l[1].capacity
- amount = l[1].contents.amount
- pourcent=amount*100/max
- if pourcent <= pmin then
- rs.setOutput("right",true)
- end
- if pourcent >= pmax then
- rs.setOutput("right",false)
- end
- screen()
- end
- sleep(2)
- end
- end
- function red()
- m.setBackgroundColor(0x4000)
- m.clear()
- m.setBackgroundColor(0x8000)
- end
- function event()
- while true do
- local event, key, isHeld = os.pullEvent("key")
- key = keys.getName(key)
- if key = "numPad1" then
- sleep(0.5)
- red()
- term.clear()
- term.setCursorPos(1,1)
- print("Changement de pourcentage min")
- pmin = read()
- m.clear()
- end
- if key = "numPad2" then
- sleep(0.5)
- red()
- term.clear()
- term.setCursorPos(1,1)
- print("Changement de pourcentage max")
- pmax = read()
- m.clear()
- end
- end
- end
- parallel.waitForAny(principal,event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement