Advertisement
Guest User

Untitled

a guest
Jan 8th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. component = require("component")
  2. term = require("term")
  3. local sleepTime = 0.5
  4. sides = require("sides")
  5. colors = require("colors")
  6. rs = component.redstone
  7. tank = component.tank_controller
  8.  
  9. while true do
  10.     tInfo = tank.getFluidInTank(sides.west) -- Tank is above the Adapter
  11.     amount = tInfo[1].amount
  12.     capacity = tInfo[1].capacity
  13.     label = tInfo[1].label
  14.     percent = (tInfo[1].amount / tInfo[1].capacity) * 100
  15.     percent = math.floor(percent + 0.5) --lua's functions do not modify their arguments!
  16.  
  17.     if percent == 100 then
  18.         rs.setBundledOutput(sides.up,colors.white,255)
  19.     else
  20.         rs.setBundledOutput(sides.up,colors.white,0)
  21.     end
  22.    
  23.     if percent < 95 then
  24.         rs.setBundledOutput(sides.up,colors.purple,255)
  25.     else
  26.         rs.setBundledOutput(sides.up,colors.purple,0)
  27.     end
  28.        
  29.     term.clear()
  30.     print("Fuel Type: "..label)
  31.     print("Amount   : "..amount)
  32.     print("Tank Cap.: "..capacity)
  33.     print("% Full   : "..percent)
  34.     os.sleep(2)
  35.     os.sleep(sleepTime)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement