Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- GENERAL INFORMATION
- ===================
- FILE NAME: thermalMonitor.lua
- CREATED BY: Cavious(Donald R. Valverde)
- EMAIL: [email protected]
- LICENSE: Open-Source(MIT) License
- VERSION: 0.1-ALPHA
- ====================
- Requirements
- ------------
- (1)Minecraft(1.64+)
- (2)ComputerCraft Mod(1.6+)
- (3)IndustrialCraft(2+)
- (4)Advanced Computer Terminal
- (5)Advanced Monitor
- (6)Wired RedNet Connection
- (7)Thermal Generator
- --]]
- --User Variables
- firstMonitorPos = "" --ENTER THE DIRECTION OF THE MONITOR
- secondMonitorPos = "" --ENTER THE DIRECTION OF THE MONITOR
- thirdMonitorPos = "" --ENTER THE DIRECTION OF THE MONITOR
- ----------------
- monOne = peripheral.wrap(firstMonitorPos)
- monTwo = peripheral.wrap(secondMonitorPos)
- monThree = peripheral.wrap(thirdMonitorPos)
- function initializeBackgrounds()
- --Initialize monOne
- term.redirect(monOne)
- barGraph = paintutils.loadImage(".backgroundTop")
- paintutils.drawImage(barGraph, 1, 1)
- term.native()
- --Initialize monTwo
- term.redirect(monTwo)
- controls = paintutils.loadImage(".backgroundLeft")
- paintutils.drawImage(controls, 1, 1)
- term.native()
- end
- function initializeText()
- --monOne Formatting
- --monOne Titles Formats
- monOne.setBackgroundColor(colors.gray)
- monOne.setTextColor(colors.white)
- --monOne Title Text
- monOne.setCursorPos(18,2)
- monOne.write("Thermal Monitoring")
- monOne.setBackgroundColor(colors.lightGray)
- monOne.setCursorPos(3,3)
- monOne.write("CURRENT AMOUNT(mB)")
- monOne.setCursorPos(28,3)
- monOne.write("MAXIMUM(mB)")
- --monOne
- --Process Data
- while(true) do
- local amount, maximum = getValues()
- monOne.setCursorPos(3, 4)
- monOne.setBackgroundColor(colors.black)
- monOne.setTextColor(colors.white)
- monOne.write(amount)
- monOne.setCursorPos(28, 4)
- monOne.setBackgroundColor(colors.black)
- monOne.setTextColor(colors.white)
- monOne.write(maximum)
- term.redirect(monOne)
- paintutils.drawLine(2, 8, (amount/maximum) * 40, 8, colors.orange)
- paintutils.drawLine(2, 9, (amount/maximum) * 40, 9, colors.orange)
- term.native()
- os.sleep(1)
- end
- end
- function getValues()
- local valve = peripheral.wrap("rcirontankvalvetile_3")
- local tableInfo = valve.getTankInfo("down")
- local curAmount = 0
- local maximum = 0
- for k, v in pairs(tableInfo) do
- for x, y in pairs(v) do
- if x == "amount" then
- term.redirect(monThree)
- print(x..": "..y)
- term.native()
- curAmount = y
- end
- if x == "capacity" then
- term.redirect(monThree)
- print(x..": "..y)
- term.native()
- maximum = y
- end
- end
- end
- return curAmount, maximum
- end
- function run()
- monOne.clear()
- monTwo.clear()
- monOne.setTextScale(0.5)
- monTwo.setTextScale(0.5)
- monThree.setTextScale(0.5)
- monThree.setBackgroundColor(colors.lightGray)
- initializeBackgrounds()
- initializeText()
- end
- run()
Advertisement
Add Comment
Please, Sign In to add comment