Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.find("monitor")
- local t = peripheral.wrap("rcirontankvalvetile_3")
- local t2 = peripheral.wrap("back")
- local warning = 90
- local cap
- local liquidColors = {{"Water", colors.blue },
- {"Steam", colors.lightGray},
- {"Lava", colors.orange},
- {"Fruit Juice", colors.green},
- {"uumatter", colors.purple, "UUMater"}}
- function getTank(tankPeriph)
- local tableInfo = t.getTankInfo("unknown")
- local tableInfo2 = t2.getTankInfo("unknown")
- fluidRaw = tableInfo.rawName
- fluidName = tableInfo.name
- fluidAmount = tableInfo.amount
- fluidCapacity = tableInfo[1].capacity
- contents = tableInfo[1].contents
- fluidRaw2 = tableInfo2.rawName
- fluidName2 = tableInfo2.name
- fluidAmount2 = tableInfo2.amount
- fluidCapacity2 = tableInfo2[1].capacity
- contents2 = tableInfo2[1].contents
- if contents then
- fluidRaw = contents.rawName
- fluidAmount = contents.amount
- fluidName = contents.name
- fluidRaw2 = contents2.rawName
- fluidAmount2 = contents2.amount
- fluidName2 = contents2.name
- end
- return fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidRaw2, fluidName2, fluidAmount2, fluidCapacity2
- end
- while true do
- m.clear()
- m.setCursorPos(1,1)
- local fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidRaw2, fluidName2, fluidAmount2, fluidCapacity2 = getTank(tank)
- if fluidName then
- cap = fluidCapacity / 1000
- amount = fluidAmount
- cap2 = fluidCapacity2 / 1000
- amount2 = fluidAmount2
- if amount == nil then
- amount = 0
- percentfull = 0
- amount2 = 0
- percentfull2 = 0
- else
- amount = math.floor(amount / 1000)
- percentfull = math.floor(100 * amount / cap)
- amount2 = math.floor(amount2 / 1000)
- percentfull2 = math.floor(100 * amount2 / cap)
- end
- if fluidRaw == "Lava" then
- m.write("1. Tank ")
- m.setTextColor(colors.red)
- m.write(fluidRaw)
- m.setTextColor(colors.white)
- elseif fluidRaw == "Water" then
- m.write("1. Tank ")
- m.setTextColor(colors.blue)
- m.write(fluidRaw)
- m.setTextColor(colors.white)
- elseif fluidRaw == "uumatter" then
- m.write("1. Tank ")
- m.setTextColor(colors.purple)
- m.write("UUMatter")
- m.setTextColor(colors.white)
- end
- m.setCursorPos(1,2)
- m.write("Inhalt Eimer: ".. amount.."/"..cap.." Eimer")
- m.setCursorPos(1,3)
- m.write("Inhalt %: "..percentfull.."% ")
- m.setCursorPos(1,5)
- if fluidRaw2 == "Lava" then
- m.write("2. Tank ")
- m.setTextColor(colors.red)
- m.write(fluidRaw2)
- m.setTextColor(colors.white)
- elseif fluidRaw2 == "Water" then
- m.write("2. Tank ")
- m.setTextColor(colors.blue)
- m.write(fluidRaw2)
- m.setTextColor(colors.white)
- elseif fluidRaw == "uumatter" then
- m.write("2. Tank ")
- m.setTextColor(colors.purple)
- m.write("UUMatter")
- m.setTextColor(colors.white)
- end
- m.setCursorPos(1,6)
- m.write("Inhalt Eimer: "..amount2.."/"..cap2.." Eimer")
- m.setCursorPos(1,7)
- m.write("Inhalt %: "..percentfull2.."% ")
- m.setCursorPos(1,10)
- m.write("Gesamt:")
- local amountges = amount + amount2
- local capges = cap + cap2
- m.setCursorPos(1,11)
- m.write("Inhalt Eimer: "..amountges.."/"..capges.." Eimer")
- local percentfullmid = percentfull + percentfull2
- local percentfullges = percentfullmid / 2
- m.setCursorPos(1,12)
- m.write("Inhalt %: "..percentfullges.."%")
- if percentfull == lastpercent then
- print("Der 1. Tank ist zu "..percentfull.."% voll")
- elseif percentfull < 10 then
- sendpercent = " "..percentfull
- print("Der 2. Tank ist zu "..percentfull2.."% voll")
- elseif percentfull2 < 10 then
- sendpercent2 = " "..percentfull2
- else
- sendpercent = 100
- sendpercent2 = 100
- end
- sleep(2)
- end
- end
Add Comment
Please, Sign In to add comment