Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Config:
- dataType = "energy" -- energy or liquid
- Side = "right" -- side
- Dir = "up" -- direction, use only if type is liquid
- nameBat = "Storage Room Bank"
- activRs = true
- chargeRunEngine = 90
- rsSide = "bottom"
- minA = 4
- fullColor = colors.red
- emptyColor = colors.lightGray
- percentColor = colors.black
- runColor = colors.white
- backColor = colors.black
- margeW = 1
- monActiv = true
- monSide = "monitor_1"
- --Prog:
- function liquidScreen()
- if dataType == "liquid" then
- tank = peripheral.wrap(Side)
- data = tank.getTankInfo(Dir)
- for a,b in pairs(data) do
- info = data[1]
- end
- for k, v in pairs(info) do
- tankCap = info.capacity
- tankData = info.contents
- if tankData ~= nil then
- for a,b in pairs(tankData) do
- tankName = tankData.rawName
- tankAmount = tankData.amount
- end
- else
- tankAmount = 0
- end
- end
- xPos = minA
- yPos = margeW
- term.setCursorPos(xPos+1,yPos)
- term.setTextColor(colors.white)
- print(tankName)
- term.setCursorPos(xPos+1,yPos+1)
- print(tankAmount .."/".. tankCap.." mB")
- pct = math.floor((tankAmount/tankCap)*100)
- end
- end
- function screen()
- longueur = minA+20
- --yPos = margeW
- charge = minA + math.floor(pct/5)
- term.clearLine(1,yPos+3)
- strg = pct.."%"
- for x = charge,longueur do
- paintutils.drawPixel(x+1,yPos+3,emptyColor)
- if charge <= string.len(strg) then
- term.setCursorPos(charge,yPos+3)
- term.setTextColor(percentColor)
- print(strg)
- term.setCursorPos(runColor)
- end
- end
- if pct < chargeRunEngine then
- runColor = colors.orange
- if activRs then
- rs.setOutput(rsSide, true)
- end
- elseif pct == 100 then
- runColor = colors.lime
- if activRs then
- rs.setOutput(rsSide, false)
- end
- end
- minB = minA+charge
- for x = minA,charge+1 do
- paintutils.drawPixel(x,yPos+3,fullColor)
- if charge > string.len(strg) then
- term.setCursorPos(charge-string.len(strg)+2,yPos+3)
- term.setTextColor(percentColor)
- print(strg)
- term.setTextColor(runColor)
- end
- end
- end
- function energyScreen()
- if dataType == "energy" then
- bat = peripheral.wrap(Side)
- batName = nameBat
- batEnergyStored = bat.getEnergyStored()
- batMaxEnergyStored = bat.getMaxEnergyStored()
- xPos = minA
- yPos = margeW
- pct = math.floor((batEnergyStored/batMaxEnergyStored)*100)
- term.setCursorPos(xPos+1,yPos)
- term.clearLine()
- term.setTextColor(runColor)
- print(batName)
- term.setTextColor(colors.white)
- term.setCursorPos(xPos+1,yPos+1)
- term.clearLine()
- print(batEnergyStored.."/"..batMaxEnergyStored.." RF")
- end
- end
- term.clear()
- if monActiv then
- mon = peripheral.wrap(monSide)
- term.redirect(mon)
- end
- term.setBackgroundColor(backColor)
- term.clear()
- sleep(1)
- while true do
- sleep(0)
- term.setBackgroundColor(backColor)
- energyScreen()
- liquidScreen()
- screen()
- end
Advertisement
Add Comment
Please, Sign In to add comment