Advertisement
maxtorcd55

debietmeter

Jun 10th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. function setBundled(side,color,state)
  2.         if state == true then
  3.                 local input = rs.getBundledInput(side)
  4.                 rs.setBundledOutput(side, colors.combine(input, color))
  5.         else
  6.                 local input = rs.getBundledInput(side)
  7.                 rs.setBundledOutput(side, colors.subtract(input, color))
  8.         end
  9. end
  10.  
  11. function getBundled(side,color)
  12.         return colors.test(redstone.getBundledInput(side), color)
  13. end
  14.  
  15.  
  16.  
  17.  
  18. local tank = peripheral.wrap("back")
  19. local sign = peripheral.wrap("front")
  20.  
  21. while true do
  22.  
  23. if tank ~= nil then
  24.  
  25.             local tankinfo = tank.getTankInfo("")
  26.  
  27.         print("tank ok")
  28.         if tankinfo[1]["amount"] == nil then
  29.             tankinfo[1]["amount"] = 0
  30.             print("tank leeg0")
  31.         end
  32.                
  33.         print(tankinfo[1]["amount"])
  34.         if tankinfo[1]["amount"] <= 500 then
  35.             print("tank leeg")
  36.             sleep(1)
  37.             setBundled("left",colors.white,false)
  38.             print("tank leeg2")
  39.             sleep(10)
  40.             print("tank leeg3")
  41.             if sign ~= nil then
  42.                 tankinfo = tank.getTankInfo("")
  43.                 if tankinfo[1]["amount"] == nil then
  44.                     tankinfo[1]["amount"] = 0
  45.                 end
  46.                 sign.setLine(2,(tankinfo[1]["amount"])*6 .."mB/Min")
  47.             end
  48.         else
  49.             setBundled("left",colors.white,true)
  50.         end
  51.  
  52.  
  53. else
  54.  
  55.         if sign ~= nil then
  56.                 sign.setText("")
  57.                 sign.setLine(1,"Geen Tank")    
  58.         end
  59. end
  60.  
  61.  
  62. sleep(1)
  63.  
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement