Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --HUD = peripheral.wrap("left")
- monitor = peripheral.wrap("top")
- --sfBoiler = peripheral.wrap("solid_fueled_boiler_firebox_0")
- --lfBoiler = peripheral.wrap("liquid_fueled_boiler_firebox_0")
- lavaTank = peripheral.wrap("steel_tank_valve_0")
- --ethanolTank = peripheral.wrap("iron_tank_valve_1")
- --steamTank = peripheral.wrap("iron_tank_valve_2")
- --steamTurbine = peripheral.wrap("steam_turbine_housing_0")
- --steamComputer = peripheral.wrap("computer_2")
- --mfe = peripheral.wrap("batbox_0")
- --mfsu = peripheral.wrap("batbox_1")
- --craftingMonitor = peripheral.wrap("me_crafting_monitor_0")
- steamOn = false
- rednet.open("bottom")
- function roundNum(val, decimal)
- if (decimal) then
- return math.floor(((val * 10^decimal) + 0.5) / (10^decimal))
- else
- return math.floor(val+0.5)
- end
- end
- function drawPixel(x, y, color)
- monitor.setCursorPos(x, y)
- monitor.setBackgroundColor(color)
- monitor.write(" ")
- end
- function drawTank(x, y, color, maxLiq, currentLiq, tankName)
- if currentLiq == nil then
- currentLiq = 0
- end
- if maxLiq == nil then
- maxLiq = 0
- end
- percentage = roundNum(((currentLiq / maxLiq) * 100), 0)
- for i = 0, 11 do
- drawPixel(x, y + i, colors.white)
- drawPixel(x + 19, y + i, colors.white)
- end
- for i = 1, 18 do
- drawPixel(x + i, y + 11, colors.white)
- end
- rows = roundNum((percentage / 10), 0)
- for i = 10 - rows, 10 do
- for j = 1, 18 do
- if tankName == "Lava Tank" then
- if math.random(1, 20 - i) == 1 then
- if math.random(1, 4) == 1 then
- drawPixel(x + j, y + i, colors.black)
- else
- drawPixel(x + j, y + i, colors.orange)
- end
- else
- drawPixel(x + j, y + i, color)
- end
- elseif tankName == "Steam Tank" then
- if math.random(1, 20 - i) == 1 then
- drawPixel(x + j, y + i, colors.lightGray)
- else
- drawPixel(x + j, y + i, color)
- end
- else
- drawPixel(x + j, y + i, color)
- end
- end
- end
- monitor.setCursorPos(x, y + 13)
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- monitor.write(tankName .. " " .. tostring(percentage) .. "%")
- monitor.setCursorPos(x, y + 14)
- monitor.write(tostring(currentLiq) .. "mB / " .. tostring(maxLiq) .. "mB")
- end
- function drawLiqBoiler(x, y, waterCap, waterCur, temp, fuelMax, fuelCurrent, steamMax, steamCurrent)
- if waterCur == nil then
- waterCur = 0
- end
- if waterCap == nil then
- waterCap = 0
- end
- if fuelCurrent == nil then
- fuelCurrent = 0
- end
- if fuelMax == nil then
- fuelMax = 0
- end
- if steamCurrent == nil then
- steamCurrent = 0
- end
- if steamMax == nil then
- steamMax = 0
- end
- waterPercentage = roundNum(((waterCur / waterCap) * 100), 0)
- fuelPercentage = roundNum(((fuelCurrent / fuelMax) * 100), 0)
- steamPercentage = roundNum(((steamCurrent / steamMax) * 100), 0)
- waterRows = roundNum((waterPercentage / 10), 0)
- fuelRows = roundNum((fuelPercentage / 10), 0)
- steamRows = roundNum((steamPercentage / 10), 0)
- for i = 0, 11 do
- drawPixel(x, y + i, colors.white)
- drawPixel(x + 2, y + i, colors.white)
- drawPixel(x + 5, y + i, colors.white)
- drawPixel(x + 7, y + i, colors.white)
- drawPixel(x + 10, y + i, colors.white)
- drawPixel(x + 12, y + i, colors.white)
- end
- drawPixel(x + 1, y + 11, colors.white)
- drawPixel(x + 6, y + 11, colors.white)
- drawPixel(x + 11, y + 11, colors.white)
- for i = 10 - waterRows, 10 do
- drawPixel(x + 1, y + i, colors.blue)
- end
- for i = 10 - fuelRows, 10 do
- drawPixel(x + 6, y + i, colors.orange)
- end
- for i = 10 - steamRows, 10 do
- drawPixel(x + 11, y + i, colors.gray)
- end
- monitor.setCursorPos(x, y + 13)
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- monitor.write("Temp = " .. roundNum(temp, 2))
- end
- while true do
- monitor.clear()
- -- HUD.clear()
- drawTank(2, 2, colors.red, lavaTank.getTanks("unknown")[1].capacity, lavaTank.getTanks("unknown")[1].amount, "Lava Tank")
- -- drawTank(26, 2, colors.orange, ethanolTank.getTanks("unknown")[1].capacity, ethanolTank.getTanks("unknown")[1].amount, "Ethanol Tank")
- -- drawTank(50, 2, colors.gray, steamTank.getTanks("unknown")[1].capacity, steamTank.getTanks("unknown")[1].amount, "Steam Tank")
- -- drawLiqBoiler(2, 20, lfBoiler.getTanks("unknown")[1].capacity, lfBoiler.getTanks("unknown")[1].amount, lfBoiler.getTemperature(), lfBoiler.getTanks("unknown")[3].capacity, lfBoiler.getTanks("unknown")[3].amount, lfBoiler.getTanks("unknown")[2].capacity, lfBoiler.getTanks("unknown")[2].amount)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement