View difference between Paste ID: Pz2vX8uH and L8GvQaFQ
SHOW: | | - or go back to the newest paste.
1-
component = require("component")
1+
component = require("component")
2-
term = require("term")
2+
term = require("term")
3-
local sleepTime = 0
3+
local sleepTime = 0
4-
sides = require("sides")
4+
sides = require("sides")
5-
colors = require("colors")
5+
colors = require("colors")
6-
rs = component.redstone
6+
rs = component.redstone
7-
tank = component.tank_controller
7+
tank = component.tank_controller
8-
8+
9-
 
9+
10-
tInfo = tank.getFluidInTank(sides.west) -- Tank is above the Adapter
10+
tInfo = tank.getFluidInTank(sides.west) -- Tank is above the Adapter
11-
 
11+
12-
12+
13-
amount = tInfo[1].amount
13+
amount = tInfo[1].amount
14-
capacity = tInfo[1].capacity
14+
capacity = tInfo[1].capacity
15-
label = tInfo[1].label
15+
label = tInfo[1].label
16-
 
16+
17-
percent = (tInfo[1].amount / tInfo[1].capacity) * 100
17+
percent = (tInfo[1].amount / tInfo[1].capacity) * 100
18-
18+
19-
19+
20-
math.floor(percent + 0.5)
20+
math.floor(percent + 0.5)
21-
 
21+
22-
22+
23-
-- Output as you want... a very simple way:
23+
-- Output as you want... a very simple way:
24-
  if percent == 100 then
24+
if percent == 100 then
25-
    rs.setBundledOutput(sides.up,colors.white,255)
25+
  rs.setBundledOutput(sides.up,colors.white,255)
26-
  else
26+
else
27-
    rs.setBundledOutput(sides.up,colors.white,0)
27+
  rs.setBundledOutput(sides.up,colors.white,0)
28-
  end
28+
end
29-
29+
30-
  if percent < 95 then
30+
if percent < 95 then
31-
    rs.setBundledOutput(sides.up,colors.purple,255)
31+
  rs.setBundledOutput(sides.up,colors.purple,255)
32-
      term.clear()
32+
  term.clear()
33-
      print("Fuel Type: "..label)
33+
  print("Fuel Type: "..label)
34-
      print("Amount   : "..amount)
34+
  print("Amount   : "..amount)
35-
      print("Tank Cap.: "..capacity)
35+
  print("Tank Cap.: "..capacity)
36-
      print("% Full   : "..percent)
36+
  print("% Full   : "..percent)
37-
    os.sleep(5)
37+
  os.sleep(5)
38-
  return
38+
  return
39-
39+
else
40-
  else
40+
  rs.setBundledOutput(sides.up,colors.purple,0)
41-
    rs.setBundledOutput(sides.up,colors.purple,0)
41+
  term.clear()
42-
      term.clear()
42+
  print("Fuel Type: "..label)
43-
      print("Fuel Type: "..label)
43+
  print("Amount   : "..amount)
44-
      print("Amount   : "..amount)
44+
  print("Tank Cap.: "..capacity)
45-
      print("Tank Cap.: "..capacity)
45+
  print("% Full   : "..percent)
46-
      print("% Full   : "..percent)
46+
  os.sleep(2)
47-
    os.sleep(2)
47+
  return
48-
  return
48+