Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local essenceTank = peripheral.wrap("top")
- local tankInfo = essenceTank.getTankInfo("unknown")[1]
- local capacity = tankInfo.capacity or 0
- local amount = tankInfo.amount or 0
- local percentage = 0
- local threshold = 90
- local lagbuster = 10
- local rs_side = "left"
- local rs_color = colors.lightBlue
- local function getAmount()
- tankInfo = essenceTank.getTankInfo("unknown")[1]
- amount = tankInfo.amount or 0
- end
- local function getPercent()
- getAmount()
- percentage = math.floor(amount/capacity*100)
- print("Percent filled: ", tostring(percentage),"%")
- end
- local function setRedstone()
- getPercent()
- if percentage > threshold then
- rs.setBundledOutput(rs_side, rs_color)
- print("Above")
- else
- rs.setBundledOutput(rs_side, 0)
- print("Below")
- end
- end
- local function main()
- while true do
- setRedstone()
- sleep(lagbuster)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment