Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- sen = sensor.wrap("top")
- while true do
- tank = sen.getTargetDetails("1,-1,1")
- bas = sen.getTargetDetails("0,-2,1")
- pipe = sen.getTargetDetails("0, -1, 1")
- --print(textutils.serialize(pipe))
- --print(textutils.serialize(tank))
- rs.setOutput("left", false)
- rs.setOutput("front", false)
- rs.setOutput("left", false)
- aTank = tank["Tanks"][1]["Amount"]
- aBas = bas["Tanks"][1]["Amount"]
- nTank = tank["Tanks"][1]["RawName"]
- nBas = bas["Tanks"][1]["RawName"]
- if aTank >= 1296 and ((aBas > 0 and nBas == nTank) or aBas == 0) then
- repeat
- aBas = sen.getTargetDetails("0,-2,1")["Tanks"][1]["Amount"]
- aTank = sen.getTargetDetails("1,-1,1")["Tanks"][1]["Amount"]
- rs.setOutput("right", true)
- sleep(0.5)
- rs.setOutput("right", false)
- print(aTank)
- until aTank < 1296
- end
- if ((nBas ~= nil and nTank ~= nil) and nBas ~= nTank) or aBas >0 and aBas<1296 then
- repeat
- aBas = sen.getTargetDetails("0,-2,1")["Tanks"][1]["Amount"]
- rs.setOutput("left", true)
- sleep(0.5)
- print(aBas)
- rs.setOutput("left", false)
- until aBas == 0
- end
- if aTank < 1296 and aTank >= 144 then
- rs.setOutput("front", true)
- sleep(0.5)
- print("c")
- rs.setOutput("front", false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement