/tanks.lua Secret
Created
August 31, 2018 14:00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local component = require("component") | |
local sides = require("sides") | |
local os = require("os") | |
local rs = component.redstone | |
local colors = require("colors") | |
local gpu = component.gpu | |
local w, h = gpu.getResolution() | |
local colorList = {["Creosote"] = colors.brown, | |
["Lubricant"] = colors.yellow, | |
["Jet Fuel"] = colors.magenta, | |
["Water"] = colors.blue, | |
["Lava"] = colors.red} | |
while true do | |
for tankAddress in component.list("tank_controller") do | |
local tank = component.proxy(tankAddress) | |
local fluidsInTank = tank.getFluidInTank(sides.top) | |
for _, fluid in ipairs(fluidsInTank) do | |
if fluid.capacity - fluid.amount > 1000000 then | |
rs.setBundledOutput(sides.back, colorList[fluid.label], 15) | |
gpu.setBackground(colorList[fluid.label]) | |
print(fluid.label .. ": " .. fluid.amount .. "/" .. fluid.capacity) | |
print("Status: Active") | |
else | |
rs.setBundledOutput(sides.back, colorList[fluid.label], 0) | |
gpu.setBackground(colorList[fluid.label]) | |
print(fluid.label .. ": " .. fluid.amount .. "/" .. fluid.capacity) | |
print("Status: Standby") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment