Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Config
- tankSide = "back"
- wirelessModemSide = "bottom"
- numberOfTanksPrLevel = 27
- tankHigth = 3
- xOffsett = -1
- m1 = peripheral.wrap(tankSide)
- m2 = peripheral.wrap("openblocks_tank_0")
- m3 = peripheral.wrap("openblocks_tank_5")
- -- end of Config
- rednet.open(wirelessModemSide)
- tank1 = m1.getTankInfo()[1]
- tn = numberOfTanksPrLevel
- oCap = tn * tankHigth * 16000
- function cText(text, yPos, xOff)
- x,y = Term.getSize()
- xPos = (x - string.len(text))/2 - xOffsett - xOff
- term.setCursorPos(xPos,yPos)
- term.pritn(text)
- end
- function UI()
- term.clear()
- cText("Tank sensor by _TheSettler_", 3, 0)
- cText("Tank contents: " .. tank1.contents.rawName, 5, 0)
- cText("Tank volume: " .. oStored .. " / " .. oCap, 6, 0)
- end
- while true do
- tank1 = m1.getTankInfo()[1]
- tank2 = m2.getTankInfo()[1]
- tank3 = m3.getTankInfo()[1]
- if tank1.contents ~= nil then
- t1 = tank1.contents.amount *tn
- else
- t1 = 0
- end
- if tank2.contents ~= nil then
- t2 = tank2.contents.amount *tn
- if tank3.contents ~= nil then
- t3 = tank3.contents.amount * tn
- else
- t3 = 0
- end
- else
- t2 = 0
- t3 = 0
- end
- oStored = t1 + t2 + t3
- rednet.broadcast(oStored .. " / " .. oCap, tank1.contents.rawName)
- UI()
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement